chain-xss-to-account-takeover
Skill1 starsChanged 2 days agoMITView on GitHub
Analyze and validate XSS escalation chains: stored XSS to session/token theft, XSS combined with CSRF to perform privileged actions as the victim, and XSS used as an in-browser keylogger/credential harvester. Use when chain-analysis pairs a confirmed stored or persistent reflected XSS with identity-map's session/token mechanics. Do NOT use for self-XSS or XSS requiring implausible victim interaction not matching the engagement's defined threat actor — report those as standalone low-severity findings instead, see Gotchas.
In this repository134 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ai-agent-reconSkill
- ai-supply-chainSkill
- exfiltration-via-aiSkill
- indirect-injectionSkill
- llm-fuzzingSkill
- prompt-injectionSkill
- rag-poisoningSkill
- tool-abuseSkill
- chain-analysisSkill
- chain-auth-to-takeoverSkill
- chain-customSkill
- chain-graph-walkSkill
- chain-idor-to-mass-dataSkill
- chain-info-to-exploitSkill
- chain-multi-appSkill
- chain-ssrf-to-cloudSkill
- chain-web-to-rceSkill
- artifact-cleanupSkill
- credential-hygieneSkill
- data-retentionSkill
- email-securitySkill
- engagement-flowSkill
- evidence-sealSkill
- finding-disciplineSkill
- http-headers-securitySkill
- oob-interactionsSkill
- opsec-disciplineSkill
- research-firstSkill
- scope-disciplineSkill
- scope-importSkill
- session-contextSkill
- security-policy-parserSkill
- 2fa-bypassSkill
- api-abuseSkill
- auth-bypassSkill
- authz-matrixSkill
- broken-access-controlSkill
- business-logicSkill
- cache-poisoningSkill
- clickjackingSkill
- corsSkill
- credential-testingSkill
- crlf-injectionSkill
- cryptographic-oracleSkill
- csrfSkill
- css-injectionSkill
- data-exfiltration-testSkill
- deserializationSkill
- email-injectionSkill
- file-uploadSkill
- fuzzingSkill
- graphqlSkill
- grpcSkill
- host-headerSkill
- http-smugglingSkill
- idorSkill
- info-disclosureSkill
- jwtSkill
- lateral-movementSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
If the token is JS-reachable (non-HttpOnly cookie, localStorage/sessionStorage, or an Authorization header value cached in JS state), …
- Distinctive: line 62
Only pursue this pattern with explicit operator authorization given its direct-victim- impact nature.
- Distinctive: line 73
Every takeover claim requires a closed loop: payload delivered → effect observed on a controlled victim session → (if applicable) replay …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Signals
- A stored or persistent XSS is confirmed on a page viewed by other users (not just the attacker's own session) — this is the precondition for every pattern in this skill.
- identity-map shows session tokens are reachable from JS (non-
HttpOnlycookie, or token kept inlocalStorage/sessionStorage). - A privileged action exists behind CSRF protection that the XSS could bypass by acting as the victim's browser directly rather than forging a cross-origin request.
Prerequisites
- The XSS finding itself confirmed with a working injection point and payload context (HTML, attribute, JS string, URL) already identified.
- Explicit scope/authorization for testing against other real users' sessions vs. only test/sacrificial accounts — default to test accounts unless the client has explicitly scoped live-user impact testing.
Methodology
- Stored XSS → session/token theft.
- Confirm where the session credential lives (identity-map output). If it's an
HttpOnlycookie, direct JS theft of the cookie value is not possible — the chain instead needs to ride the victim's browser directly (see step 2) rather than exfiltrate the cookie string itself. - If the token is JS-reachable (non-
HttpOnlycookie,localStorage/sessionStorage, or anAuthorizationheader value cached in JS state), demonstrate exfiltration to an attacker-controlled listener using a test/sacrificial account's session, then demonstrate that the exfiltrated token is independently replayable from a separate client.
- Confirm where the session credential lives (identity-map output). If it's an
- XSS + CSRF (act-as-victim).
- For privileged actions protected by a CSRF token the attacker cannot forge cross-origin, demonstrate that the XSS payload, running same-origin in the victim's browser, can read the current page's CSRF token (from the DOM, a meta tag, or an in-page JS variable) and use it to submit the privileged action request directly.
- This proves the CSRF protection is irrelevant once XSS exists on the same origin — note this precisely in the writeup: it's not that CSRF protection failed on its own terms, it's that same-origin XSS inherently bypasses it. Keep the two findings' severities distinct accordingly (see report/gotchas: CSRF).
- XSS as keylogger/credential harvester.
- Only pursue this pattern with explicit operator authorization given its direct-victim- impact nature. Build a minimal in-browser listener (not a full offensive framework deployment against real users) that demonstrates capture of form input on the affected page, tested against a test account filling a test form — never capture real user credentials in a demonstration.
- The PoC artifact itself (keylogger payload) must be stored/handled per the engagement's evidence-handling rules; do not leave a live listener running past the demonstration window.
Validation gate
- Every takeover claim requires a closed loop: payload delivered → effect observed on a controlled victim session → (if applicable) replay from an independent client confirming the stolen credential/token actually works.
HttpOnly-protected tokens are explicitly noted as not directly exfiltratable — the chain write-up states which path was used (direct theft vs act-as-victim) accurately; don't blur the two.- Keylogger/credential-harvesting PoCs are scoped to test accounts and test data only, explicitly authorized, and time-boxed — no live listener survives past the demonstration.
Gotchas
- A
Content-Security-Policythat blocks inline scripts or restrictsconnect-srccan block the exfiltration channel even though the injection itself succeeds — test the actual exfil path, don't assume it works because the injection landed. SameSite=Strict/Laxcookies reduce classic CSRF risk but do nothing against same-origin XSS riding the victim's session directly — don't let a strongSameSitesetting lead to under-claiming the XSS+CSRF chain's real impact.- Self-XSS (requires the victim to paste something into their own console/URL bar) does not meet Gate 3 (can an unprivileged attacker trigger this against a victim) for most threat models — report it, if at all, as a standalone minor finding, not as the basis for a takeover chain.
- Short-lived session tokens reduce the exploitation window — note token lifetime in the writeup since it affects real-world severity, not just the demo's timing.
- Testing against a real logged-in user's session without separate explicit authorization is out of bounds regardless of how confident the XSS is — stick to test accounts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

