llamaCVEVulnerability Intelligence
/
Advisory · GitHub · RubyGems · nokogiri

GHSA-VR8Q-G5C7-M54M

Nokogiri::XML::Schema trusts input by default, exposing risk of XXE vulnerability

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a 5 d de la divulgación
Exposición2.150 dDesde la divulgación, 30 dic 2020, 1:35 p. m.
Detección2.147 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 1.11.0
Monitoreo
Detectada
30 dic 20
4 ene 21
8 jul 26
17 nov 26
19 nov 26
30 dic 20
21 jun 22
10 dic 23
31 may 25
19 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-VR8Q-G5C7-M54M divulgada
Remediación Parche 1.11.0 nokogiri · 5 d desde divulgación
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Severity

Nokogiri maintainers have evaluated this as __Low Severity__ (CVSS3 2.6) https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N.

Description

In Nokogiri versions <= 1.11.0.rc3, XML Schemas parsed by `Nokogiri::XML::Schema` are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks.

This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible.

Please note that this security fix was pushed into a new minor version, 1.11.x, rather than a patch release to the 1.10.x branch, because it is a breaking change for some schemas and the risk was assessed to be "Low Severity".

Affected Versions

Nokogiri `<= 1.10.10` as well as prereleases `1.11.0.rc1`, `1.11.0.rc2`, and `1.11.0.rc3`

Mitigation

There are no known workarounds for affected versions. Upgrade to Nokogiri `1.11.0.rc4` or later.

If, after upgrading to `1.11.0.rc4` or later, you wish to re-enable network access for resolution of external resources (i.e., return to the previous behavior):

  1. Ensure the input is trusted. Do not enable this option for untrusted input.
  2. When invoking the `Nokogiri::XML::Schema` constructor, pass as the second parameter an instance of `Nokogiri::XML::ParseOptions` with the `NONET` flag turned off.

So if your previous code was:

# in v1.11.0.rc3 and earlier, this call allows resources to be accessed over the network
# but in v1.11.0.rc4 and later, this call will disallow network access for external resources
schema = Nokogiri::XML::Schema.new(schema)

# in v1.11.0.rc4 and later, the following is equivalent to the code above
# (the second parameter is optional, and this demonstrates its default value)
schema = Nokogiri::XML::Schema.new(schema, Nokogiri::XML::ParseOptions::DEFAULT_SCHEMA)

Then you can add the second parameter to indicate that the input is trusted by changing it to:

# in v1.11.0.rc3 and earlier, this would raise an ArgumentError 
# but in v1.11.0.rc4 and later, this allows resources to be accessed over the network
schema = Nokogiri::XML::Schema.new(trusted_schema, Nokogiri::XML::ParseOptions.new.nononet)
References
  • This issue's public advisory https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m
  • Original Hackerone report (private) https://hackerone.com/reports/747489
  • OWASP description of XXE attack https://www.owasp.org/index.php/XML_External_Entity_(XXE_Processing)
  • OWASP description of SSRF attack https://www.owasp.org/index.php/Server_Side_Request_Forgery
Credit

This vulnerability was independently reported by @eric-therond and @gucki.

The Nokogiri maintainers would like to thank HackerOne https://hackerone.com/nokogiri for providing a secure, responsible mechanism for reporting, and for providing their fantastic service to us.

Versiones

Rangos afectados

Afectada Corregida Última
nokogiri< 1.11.0
1.11.0
1.19.7
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
rubygemsnokogiri
Corregida 1.11.0 5 d 1.19.7 no afectada
Versiones corregidas1.11.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2020-26247
Otrahttps://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m
Otrahttps://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b
Otrahttps://hackerone.com/reports/747489
Otrahttps://github.com/rubysec/ruby-advisory-db/blob/master/gems/nokogiri/CVE-2020-26247.yml
Otrahttps://github.com/sparklemotion/nokogiri
Otrahttps://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md#v1110--2021-01-03
Otrahttps://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4
Otrahttps://lists.debian.org/debian-lts-announce/2021/06/msg00007.html
Otrahttps://lists.debian.org/debian-lts-announce/2022/10/msg00018.html
Otrahttps://rubygems.org/gems/nokogiri
Otrahttps://security.gentoo.org/glsa/202208-29

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.