Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
NoPP (No Prototype Pollution) – tiny helper to protect against Prototype Pollution vulnerabilities in your application
NoPP
(No Prototype Pollution) – tiny helper to protect against Prototype
Pollution vulnerabilities in your application, regardless if they introduced in
your own code or by 3rd-party code.
By calling Object.freeze for some built-in JavaScript objects.
The
Object.freeze()
method freezes an object. A frozen object can no longer be changed; freezing an object prevents new properties from being added to it, existing properties from being removed, prevents changing the enumerability, configurability, or writability of existing properties, and prevents the values of existing properties from being changed.
We believe that there are legitimate cases of prototype changes, but they should happen only during the initialization step. Hence, we recommend including this package as the last one in your application code.
Prototype Pollution vulnerabilities are about 25% of all discovered vulnerabilities in the JS ecosystem and probably the most popular ones.
While ~25% of them are not fixable by upgrading to a newer version, this package will protect you even in case you're using a package that contains a Prototype Pollution vulnerability.
npm install nopp
// ... all your require calls ...
require('nopp');
or if you use mjs syntax
// ... all your import calls ...
import 'nopp';
const _ = require('lodash'); // Version 4.17.4 is vulnerable: https://security.snyk.io/vuln/npm:lodash:20180130
_.merge({}, JSON.parse('{"__proto__":{"foo":"polluted"}}'));
console.log(({}).foo); // polluted
require('nopp');
_.merge({}, JSON.parse('{"__proto__":{"bar":"polluted"}}'));
console.log(({}).bar); // undefined
In some rare cases, attempts to exploit the Prototype Pollution vulnerability
can cause TypeError: Cannot redefine property
or
TypeError: Cannot assign to read only property
exception and cause DoS
vulnerability. Please make sure you have uncaughtException
handler
implemented.
nopp
instead of the --frozen-intrinsics
Node.js flag?--frozen-intrinsics
added in Node.js v11.12.0 and currently has experimental stability level.
The main purpose of the flag is exactly the same as of this package – to protect runtime from unintended modifications of prototypes.
We believe there are numerous reasons why you may prefer using nopp
:
--frozen-intrinsics
will be not possible without significant application code refactoring. Unlike nopp
which should be imported after all other packages and in most of the cases cause no backward compatibility issues.nopp
is also applicable for client-side applications. You may prefer to use it for consistency between backend Node.js code and client-side application code.nopp
package as part of your application and ignore prototype pollution vulnerabilities in your application code automatically, and help reduce the noise level of your overall security alerts.--disable-proto
Node.js flag enough to be protected?No.
--disable-proto
added in Node.js v12.17.0. It is able to delete __proto__
property from the runtime completely and prevent some prototype pollution attack payloads.
Unfortunately, unlike nopp
, it doesn't protect your application against constructor.prototype
type of payloads.
FAQs
NoPP (No Prototype Pollution) – tiny helper to protect against Prototype Pollution vulnerabilities in your application
The npm package nopp receives a total of 218 weekly downloads. As such, nopp popularity was classified as not popular.
We found that nopp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.