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