본문으로 건너뛰기
Skillpedia
보안6.5k · #14078

saml

하는 일

이 스킬은 XML 서명 래핑을 포함해 SAML 단일 로그인에 대한 공격을 설명합니다. 기업 로그인 설정을 검토하는 보안 테스터를 위한 스킬입니다.

사용하는 경우

  • ✓사이트가 회사 로그인을 위해 SAML 단일 로그인을 사용하고 이를 테스트하려는 경우.
  • ✓검토할 SAML 응답이나 메타데이터 파일이 있을 때.
  • ✓보안 검토에서 로그인 어설션의 서명이 올바르게 확인되는지 물을 때.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/saml/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/saml/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 회사 SAML 로그인이 바뀐 로그인 메시지를 받아들이는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 SAML 메시지를 디코딩한 뒤, 서버가 서명과 중복 어설션을 어떻게 처리하는지 테스트해 잘못된 부분을 신뢰하는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

SAML Attack Playbook

SAML is XML-based SSO used heavily in enterprise. Signatures protect assertions but XML's structural flexibility creates many opportunities to confuse signature validators.

1. Capture the flow

# Identify SAML in recon — look for:
# - /SAML/login, /sso/saml, /saml2/login
# - Form param "SAMLRequest" or "SAMLResponse" (base64 + deflate)
# - SP metadata: /SAML/metadata, /sp/metadata.xml
# - IdP metadata: /idp/metadata.xml

# Decode a SAML message in Burp via the SAML Raider plugin
# Or manually
echo "$SAMLResponse_base64" | base64 -d | xmllint --format -

2. XML Signature Wrapping (XSW) attacks

The classic SAML bug class. 8 canonical variants. SAML Raider implements all of them.

XSW1: Wrap signed Assertion inside Response, add evil assertion

<Response>
  <ds:Signature>...</ds:Signature>  <!-- signs the inner Assertion -->
  <Assertion id="evil">
    <Subject>attacker</Subject>
    <AttributeStatement>...</AttributeStatement>
  </Assertion>
  <!-- original signed assertion moved into a deeper child or as sibling of evil -->
  <Assertion id="orig">
    <Subject>victim</Subject>
    ...
  </Assertion>
</Response>

Parser-checks-signature on orig (still valid). App-reads-claims from evil (first assertion). Bypass complete.

XSW2-8

Vary which element is signed, what gets added where, what gets renamed. Run all 8 via SAML Raider's automated XSW tester.

3. Comment injection

SAML libraries that strip XML comments BEFORE signature validation but the application reads the un-stripped version (or vice versa):

<Subject>victim@target.com<!-- foo -->.evil.com</Subject>

Some parsers see victim@target.com; others see victim@target.com.evil.com.

Famous: Cisco DUO + others in 2018 (CVE-2018-0489).

4. Signature stripping

Just delete the <ds:Signature> element. Some servers fail to enforce signature presence.

5. Self-signed assertion (when allowed by misconfig)

Some SPs accept assertions from any IdP listed in their trust store. If the trust store is overly broad, attacker stands up own IdP, generates own cert, IdP signs assertion claiming victim identity.

6. Bypass via SAMLResponse to SAMLRequest confusion

Both are base64'd + deflated XML. Some endpoints handle either. Sending an unsigned SAMLResponse when the endpoint expects a SAMLRequest may bypass auth.

7. Attribute injection via metadata

If SP fetches IdP metadata at runtime from a URL (not pinned), attacker who can poison/spoof that URL injects malicious metadata claiming attacker's IdP signs as victim's IdP.

8. Replay

Many SAML implementations don't track assertion IDs. Capture a victim's SAML response, replay it later. Mitigation: assertions have NotOnOrAfter

  • unique ID; SPs should track recently-used IDs in a cache.

9. KeyInfo / certificate confusion

<ds:KeyInfo> can carry the cert inline. Attacker:

  • Sends own cert in KeyInfo
  • Signs assertion w/ corresponding private key
  • Server validates against the cert in KeyInfo (instead of its trust store)

10. Tools

  • SAML Raider (Burp plugin) — XSW1-8 automation, signature operations, message editing. Essential.
  • samltool.com — XML pretty-print + base64 decode
  • samlxss — quick XSS payload tester in SAML attributes
  • Python saml2 — manual crafting via lxml

11. PoC pattern

  1. Capture victim's SAMLResponse in Burp
  2. Decode, identify Subject + AttributeStatement
  3. Launch SAML Raider → "XSW Test" → cycle through all 8 variants, observe response
  4. Any variant that returns logged-in-as-target = bug
  5. If XSW fails, try comment injection: inject <!-- foo --> in claim values
  6. If still fails, try signature stripping (delete <ds:Signature>)
  7. Document the modified SAMLResponse + the resulting authenticated session as PoC

12. Severity calibration

Bug Typical
XSW variant accepted → arbitrary user impersonation Critical 9.8 (most enterprise SSO bounty)
Comment injection accepted Critical 9.8
Signature stripping accepted Critical 9.8
KeyInfo cert trust Critical 9.8
Replay window > 5 min High 7-8
Self-IdP misconfig Critical 9.8

13. Defender remediation

  • Use a battle-tested library (PySAML2, opensaml-cpp, OneLogin's SAML libs)
  • Pin trusted IdPs by cert fingerprint, not URL
  • Cache assertion IDs and reject replays
  • Validate signature BEFORE comment-stripping (or after, but consistently)
  • Reject responses w/o `ds:Signature
자주 묻는 질문

XML 서명 래핑이란 무엇인가요?

올바르게 서명된 부분은 유효하게 남고, 앱은 그 대신 위조된 부분을 읽게 만드는 기법입니다.

어떤 도구를 언급하나요?

흔한 래핑 변형을 구현한 SAML Raider 도구를 언급합니다.

서명 제거도 다루나요?

네. 서명 제거와 어설션 위조를 공격 유형에 포함합니다.

상세 정보

작성자의 원본 설명

SAML 2.0 attacks — XSW (XML Signature Wrapping) variants 1-8, comment injection, signature stripping, assertion forgery, IdP metadata abuse.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14078
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬