XSS Session
What is XSS?
Cross-Site Scripting (XSS) lets attackers run JavaScript in your browser within the app's context. Same origin = access to your cookies, session tokens, and actions.
Why it matters: Account takeover, data theft, defacement.
The 3 Types (same root cause: unsanitized input)
Reflected XSS
Payload in URL/search → server reflects it back immediately → executed in browser.
- Needs victim to click link
- Example: search for
<script>alert(1)</script>→ result page shows your input without encoding
Stored XSS
Payload saved in database → executes for every later visitor.
- Higher impact (affects all users)
- Example: submit feedback with
<img src=x onerror=alert(1)>→ executes every time admin reads it
DOM-based XSS
Pure client-side. JavaScript reads user input (URL param, localStorage) and writes to DOM without sanitizing.
- No server roundtrip
- Example: search bar JS uses
innerHTMLto display results
Challenge Order (Juice Shop)
Work through in this order. Each builds on previous.
Challenge 1: DOM XSS ⭐
Location: Search bar
Type: DOM-based
What to do:
- Type in search bar
- Observe: your input appears in page + URL
- Try injecting HTML: search for
<b>test</b>— does it bold? - If yes, try:
<img src=x onerror=alert('xss')> - Open DevTools Elements tab, find where your input landed
Success criteria: Alert fires. You can point to the sink (innerHTML or similar) in DevTools.
Challenge 2: Bonus Payload ⭐
Location: Same search bar
Type: DOM filter bypass
What to do:
- Certain tags are blocked now (if you already solved DOM XSS, the vector changed)
- Try alternatives:
<svg>,<iframe>, event handlers likeonerror,onload - Experiment: what gets through the filter?
Success criteria: Different payload fires. You know which filter you bypassed.
Challenge 3: Reflected XSS ⭐⭐
Location: Order history / tracking
Type: Reflected
What to do:
- Find a page that takes input (search, order ID, tracking number)
- Submit a value
- Observe where it appears on result page
- Try injecting:
<img src=x onerror=alert('xss')> - Burp Suite or DevTools Network tab: capture request, see what you sent
Success criteria: Alert fires on result page. You can see your payload in request/response.
Tools You Need
- Browser DevTools (DevTools → Network, Elements, Console tabs)
- Burp Suite Community or OWASP ZAP (intercept + modify requests)
- Patience + note-taking
What NOT to Do
- Do not read Juice Shop source code
- Do not use the hacking instructor (disable it)
- Do not look up solutions before trying
- Do not modify DB directly
Homework (after session, 5 min write-up)
For each challenge you solve:
- Challenge name
- How you found it (what tool, what clue)
- Time spent (start → solved)
- Dead ends (what didn't work)
This becomes your baseline for comparing manual vs AI approaches later.