SAML XML 签名包装攻击:攻击者注入绕过签名验证的恶意断言
SAML XML signature wrapping attack: attacker injects malicious assertions that bypass signature validation
ID: security/saml-xml-signature-wrapping-bypass
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| OpenSAML 4.3.0 | active | — | — | — |
| Shibboleth IdP 4.3.0 | active | — | — | — |
| SimpleSAMLphp 1.19.0 | active | — | — | — |
| Microsoft AD FS 2019 | active | — | — | — |
| Okta SAML 1.0.0 | active | — | — | — |
根因分析
SAML 响应解析器验证原始断言的签名,但处理通过 XML 包装(例如使用 ID 重复或 SOAP 信封操作)注入的未签名断言,从而允许攻击者控制的属性。
English
SAML response parser validates the signature on the original assertion but processes a different, unsigned assertion injected via XML wrapping (e.g., using ID duplication or SOAP envelope manipulation), allowing attacker-controlled attributes.
官方文档
https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf解决方案
-
Enforce strict assertion ID uniqueness and reject responses with duplicate IDs. Example in Java using OpenSAML: set `strictValidation=true` and configure `IdAttributeResolver` to check for duplicates.
-
Use a whitelist of allowed assertion IDs or require that the signed assertion is the only one processed, ignoring any wrapped content.
无效尝试
常见但无效的做法:
-
85% 失败
Attackers can place the malicious assertion before the signed one; parser may process the first unsigned assertion.
-
75% 失败
Wrapping attacks use well-formed XML that passes schema validation; the attack is structural, not syntactic.
-
80% 失败
Attackers can sign the malicious assertion with a stolen or self-signed certificate if the trust store is misconfigured.