Monitor vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
5.3
Nokogiri's XML Parsing Fails on Invalid Input, Disrupts SAML Signature Validation
GHSA-wx95-c6cv-8532
Summary
Nokogiri, a popular XML parsing library, has a bug that can cause it to accept invalid XML, which can allow attackers to bypass security checks in some systems. This can lead to security issues in certain applications, especially those using SAML (Security Assertion Markup Language). To fix this, update to Nokogiri version 1.19.1 or later.
What to do
- Update mike dalessio nokogiri to version 1.19.1.
Affected software
| Vendor | Product | Affected versions | Fix available |
|---|---|---|---|
| mike dalessio | nokogiri | > 1.5.1 , <= 1.19.1 | 1.19.1 |
Original title
Nokogiri does not check the return value from xmlC14NExecute
Original description
## Summary
Nokogiri's CRuby extension fails to check the return value from `xmlC14NExecute` in the method `Nokogiri::XML::Document#canonicalize` and `Nokogiri::XML::Node#canonicalize`. When canonicalization fails, an empty string is returned instead of raising an exception. This incorrect return value may allow downstream libraries to accept invalid or incomplete canonicalized XML, which has been demonstrated to enable signature validation bypass in SAML libraries.
JRuby is not affected, as the Java implementation correctly raises `RuntimeError` on canonicalization failure.
## Mitigation
Upgrade to Nokogiri `>= 1.19.1`.
## Severity
The maintainers have assessed this as **Medium** severity. Nokogiri itself is a parsing library without a clear security boundary related to canonicalization, so the direct impact is that a method returns incorrect data on invalid input. However, this behavior was exploited in practice to bypass SAML signature validation in downstream libraries (see References).
## Credit
This vulnerability was responsibly reported by HackerOne researcher `d4d`.
Nokogiri's CRuby extension fails to check the return value from `xmlC14NExecute` in the method `Nokogiri::XML::Document#canonicalize` and `Nokogiri::XML::Node#canonicalize`. When canonicalization fails, an empty string is returned instead of raising an exception. This incorrect return value may allow downstream libraries to accept invalid or incomplete canonicalized XML, which has been demonstrated to enable signature validation bypass in SAML libraries.
JRuby is not affected, as the Java implementation correctly raises `RuntimeError` on canonicalization failure.
## Mitigation
Upgrade to Nokogiri `>= 1.19.1`.
## Severity
The maintainers have assessed this as **Medium** severity. Nokogiri itself is a parsing library without a clear security boundary related to canonicalization, so the direct impact is that a method returns incorrect data on invalid input. However, this behavior was exploited in practice to bypass SAML signature validation in downstream libraries (see References).
## Credit
This vulnerability was responsibly reported by HackerOne researcher `d4d`.
ghsa CVSS3.1
5.3
Vulnerability type
CWE-252
Published: 18 Feb 2026 · Updated: 7 Mar 2026 · First seen: 6 Mar 2026