SAML security: signature validation, XML wrapping, and Golden SAML
SAML single sign-on depends on the service provider validating signed XML assertions correctly. How signature wrapping and comment-injection bugs bypassed validation, what Golden SAML means for identity provider signing keys, and how to review an integration.
Diagram
What a service provider must check
Step 1 of 4
Response
The identity provider posts a signed assertion through the browser.
<saml:Assertion ID="_a7f3" IssueInstant="2026-11-03T10:02:11Z"> <saml:Issuer>https://idp.example.test</saml:Issuer> <ds:Signature>...</ds:Signature> <saml:Subject><saml:NameID>ana@example.test</saml:NameID></saml:Subject> <saml:Conditions NotOnOrAfter="2026-11-03T10:07:11Z"><saml:AudienceRestriction><saml:Audience>https://app.example.test</saml:Audience></saml:AudienceRestriction></saml:Conditions> </saml:Assertion>
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Signature wrapping
- What fails
- A signed element is moved and an unsigned one is read instead.
- Who is affected
- Every account on the service provider.
- What you would notice
- Custom code that finds NameID with a generic XPath.
- What you change
- Use a maintained library and read identity from the verified node.
Parser differences
- What fails
- In 2018, comment handling in several libraries let NameID be truncated.
- Who is affected
- Users of affected libraries.
- What you would notice
- Old versions of SAML libraries.
- What you change
- Keep SAML libraries patched.
Golden SAML
- What fails
- With the IdP’s token-signing key, an attacker can forge assertions for any user.
- Who is affected
- Every federated application.
- What you would notice
- Exports of AD FS token-signing certificates or unusual key access.
- What you change
- Protect signing keys in HSMs, monitor access, and rotate after compromise.
Seen in the wild
Golden SAML was described by CyberArk in 2017 and used in the 2020 SolarWinds-related intrusions, where attackers took AD FS signing material. Microsoft’s guidance since then is to move federation to Entra ID where possible, and to watch for token-signing certificate changes.
Check yourself
Recognition and the fix. Nothing here is a procedure.
What does an XML signature wrapping attack exploit?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.