llamaCVEVulnerability Intelligence
/
Advisory · GitHub · RubyGems · nokogiri

GHSA-5V8H-3H3Q-446P

Nokogiri: Possible Use-After-Free when `Nokogiri::XML::Document#encoding=` raises an exception

Parche disponible
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -1 d de la divulgación
Exposición153 dDesde la divulgación, 19 jun 2026, 11:35 a. m.
Detección150 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.19.4
Monitoreo
Detectada
18 jun 26
19 jun 26
10 sept 26
17 nov 26
20 nov 26
18 jun 26
27 jul 26
3 sept 26
12 oct 26
20 nov 26
FechaFaseEventoDetalle
Remediación Parche 1.19.4 nokogiri · -1 d desde divulgación
Divulgación Publicada GHSA-5V8H-3H3Q-446P divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Calling `Document#encoding=` with an invalid encoding (e.g., a non-string, or a string containing a null byte) raises an exception, but only after freeing the document's current encoding string without replacing it. The document is left referencing freed memory, so the next call to `Document#encoding` reads invalid memory, which can cause a segfault or leak freed bytes into a Ruby `String`.

Affects the CRuby (libxml2) implementation only; JRuby is not affected.

Severity

The Nokogiri maintainers have evaluated this as low severity. Reaching it requires an unusual API-usage pattern that does not arise during normal use. The application must pass an invalid encoding to `Document#encoding=`, rescue the resulting exception, and then continue using the same document. Nokogiri 1.19.4 makes this pattern safe with no change to the public API. The document no longer references freed memory after the exception is raised.

Mitigation

Upgrade to Nokogiri 1.19.4 or later.

If users are unable to upgrade, avoid passing attacker-controlled values to `Document#encoding=`. Applications that only assign developer-authored encodings are not directly exposed.

Credit

This issue was responsibly reported by Zheng Yu from depthfirst.com.

Versiones

Rangos afectados

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

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
rubygemsnokogiri
Corregida 1.19.4 -1 d 1.19.7 no afectada
Versiones corregidas1.19.4
Explotación

Arsenal público

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

Referencias
Otrahttps://github.com/sparklemotion/nokogiri/security/advisories/GHSA-5v8h-3h3q-446p
Otrahttps://github.com/sparklemotion/nokogiri

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