Web vulnerability classes: XSS, CSRF, CORS and clickjacking
Four ways the web can be tricked: script in a page, a forged request, a loose sharing rule and a hidden frame. Learn what each is and the safe check for each.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: different ways a forged letter can reach a mailroom. One letter has a fake stamp. One looks like it came from the boss. One is hidden inside another envelope. The mailroom must spot each trick in its own way.
Daily List is a to-do list app. Tom, the tester, has to test its test copy. He looks at four tricks. A task title that the page treats as code. A request the browser sends without the person meaning it. A sharing rule that is too loose. A page hidden inside another page.
Each trick has a name. The names are , , cross-origin resource sharing and clickjacking. Tom learns what each one means and one safe check for each.
The picture has a limit. A mailroom sees one letter at a time. A browser handles many requests at once, from many sites.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
PLAIN WORDS · 2 in this section
- mailroom
- the room where post is sorted
- clickjacking
- tricking a visitor into clicking a hidden page
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Knowing four different tricks that can reach a web app, and one safe check for each.
- Input as code
- Forged request
- Loose sharing rule
- Hidden frame
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| A fake stamp | Input treated as code (cross-site scripting) |
| A letter that looks like it came from the boss | A forged request |
| A mailroom door left open to other offices | A loose sharing rule |
| A letter hidden in another envelope | A page hidden in a frame |
WHERE THIS PICTURE STOPS
- A mailroom sees one letter at a time. A browser handles many requests at once.
- Real tricks are often combined, but the picture shows them one by one.
- Each trick has its own defence. A single lock is never the whole answer.
HOOK
Four tricks, four different locks.
REMEMBER IT THIS WAY
A chunk: a long list grouped so it is easier to hold.
Four tricks, four looks: code hiding in a title, a request nobody meant, a sharing rule too loose, a page hidden inside another.
| In the trick | What it stands for |
|---|---|
| Code hiding in a title | cross-site scripting |
| A request nobody meant | cross-site request forgery |
| A sharing rule too loose | cross-origin resource sharing |
| A page hidden inside another | clickjacking |
TELL A FRIEND
A mailroom meets four tricks: a fake stamp, a forged sender, a door left open and a letter hidden in another envelope. Each needs its own check.
OFTEN MIXED UP WITH Hostile input and injection ideas. The injection lesson teaches input handling in general. This lesson names four web weaknesses and for each.
Sources & standards — 6 sources
- Market practice
Cross site scripting prevention cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · Framework security, context-specific output encoding, sanitisation and safe sinks; actual selected sections read6 November2026.
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read framework security, context-specific output encoding, sanitisation and safe-sink sections. HTML interpretation alone does not establish script execution; intentionally accepted rich HTML needs appropriate sanitisation.
- Market practice
Cross site request forgery prevention cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · Token/session binding, signed double-submit, Fetch Metadata with fallback, custom headers/CORS and origin/SameSite sections; read6 November2026.
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read token/session binding, signed double-submit, Fetch Metadata/fallback, custom-header/CORS and origin/SameSite sections. Missing a token alone does not show all configured defences absent.
- Market practice
Cross-Origin Resource Sharing (CORS) (MDN Web Docs) ↗ — Mozilla · Functional overview and simple, preflighted and credentialed request examples; actual body and original source SVGs reviewed6 November2026.
Found through a web search; the page was not opened (pending verification: official page not opened and not searched (web-search limit reached before the check); URL is the publisher's known address). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read functional overview, simple/preflight/credentialed examples and browser response access. Original three SVGs inspected privately. Wildcard origin cannot authorise a credentialed browser response; some requests reach the server without preflight.
- Market practice
DOM-based XSS: sources, sinks and stored/reflected data ↗ — PortSwigger · Actual DOM-based XSS explanation, including the section combining DOM processing with reflected and stored data; read6 November2026.
Actual primary source sections reviewed on 6 November 2026 for the V34 Security domain analysis. The source describes guidance for its own context, not a guarantee that a test proves complete security. No source example was executed.
- Market practice
What is clickjacking? (PortSwigger Web Security Academy) ↗ — PortSwigger · Actual definition, CSRF-token distinction and X-Frame-Options/CSP frame-ancestors prevention sections; read6 November2026.
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read actual definition, real user action in hidden frames, CSRF-token distinction and effective X-Frame-Options/CSP frame-ancestors controls.
- Market practice
OWASP Top 10:2025 Introduction ↗ — OWASP · 2025 edition introduction/change list; preserve2021 rankings under their own edition label; actual page read6 November2026.
Actual primary source sections reviewed on 6 November 2026 for the V34 Security domain analysis. The source describes guidance for its own context, not a guarantee that a test proves complete security. No source example was executed.
PRACTISE AND KEEP
Sources for this topic — 15 sources
- Market practice
Cross-site scripting (PortSwigger Web Security Academy) ↗ — PortSwigger · Cross-site scripting: input returned or stored and then run as script in another person's browser; reflected, stored and DOM-based kinds (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Cross site request forgery prevention cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · Token/session binding, signed double-submit, Fetch Metadata with fallback, custom headers/CORS and origin/SameSite sections; read6 November2026.
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read token/session binding, signed double-submit, Fetch Metadata/fallback, custom-header/CORS and origin/SameSite sections. Missing a token alone does not show all configured defences absent.
- Market practice
What is CORS (cross-origin resource sharing)? (PortSwigger Web Security Academy) ↗ — PortSwigger · Cross-origin resource sharing extends the same-origin policy; a badly set policy can expose data; cross-origin resource sharing is not a defence against cross-site request forgery (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
What is clickjacking? (PortSwigger Web Security Academy) ↗ — PortSwigger · Actual definition, CSRF-token distinction and X-Frame-Options/CSP frame-ancestors prevention sections; read6 November2026.
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read actual definition, real user action in hidden frames, CSRF-token distinction and effective X-Frame-Options/CSP frame-ancestors controls.
- Market practice
Open Worldwide Application Security Project (OWASP) Top 10:2021, introduction ↗ — Open Worldwide Application Security Project (OWASP) · The Top 10 list is revised between editions, so the edition must be named (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: 2021 edition. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Testing for Reflected Cross Site Scripting (WSTG v4.2) ↗ — OWASP · OWASP WSTG pages on reflected, stored and DOM-based XSS; the guide says manual review is needed for DOM-based because automated tools miss many cases. Search excerpts, pages not opened. Authorised, harmless-input testing only.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Testing for Stored Cross Site Scripting (WSTG v4.1) ↗ — OWASP · OWASP WSTG pages on reflected, stored and DOM-based XSS; the guide says manual review is needed for DOM-based because automated tools miss many cases. Search excerpts, pages not opened. Authorised, harmless-input testing only.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Testing for DOM-based Cross Site Scripting (WSTG v4.2) ↗ — OWASP · OWASP WSTG pages on reflected, stored and DOM-based XSS; the guide says manual review is needed for DOM-based because automated tools miss many cases. Search excerpts, pages not opened. Authorised, harmless-input testing only.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Why does my JavaScript receive a CORS error while Postman does not? (Sentry) ↗ — Sentry · Sentry answers 'no Access-Control-Allow-Origin header error while Postman does not' and ApyHub CORS page (search excerpts, pages not opened). Official page checked 2026-10-19 by WebSearch: search excerpt, page not opened.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
What is CORS and why is it blocking my request? (ApyHub) ↗ — ApyHub · Sentry answers 'no Access-Control-Allow-Origin header error while Postman does not' and ApyHub CORS page (search excerpts, pages not opened). Official page checked 2026-10-19 by WebSearch: search excerpt, page not opened.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Cross-Origin Resource Sharing (CORS) (MDN Web Docs) ↗ — Mozilla · Sentry answers 'no Access-Control-Allow-Origin header error while Postman does not' and ApyHub CORS page (search excerpts, pages not opened). Official page checked 2026-10-19 by WebSearch: search excerpt, page not opened.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Cross-Origin Resource Sharing (CORS) (MDN Web Docs) ↗ — Mozilla · Functional overview and simple, preflighted and credentialed request examples; actual body and original source SVGs reviewed6 November2026.
Found through a web search; the page was not opened (pending verification: official page not opened and not searched (web-search limit reached before the check); URL is the publisher's known address). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read functional overview, simple/preflight/credentialed examples and browser response access. Original three SVGs inspected privately. Wildcard origin cannot authorise a credentialed browser response; some requests reach the server without preflight.
- Market practice
Cross site scripting prevention cheat sheet (Open Worldwide Application Security Project) ↗ — Open Worldwide Application Security Project (OWASP) · Framework security, context-specific output encoding, sanitisation and safe sinks; actual selected sections read6 November2026.
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
V34 review, 6 November 2026: Read framework security, context-specific output encoding, sanitisation and safe-sink sections. HTML interpretation alone does not establish script execution; intentionally accepted rich HTML needs appropriate sanitisation.
- Market practice
DOM-based XSS: sources, sinks and stored/reflected data ↗ — PortSwigger · Actual DOM-based XSS explanation, including the section combining DOM processing with reflected and stored data; read6 November2026.
Actual primary source sections reviewed on 6 November 2026 for the V34 Security domain analysis. The source describes guidance for its own context, not a guarantee that a test proves complete security. No source example was executed.
- Market practice
OWASP Top 10:2025 Introduction ↗ — OWASP · 2025 edition introduction/change list; preserve2021 rankings under their own edition label; actual page read6 November2026.
Actual primary source sections reviewed on 6 November 2026 for the V34 Security domain analysis. The source describes guidance for its own context, not a guarantee that a test proves complete security. No source example was executed.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.