|
| 1 | +--- |
| 2 | +layout: advisory |
| 3 | +title: 'GHSA-8678-w3jw-xfc2 (nokogiri): Nokogiri: XML::Schema on JRuby allows network |
| 4 | + requests when NONET is set, bypassing CVE-2020-26247' |
| 5 | +comments: false |
| 6 | +categories: |
| 7 | +- nokogiri |
| 8 | +advisory: |
| 9 | + gem: nokogiri |
| 10 | + ghsa: 8678-w3jw-xfc2 |
| 11 | + url: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-8678-w3jw-xfc2 |
| 12 | + title: 'Nokogiri: XML::Schema on JRuby allows network requests when NONET is set, |
| 13 | + bypassing CVE-2020-26247' |
| 14 | + date: 2026-06-19 |
| 15 | + description: |- |
| 16 | + ### Summary |
| 17 | +
|
| 18 | + The `NONET` parse option, which Nokogiri turns on by default for |
| 19 | + `Nokogiri::XML::Schema` (see |
| 20 | + [CVE-2020-26247](https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m)), |
| 21 | + was not correctly enforced on the JRuby implementation. As a result, a schema |
| 22 | + parsed with default options could still cause external resources to be fetched |
| 23 | + over the network, potentially enabling SSRF or XXE attacks. |
| 24 | +
|
| 25 | + Nokogiri 1.19.4 replaces the scheme denylist with an allowlist. When `NONET` |
| 26 | + is enabled, only local resources (a `file:` scheme, or a relative or absolute |
| 27 | + path with no scheme) are resolved, and every network scheme is blocked, |
| 28 | + case-insensitively. This brings the JRuby behavior in line with CRuby. |
| 29 | +
|
| 30 | + Only the JRuby implementation is affected. CRuby is not affected, because |
| 31 | + libxml2's `xmlNoNetExternalEntityLoader` blocks all network schemes at the I/O |
| 32 | + layer regardless of scheme or case. |
| 33 | +
|
| 34 | + ### Severity |
| 35 | +
|
| 36 | + The Nokogiri maintainers have evaluated this as low severity (CVSS 2.6, |
| 37 | + `CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N`). It is a bypass of |
| 38 | + CVE-2020-26247, which was scored the same way. |
| 39 | +
|
| 40 | + ### Mitigation |
| 41 | +
|
| 42 | + Upgrade to Nokogiri 1.19.4 or later. |
| 43 | +
|
| 44 | + There are no known workarounds for affected versions. |
| 45 | +
|
| 46 | + This change properly enforces `NONET` on JRuby, which is a breaking change for |
| 47 | + any code that (perhaps unknowingly) relied on the previous behavior to load |
| 48 | + network resources with default parse options. If you trust your input and want |
| 49 | + to allow external resources to be accessed over the network, you can |
| 50 | + explicitly disable `NONET`, exactly as documented for CVE-2020-26247: |
| 51 | +
|
| 52 | + 1. Ensure the input is trusted. Do not enable this option for untrusted input. |
| 53 | + 2. Pass a `Nokogiri::XML::ParseOptions` with the `NONET` flag turned off: |
| 54 | +
|
| 55 | + ``` ruby |
| 56 | + # allows resources to be accessed over the network for trusted input |
| 57 | + schema = Nokogiri::XML::Schema.new(trusted_schema, Nokogiri::XML::ParseOptions.new.nononet) |
| 58 | + ``` |
| 59 | +
|
| 60 | + ### References |
| 61 | +
|
| 62 | + - Bypass of: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m |
| 63 | +
|
| 64 | + ### Credit |
| 65 | +
|
| 66 | + This issue was responsibly reported by @bilerden. |
| 67 | + cvss_v3: 2.6 |
| 68 | + patched_versions: |
| 69 | + - ">= 1.19.4" |
| 70 | + related: |
| 71 | + url: |
| 72 | + - https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-8678-w3jw-xfc2 |
| 73 | + - https://github.com/advisories/GHSA-8678-w3jw-xfc2 |
| 74 | +--- |
0 commit comments