The browser as a weapon β exploit trust assumptions to execute code, forge requests, and hijack sessions. Master Objective 7 for the GIAC GWAPT exam.
XSS executes attacker code in victims’ browsers. CSRF executes actions on victims’ behalf. Client-injection attacks exploit every trust assumption baked into the browser’s rendering engine.
| # | Objective | This Page |
|---|---|---|
| 1 | Web Application Overview | — |
| 2 | Reconnaissance and Mapping | — |
| 3 | Web Application Configuration Testing | — |
| 4 | Web Application Authentication Attacks | — |
| 5 | Web Application Session Management | — |
| 6 | Web Application SQL Injection Attacks | — |
| ⭐ 7 | Cross-Site Request Forgery, XSS & Client Injection Attacks | ✓ This Page |
| 8 | Web Application Testing Tools | — |
Reflected, Stored, and DOM-based. Injects JavaScript into victims’ browsers using the target site’s trusted origin.
Forces authenticated users’ browsers to send forged requests. Bypasses CSRF tokens via missing validation, format-only checks, and session-decoupled tokens.
HTML injection, JavaScript injection, CRLF / HTTP header injection, clickjacking, and CSS injection.
Key defense header; understand directives, unsafe-inline risk, nonce patterns, and bypass techniques.
Complete technical reference for every attack and defense mechanism tested on the GWAPT exam.
XSS occurs when an application includes unvalidated user input in its output without proper encoding, allowing an attacker to inject JavaScript that executes in victims’ browsers. The browser trusts the script because it appears to originate from the legitimate site.
Payload in the HTTP request, reflected immediately. Requires social engineering. One victim per click.
Payload persisted in DB/files. Affects every user who views the page. No click required. Wormable.
Never reaches the server. Client-side JS reads attacker data from DOM and writes it unsafely.
Payload sent in the request, echoed in the response without encoding. Victim must click a crafted URL.
Exploitation payloads:
Payload stored in the application’s database and served to every user viewing the affected page. No per-victim social engineering required. Higher severity than Reflected.
Common injection points: Comments, forum posts, user profiles, product reviews, chat messages, admin panels viewing user data.
Payload never sent to the server. Client-side JavaScript reads attacker-controlled data (source) and writes it to a dangerous DOM location (sink) without sanitization.
location.hashlocation.searchdocument.referrerpostMessagelocalStorageinnerHTMLdocument.write()eval()setTimeout('string')location.hrefCSRF forces an authenticated user’s browser to send a forged request to a target application using the user’s existing session. The application cannot distinguish the legitimate user’s request from the forged one.
Server includes a secret random token in each form. Server validates it on state-changing requests. Token tied to session — attacker can’t know it from a different origin.
Bypass checklist:
Inject raw HTML without JavaScript execution. Lower severity than XSS but creates convincing phishing pages within the legitimate domain. Useful when CSP blocks scripts but not HTML.
CRLF = \r\n terminates HTTP headers and starts a new line. If user input is reflected in a response header without stripping %0d%0a, an attacker can inject arbitrary headers.
Attacker overlays a transparent iframe of the target site on top of their own page. Victim clicks what appears to be the attacker’s button, actually clicks the target site’s button.
Transparent iframe of “Delete Account” positioned over “Win a Prize” button. Victim clicks, deletes account.
X-Frame-Options: DENY or SAMEORIGIN; CSP frame-ancestors 'none'. If neither is set → vulnerable.
Inject CSS in contexts where JS is blocked. Can exfiltrate data via CSS attribute selectors without JavaScript.
HTTP response header that restricts what resources the browser can load and execute. Primary defense against XSS.
Steal session cookie → account takeover. Blocked if cookie is HttpOnly.
Overlay fake login form → capture plaintext credentials.
Deliver BeEF hooks → full browser control, port scanning, webcam access.
XSS reads CSRF token from DOM, then forges authenticated requests — bypasses CSRF defenses entirely.
Six rapid-recall hooks designed for GWAPT exam conditions. Read, internalize, and recall under pressure.
Reflected — one victim, needs a click (link sent to victim)
Stored — all victims, no click needed (wormable)
DOM-based — client-side only, never hits the server
“Output not encoded = attacker controls the browser.” Context matters: HTML encoding ≠ JavaScript encoding ≠ URL encoding. One wrong context = XSS.
Authenticated — user must be logged in
Predictable — all request params known
Cookied — auth relies only on cookie/session
Not validated? Remove it.
Format-only check? Change the value.
Not tied to session? Use your own token.
In URL? Check Referer leak.
Carriage Return + Line Feed terminates HTTP headers. Inject %0d%0a in URL parameters to add headers or split responses. Enables cookie injection, redirects, response splitting.
If X-Frame-Options: DENY or CSP frame-ancestors 'none' is missing → site can be framed → clickjacking possible. Test with a simple iframe POC.
Scenario-based questions mirroring GWAPT CyberLive format. Read each vignette, then select the best answer.
Click any card to flip it. Front = question/term. Back = answer/definition.
Reflected: payload in the HTTP request, immediately echoed back, affects one victim per click, requires social engineering.
Stored: payload persisted in DB/files, served to all visitors, no social engineering needed, wormable.
Source: attacker-controlled input the page reads (location.hash, location.search, postMessage).
Sink: dangerous function that writes to the DOM (innerHTML, eval(), document.write()).
Exploit = data flows from source to sink without sanitization.
1. Authenticated: victim must be logged in to the target site.
2. Predictable: all request parameters are known/guessable.
3. Cookie-only auth: no secret token required beyond session cookies.
Strict: cookie never sent in any cross-site request. Strongest CSRF protection; may break cross-site navigation.
Lax: cookie sent only on top-level GET navigation. Protects against POST CSRF. Bypass: use GET for state change, or exploit Chrome’s 120-second new-session window.
CSP: HTTP response header that restricts which resources the browser can load/execute. Primary defense against XSS.
‘unsafe-inline’: permits inline <script> tags and event handlers — completely defeats CSP’s XSS protection.
Attack: transparent iframe of target site overlaid on attacker page. Victim clicks attacker’s visible button, actually clicks the target’s hidden button.
Defense: X-Frame-Options: DENY or SAMEORIGIN; or CSP frame-ancestors 'none' (CSP preferred).
\r\n terminates HTTP headers; URL-encoded as %0d%0a.
Enables: arbitrary header injection, cookie injection (Set-Cookie), open redirect injection (Location), and HTTP response splitting (blank line + injected body).
XSS executes within the same origin as the target site. The attacker’s injected script can:
1. Read the CSRF token from a hidden form field via the DOM
2. Include that token in a forged XMLHttpRequest
Result: CSRF token protection is completely defeated by XSS.
Five categories covering Objective 7. Expand the area where you feel weakest first.
Identification and differentiation under exam conditions
Craft payloads for filtered environments and chain into impact
Exploit and bypass all major CSRF protection mechanisms
Master the non-XSS injection techniques tested in Objective 7
Evaluate and bypass CSP in real application testing scenarios
Authoritative references for GWAPT Objective 7. Use alongside SANS SEC542 course materials.
Exam objectives, format, registration, and practice test information
Interactive labs for Reflected, Stored, and DOM-based XSS with real exploitation practice
CSRF mechanics, CSRF token bypass labs, SameSite cookie bypass scenarios
Context-specific output encoding rules for HTML, JS, URL, and CSS contexts
Comprehensive payload list including filter bypass techniques and context-specific payloads
Paste any CSP header to identify weaknesses, bypass opportunities, and missing directives