← Lab /Security & privacy

Ruby-SAML and PHP-SAML can be fully bypassed via parser bugs and void canonicalization

Ruby-SAML 1.12.4 and PHP-SAML libraries allow an attacker to completely bypass authentication by exploiting parser inconsistencies and a void canonicalization bug.

Security & privacy PortSwigger Research 10 Dec 2025 Attack Prototype evidence

Published as “The Fragile Lock: Novel Bypasses For SAML Authentication”

Why it matters

These findings show that many SAML libraries remain vulnerable to authentication bypass despite recent patches, urging a redesign of XML parsing and signature validation.

Summary

The writeup demonstrates that differences between XML parsers (REXML, Nokogiri, libxml2) can be abused to split signature verification from assertion processing. By crafting SAML responses that trigger attribute-namespace collisions and a new "Void Canonicalization" bug, the authors achieve a full authentication bypass on a vulnerable GitLab EE instance. They also release an open-source toolkit to find such parser discrepancies. The evidence consists of a live demo and a disclosed large-scale SaaS breach, but no systematic measurement across many deployments.

What they found 2

  1. Ruby-SAML 1.12.4 and php-saml libraries are vulnerable to the canonicalization exploit.

    “The ruby-saml 1.12.4 and php-saml libraries are vulnerable to the canonicalization exploit, and other PHP XMLDSig implementations, such as Rob Richards’ xmlseclibs are also affected.”

  2. Both Ruby (Nokogiri) and PHP expose libxml2 behaviors that can desynchronize signature verification from assertion parsing.

    “Both Ruby (Nokogiri) and PHP expose libxml2 behaviors that can desynchronize signature verification from assertion parsing.”

Caveats 3

  • At this stage, we can successfully bypass the SignatureValue verification, but the process fails with an invalid DigestValue.
  • The attack relies on attribute order causing xmlGetProp to return different values: "In the first case, the call xmlGetProp returns 1, while in the second case it returns 2."
  • It depends on libxml2 canonicalization returning an empty string on error: "Instead of failing securely, Nokogiri canonicalization implementation simply returns an empty string when this error occurs."

What’s new here 4

  • Identification of a new Void Canonicalization class of attacks that skips digest computation.
  • Demonstration that attribute namespace handling differences between REXML and libxml2-based parsers enable signature wrapping.
  • Release of an open-source toolkit for detecting parser inconsistencies in SAML libraries.
  • Real-world bypass of Ruby-SAML 1.12.4 and PHP-SAML in a GitLab EE deployment.