{"id":"CVE-2026-57235","aliases":["CVE-2026-57235","GHSA-5prr-v3j2-97mh"],"related":[],"kind":"vulnerability","state":"published","title":"Nokogiri: Possible Out-of-Bounds Read in `Nokogiri::XML::NodeSet#[]`","summary":"Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::NodeSet#[] (and its alias #slice) checked the requested index against the node set's bounds using a 32-bit-truncated copy of the index. A large negative index could pass the check and then be used at full width, reading outside the node set's storage. On CRuby this is an out-of-bounds read that typically crashes the process; on JRuby it is not memory-unsafe but returns an incorrect node. This vulnerability is fixed in 1.19.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::NodeSet#[] (and its alias #slice) checked the requested index against the node set's bounds using a 32-bit-truncated copy of the index. A large negative index could pass the check and then be used at full width, reading outside the node set's storage. On CRuby this is an out-of-bounds read that typically crashes the process; on JRuby it is not memory-unsafe but returns an incorrect node. This vulnerability is fixed in 1.19.4.","source":"cvelist"},{"lang":"en","text":"### Summary\n\n`Nokogiri::XML::NodeSet#[]` (and its alias `#slice`) checked the requested index against the node set's bounds using a 32-bit-truncated copy of the index. A large negative index could pass the check and then be used at full width, reading outside the node set's storage. On CRuby this is an out-of-bounds read that typically crashes the process; on JRuby it is not memory-unsafe but returns an incorrect node.\n\nNokogiri 1.19.4 performs the bounds check against the full-width index.\n\n### Severity\n\nThe Nokogiri maintainers have evaluated this as medium severity.\n\nExploitation requires an application to pass an attacker-controlled integer to `NodeSet#[]`. The primary impact is a controlled crash (denial of service), with potential for memory disclosure on CRuby.\n\nOn JRuby, Nokogiri is not affected by this vulnerability.\n\n### Mitigation\n\nUpgrade to Nokogiri 1.19.4 or later.\n\nAs a workaround, applications that index a `NodeSet` with externally-supplied integers can validate the index against `node_set.length` before use, or avoid passing untrusted values as an index.\n\n### Credit\n\nThis issue was responsibly reported by Zheng Yu from depthfirst.com.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Nokogiri es una biblioteca XML y HTML de código abierto para el lenguaje de programación Ruby. Anteriormente a la 1.19.4, Nokogiri::XML::NodeSet#[] (y su alias #slice) verificaba el índice solicitado contra los límites del conjunto de nodos utilizando una copia truncada a 32 bits del índice. Un índice negativo grande podía pasar la verificación y luego ser utilizado a ancho completo, leyendo fuera del almacenamiento del conjunto de nodos. En CRuby, esto es una lectura fuera de límites que típicamente bloquea el proceso; en JRuby, no es inseguro para la memoria, pero devuelve un nodo incorrecto. Esta vulnerabilidad se ha corregido en la versión 1.19.4.","source":"nvd"}],"published":"2026-06-19T16:36:42.000Z","modified":"2026-10-25T23:10:00.167Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H","score":8.2,"rating":"HIGH"}],"cwes":["CWE-125","CWE-190"],"affected":[{"ranges":[{"version":"< 1.19.4","status":"affected"}],"vendor":"sparklemotion","product":"nokogiri","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.19.4"}],"ecosystem":"RubyGems","package":"nokogiri","purl":"pkg:gem/nokogiri","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.19.4"}],"vendor":"nokogiri","product":"nokogiri","cpe":"cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*","source":"nvd"}],"references":[{"url":"https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-5prr-v3j2-97mh","tags":["mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sparklemotion/nokogiri","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-06-25T15:40:58.746Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-57235","url":"https://www.cve.org/CVERecord?id=CVE-2026-57235","licence":"CVE Terms of Use","modified":"2026-06-25T15:41:16.630Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5prr-v3j2-97mh","url":"https://github.com/advisories/GHSA-5prr-v3j2-97mh","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:07.875Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-57235","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-57235","licence":"Public domain","modified":"2026-10-25T23:10:00.167Z"}],"updatedAt":"2026-11-25T22:59:26.370Z","epss":{"score":0.00341,"percentile":0.29546,"date":"2026-12-01T12:00:22.000Z"}}