
Cloud Vulnerability DB
A community-led vulnerabilities database
Affected versions: saxen 12.0.0 (run). Same code expected from 11.1.0 (not run).
Bug. The README says chunks may split anywhere, even inside a tag or attribute. In parse() (lib/parser.js, tag-end scan), a quoted value is skipped with:
if (v === 34) { q = xml.indexOf('"', x + 1); x = q !== -1 ? q : x; }(and the same for '). When the closing quote is not yet in the buffer (q === -1), x stays inside the value and the next > inside the value ends the tag. In streaming mode the scan should return the remainder xml.substring(i) and wait for the next chunk, as it already does when the buffer ends inside a tag.
Steps to reproduce (run on 12.0.0, Node.js v24.22.1, Windows 11):
import { Parser } from 'saxen'
function run(feed) {
const ev = []
const p = new Parser()
p.on('openTag', (n, g) => ev.push('open:' + n + JSON.stringify(g())))
p.on('closeTag', (n) => ev.push('close:' + n))
p.on('warn', (w) => ev.push('warn:' + w.message))
p.on('error', (e) => ev.push('error:' + e.message))
feed(p)
return ev.join(' ')
}
console.log(run((p) => p.parse('<a v="x><b/>y"/>')))
console.log(run((p) => { p.write('<a v="x>'); p.write('<b/>y"/>'); p.end() }))Observed:
open:a{"v":"x><b/>y"} close:a
warn:missing closing quotes open:a{} open:b{} close:b error:unexpected end of fileExpected: both runs emit open:a{"v":"x><b/>y"} close:a. (With <a v="x>y"><b/></a> the chunked run also differs: the v attribute is lost.) The single-quote form behaves the same.
Impact: the same bytes parse into different elements and attributes depending on where the chunks split. A document can hide or invent elements for a consumer that reads in chunks while a validator that reads the whole document sees something else. In a consumer that builds structures from tag attributes this can turn a small input into large allocations. I found no memory corruption or code execution.
Suggested fix: in the tag-end scan, when streaming is true and the quote has no match in the buffer, return xml.substring(i); keep the current behaviour when not streaming. A regression test could feed each test document whole and through every two-way split, and assert identical events.
(Reference: read-excel-file 9.3.20 vendors the same parser code in modules/saxen/parser.js; I am not reporting that anywhere before you reply.)
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."