|
| 1 | +--- |
| 2 | +layout: advisory |
| 3 | +title: 'GHSA-wx95-c6cv-8532 (nokogiri): Nokogiri does not check the return value from |
| 4 | + xmlC14NExecute' |
| 5 | +comments: false |
| 6 | +categories: |
| 7 | +- nokogiri |
| 8 | +advisory: |
| 9 | + gem: nokogiri |
| 10 | + ghsa: wx95-c6cv-8532 |
| 11 | + url: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-wx95-c6cv-8532 |
| 12 | + title: Nokogiri does not check the return value from xmlC14NExecute |
| 13 | + date: 2026-02-18 |
| 14 | + description: | |
| 15 | + ## Summary |
| 16 | +
|
| 17 | + Nokogiri's CRuby extension fails to check the return value from |
| 18 | + `xmlC14NExecute` in the method `Nokogiri::XML::Document#canonicalize` |
| 19 | + and `Nokogiri::XML::Node#canonicalize`. When canonicalization fails, |
| 20 | + an empty string is returned instead of raising an exception. This |
| 21 | + incorrect return value may allow downstream libraries to accept |
| 22 | + invalid or incomplete canonicalized XML, which has been demonstrated |
| 23 | + to enable signature validation bypass in SAML libraries. |
| 24 | +
|
| 25 | + JRuby is not affected, as the Java implementation correctly |
| 26 | + raises `RuntimeError` on canonicalization failure. |
| 27 | +
|
| 28 | + ## Mitigation |
| 29 | +
|
| 30 | + Upgrade to Nokogiri `>= 1.19.1`. |
| 31 | +
|
| 32 | + ## Severity |
| 33 | +
|
| 34 | + The maintainers have assessed this as **Medium** severity. Nokogiri |
| 35 | + itself is a parsing library without a clear security boundary |
| 36 | + related to canonicalization, so the direct impact is that a method |
| 37 | + returns incorrect data on invalid input. However, this behavior |
| 38 | + was exploited in practice to bypass SAML signature validation |
| 39 | + in downstream libraries (see References). |
| 40 | +
|
| 41 | + ## Credit |
| 42 | +
|
| 43 | + This vulnerability was responsibly reported by HackerOne |
| 44 | + researcher `d4d`. |
| 45 | + cvss_v3: 5.3 |
| 46 | + unaffected_versions: |
| 47 | + - "< 1.5.1" |
| 48 | + patched_versions: |
| 49 | + - ">= 1.19.1" |
| 50 | + related: |
| 51 | + url: |
| 52 | + - https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-wx95-c6cv-8532 |
| 53 | + - https://github.com/advisories/GHSA-wx95-c6cv-8532 |
| 54 | +--- |
0 commit comments