Lesson 11 of 14 · 16m
SAML: The XML You Can't Avoid
Signature wrapping attacks from 2012 still ship as CVEs, and a stolen IdP signing cert mints identities for everyone.
How the flow actually goes
SAML 2.0 is the SSO protocol enterprise IT deployed before OIDC existed, and it is still the thing inside every "Log in with Okta/Entra/ADFS" button at large companies. SP-initiated flow: the service provider redirects the browser to the identity provider with a deflated, base64'd SAMLRequest; the IdP authenticates the user and POSTs back a SAMLResponse to the SP's ACS endpoint — an XML document containing a signed Assertion that asserts "subject X authenticated, here are attributes." IdP-initiated is the same minus the request — an unsolicited assertion, which is why it carries replay and login-CSRF risk and why InResponseTo validation exists.
The signature wraps a subtree — make sure it's the right one
XML signatures sign specific elements by reference, and the signature itself lives inside the document it protects. The 2012 USENIX Security paper "On Breaking SAML" (Somorovsky et al.) showed how this falls apart: XML Signature Wrapping moves the legitimately-signed assertion into a dead branch of the document tree and splices a forged, unsigned assertion into the position the application actually parses. The library validates "a signature" and reads "an assertion" — two different nodes. Verified. Forged. Accepted.
This is not a dead research problem. CVE-2024-45409 — ruby-saml's improper signature verification — let unauthenticated attackers forge SAML responses; GitLab self-managed used omniauth-saml, which uses ruby-saml, and GitLab shipped emergency patches in September 2024; CISA added it to the Known Exploited Vulnerabilities catalog. The 2012 attack shape, in a shipped product, twelve years later. Then CVE-2025-25291/25292 hit ruby-saml again in March 2025 — parser-differential wrapping variants. Same disease, new antibodies.
The bindings and the assertion's moving parts
Two transports carry these messages: HTTP-Redirect binding (the SAMLRequest goes in the URL — deflated, base64'd, optionally signed) and HTTP-POST binding (the SAMLResponse comes back in an auto-submitting form). Inside the response: Issuer, Subject/NameID (the identity you're trusting), Conditions (NotBefore/NotOnOrAfter — the validity window that replay protection depends on), AudienceRestriction (must name your SP entity ID), and AuthnStatement. Every element is a check. AudienceRestriction is the aud equivalent and gets skipped exactly as often.
InResponseTo deserves its own sentence: on SP-initiated flows it binds the response to a request your SP actually made. Skip it and you're accepting unsolicited assertions — which is what IdP-initiated flow is by design, carrying replay and login-CSRF risk that needs compensating controls, not blind acceptance.
Golden SAML: when the IdP itself is the breach
Everything above assumes your parser is the weak point. The SolarWinds/SUNBURST campaign (disclosed December 2020) showed the other end: the actor stole the ADFS token-signing certificate and forged assertions for arbitrary users — "Golden SAML." No wrapping trick needed when you hold the key; every SP trusting that IdP accepted minted identities. The lesson transfers to OIDC signing keys identically: IdP signing material is crown-jewel infrastructure. HSMs, rotation, scope, and audit around it are identity security, not PKI trivia.
The wrong mental model
"It's signed XML, so it's safe." Signed what, validated by which library, trusted under which key, in response to which request? Canonicalization differentials (two parsers disagreeing on what the canonical document even is) are the wrapping attack's little sibling — C14N is where validation bugs breed.
What to actually do
Prefer OIDC when the choice is yours — smaller parser surface, JWT libraries are better maintained, and the attack classes are better understood. When SAML is mandatory (it will be): use a maintained library — the ruby-saml CVEs are the cautionary tale — keep it patched, reject unsigned and duplicated assertions, validate InResponseTo on SP-initiated flows, treat IdP-initiated login as a weaker flow that needs tighter replay controls, and protect IdP signing keys like root CA material.
Keep reading
Related articles from the SudoSecurity blog.
A 257-Byte Password Is the Key: Inside the OpenSSH musl Bypass
CVE-2026-123158 lets an attacker log into a locked account on musl-based systems like Alpine by sending a password nobody set. The trigger is one number, 257, and the reason is a C library returning a single asterisk. I reproduced the exact boundary against musl 1.2.4 and read the fix.
Zero-Trust Access for Homelabbers: Teleport vs. Tailscale vs. WireGuard vs. Cloudflare Tunnel
Four tools solve four different problems that all get pitched as the same problem. Here's what each one does, where each one breaks, and the combination that covers a real homelab without paying an SSO tax you didn't see coming.
The SSO Tax: Why Self-Hosted Projects Are Gating Login Behind a Paywall
A growing list of open-core self-hosted projects, from Grafana to Planka, gate single sign-on behind an Enterprise tier. Here's which protocol actually gets paywalled, and what to check before you deploy.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.