Vulnerabilities |
33 via 296 paths |
|---|---|
Dependencies |
484 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: form-data
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.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: adm-zip
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › adm-zip@0.5.18
Overview
adm-zip is a JavaScript implementation for zip data compression for NodeJS.
Affected versions of this package are vulnerable to Improper Handling of Highly Compressed Data (Data Amplification) via the inflater process. An attacker can exhaust system memory and disrupt service availability by submitting specially crafted ZIP archives with highly compressible entries that declare a zero uncompressed size.
Remediation
Upgrade adm-zip to version 0.6.1 or higher.
References
high severity
new
- Vulnerable module: adm-zip
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › adm-zip@0.5.18
Overview
adm-zip is a JavaScript implementation for zip data compression for NodeJS.
Affected versions of this package are vulnerable to Memory Allocation with Excessive Size Value via the async decompression path in methods/inflater.js, where the decompression size cap enforced by zlib's maxOutputLength option is not applied to the streaming API. An attacker can supply a zip archive whose entries declare a small or zero uncompressed size but contain a large compressed payload (a decompression bomb), causing unbounded memory growth and a crash of the host process. Additionally, a declared size of 0 previously disabled the cap entirely on the synchronous path, allowing the same class of attack through entries that lie about their size.
Remediation
Upgrade adm-zip to version 0.6.1 or higher.
References
high severity
new
- Vulnerable module: braces
- Introduced through: @salesforce/plugin-org@1.13.2, @salesforce/plugin-user@1.7.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › cli-ux@5.6.7 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/config@1.18.17 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › cli-ux@5.6.7 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › @oclif/command@1.8.36 › @oclif/help@1.0.15 › @oclif/config@1.18.16 › globby@11.1.0 › fast-glob@3.3.3 › micromatch@4.0.8 › braces@3.0.3
Overview
braces is a Bash-like brace expansion, implemented in JavaScript.
Affected versions of this package are vulnerable to Uncontrolled Recursion in the recursive AST walkers, which lack depth guards. An attacker can supply deeply nested brace patterns that stay within the character limit to exhaust the call stack and crash the Node.js process with an uncaught RangeError.
Remediation
There is no fixed version for braces.
References
high severity
new
- Vulnerable module: http-cache-semantics
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › heroku-cli-util@8.0.12 › got@8.3.2 › cacheable-request@2.1.4 › http-cache-semantics@3.8.1
Overview
Affected versions of this package are vulnerable to Improper Authorization via improper validation of security-zeroed cache entries when processing client max-stale directives. An unauthenticated attacker can request the same URL with a large max-stale value to retrieve cached responses belonging to other users, including Set-Cookie session credentials from shared-cache entries that were deliberately zeroed for security reasons.
Remediation
There is no fixed version for http-cache-semantics.
References
high severity
- Vulnerable module: minimatch
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › replace@1.2.2 › minimatch@3.0.5
Overview
minimatch is a minimal matching utility.
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the matchOne function. An attacker can cause significant delays in processing and stall the event loop by supplying specially crafted glob patterns containing multiple non-adjacent GLOBSTAR segments.
Remediation
Upgrade minimatch to version 3.1.3, 4.2.5, 5.1.8, 6.2.2, 7.4.8, 8.0.6, 9.0.7, 10.2.3 or higher.
References
high severity
- Vulnerable module: minimatch
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › replace@1.2.2 › minimatch@3.0.5
Overview
minimatch is a minimal matching utility.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the AST class, caused by catastrophic backtracking when an input string contains many * characters in a row, followed by an unmatched character.
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 minimatch to version 3.1.3, 4.2.4, 5.1.7, 6.2.1, 7.4.7, 8.0.5, 9.0.6, 10.2.1 or higher.
References
high severity
- Vulnerable module: qs
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.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
new
- Vulnerable module: uri-js
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
Overview
uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.
Affected versions of this package are vulnerable to Infinite loop via the removeDotSegments function, which loops infinitely when a path segment begins with Unicode line separators (U+2028) or paragraph separators (U+2029). An attacker can trigger this by passing such a path to removeDotSegments directly, or through the normalize or resolve functions with IRI handling enabled, blocking the Node.js event loop indefinitely until heap exhaustion.
Remediation
There is no fixed version for uri-js.
References
high severity
new
- Vulnerable module: adm-zip
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › adm-zip@0.5.18
Overview
adm-zip is a JavaScript implementation for zip data compression for NodeJS.
Affected versions of this package are vulnerable to Symlink Attack through the extractAllTo, extractAllToAsync, and extractEntryTo code paths in util/utils.js. An attacker can write attacker-controlled contents outside the extraction root by placing a symbolic link inside the destination directory and then supplying an archive entry that is extracted with overwrite enabled. This can replace any file the extracting process is allowed to write, breaking the integrity of files in shared, reused, or predictable extraction locations such as temporary directories or CI workspaces.
Remediation
Upgrade adm-zip to version 0.6.1 or higher.
References
high severity
new
- Vulnerable module: http-cache-semantics
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › heroku-cli-util@8.0.12 › got@8.3.2 › cacheable-request@2.1.4 › http-cache-semantics@3.8.1
Overview
Affected versions of this package are vulnerable to Origin Validation Error via the _varyMatches() function, which fails to properly handle Vary: * (wildcard) headers due to byte-for-byte string comparison. An attacker can request URLs previously fetched by other clients to receive cached responses intended for different users, disclosing sensitive information across clients. The Vary: * directive signals that a response is uncacheable for any other request, but the flawed comparison allows the wildcard to be bypassed, enabling cross-client cache disclosure.
Remediation
There is no fixed version for http-cache-semantics.
References
high severity
- Vulnerable module: fast-xml-parser
- Introduced through: @salesforce/source-deploy-retrieve@2.2.0 and salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › fast-xml-parser@3.21.1Remediation: Upgrade to @salesforce/source-deploy-retrieve@7.15.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › fast-xml-parser@3.21.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.8.3.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.5.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) due to allowing special characters in entity names, which are not escaped or sanitized. An attacker can inject an inefficient regex in the entity replacement step of the parser, this can cause the parser to stall for an indefinite amount of time.
Workaround
This vulnerability can be avoided by not parsing DOCTYPE data with the processEntities: false option.
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.2.4 or higher.
References
high severity
- Vulnerable module: jsen
- Introduced through: salesforce-alm@53.12.0 and @salesforce/source-deploy-retrieve@2.2.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsen@0.6.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsen@0.6.6
Overview
jsen is a JSON-Schema validator built for speed
Affected versions of this package are vulnerable to Arbitrary Code Execution. If an attacker can control the schema file, it could run arbitrary JavaScript code on the victim machine. In the module description and README file there is no mention about the risks of untrusted schema files, so I assume that this is applicable.
In particular the required field of the schema is not properly sanitized.
The resulting string that is build based on the schema definition is then passed to a Function.apply();, leading to an Arbitrary Code Execution.
PoC
const jsen = require('jsen');
let schema = JSON.parse(`
{
"type": "object",
"properties": {
"username": {
"type": "string"
}
},
"required": ["\\"+process.mainModule.require(\'child_process\').execSync(\'touch malicious\')+\\""]
}`);
const validate = jsen(schema);
validate({});
Remediation
There is no fixed version for jsen.
References
high severity
- Vulnerable module: lodash.template
- Introduced through: @salesforce/command@4.2.2, salesforce-alm@53.12.0 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › lodash.template@4.18.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @oclif/plugin-help@2.2.3 › lodash.template@4.18.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › lodash.template@4.18.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › lodash.template@4.18.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @oclif/plugin-help@2.2.3 › lodash.template@4.18.1
Overview
lodash.template is a The Lodash method _.template exported as a Node.js module.
Affected versions of this package are vulnerable to Code Injection due the improper validation of options.variable key names in _.template. An attacker can execute arbitrary code at template compilation time by injecting malicious expressions. If Object.prototype has been polluted, inherited properties may also be copied into the imports object and executed.
PoC
var _ = require('lodash');
_.template('', { variable: '){console.log(process.env)}; with(obj' })()
Remediation
There is no fixed version for lodash.template.
References
high severity
new
- Vulnerable module: isomorphic-git
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › isomorphic-git@1.17.0
Overview
isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read and write to git repositories, fetch from and push to git remotes (such as GitHub), all without any native C++ module dependencies.
Affected versions of this package are vulnerable to Prototype Pollution via the getRemoteInfo function. An attacker can manipulate the prototype of objects by advertising crafted ref names containing __proto__ path segments during ref negotiation, which can reroute network operations through an attacker-controlled proxy and result in the transmission of sensitive credentials by invoking the victim's authentication callback when connecting to a malicious server.
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 isomorphic-git to version 1.42.0 or higher.
References
high severity
- Module: smartwrap
- Introduced through: tty-table@2.8.13
Detailed paths
-
Introduced through: scdx@dsl12/scdx › tty-table@2.8.13 › smartwrap@1.2.5
GPL-2.0 license
medium severity
new
- Vulnerable module: csv-parse
- Introduced through: @salesforce/core@2.37.1, salesforce-alm@53.12.0 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › tty-table@2.8.13 › csv@5.5.3 › csv-parse@4.16.3Remediation: Upgrade to tty-table@6.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › csv-parse@4.16.3
Overview
csv-parse is a parser converting CSV text input into arrays or objects.
Affected versions of this package are vulnerable to Prototype Pollution in its duplicate-column handling, which assigns an array to obj['__proto__'] when a header contains duplicate __proto__ entries, triggering the __proto__ setter and replacing the parsed record object's prototype. An attacker can replace a record's prototype with attacker-controlled data, enabling object manipulation or code execution through the polluted prototype chain, by supplying CSV whose header carries duplicate __proto__ columns. This requires the application to parse untrusted CSV with both columns: true and group_columns_by_name: true enabled.
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 csv-parse to version 7.0.2 or higher.
References
medium severity
- Vulnerable module: fast-xml-parser
- Introduced through: @salesforce/source-deploy-retrieve@2.2.0 and salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › fast-xml-parser@3.21.1Remediation: Upgrade to @salesforce/source-deploy-retrieve@7.15.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › fast-xml-parser@3.21.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.8.3.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.5.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: @salesforce/source-deploy-retrieve@2.2.0 and salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › fast-xml-parser@3.21.1Remediation: Upgrade to @salesforce/source-deploy-retrieve@7.15.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › fast-xml-parser@3.21.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.8.3.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.5.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
- Vulnerable module: form-data
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.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
new
- Vulnerable module: qs
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.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 Uncaught Exception in the isBuffer() function in lib/utils.js, which calls obj.constructor.isBuffer(obj) without checking that it is callable, reached from stringify() at lib/stringify.js:127. An attacker can throw an uncaught TypeError that fails each request with HTTP 500, and terminates the worker process when stringify() runs in an unguarded async context, by supplying a query string such as x[constructor][isBuffer]=y that sets constructor.isBuffer to a non-function value. This requires the application to call qs.parse() with plainObjects: true or allowPrototypes: true, which preserves the constructor own property, and to then pass the parsed result to qs.stringify().
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 qs to version 6.16.0 or higher.
References
medium severity
new
- Vulnerable module: uri-js
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
Overview
uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.
Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via pctDecChars(), which decodes invalid and overlong percent-encoded sequences into ASCII metacharacters. An attacker can craft percent-encoded payloads to bypass platform decoder validation and inject path traversal or CRLF sequences that downstream consumers process without filtering.
Remediation
There is no fixed version for uri-js.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: @salesforce/core@2.37.1, @salesforce/command@4.2.2 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/core@3.32.12.
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/command@5.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-org@2.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-user@2.0.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/source-deploy-retrieve@6.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-org@2.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-user@2.0.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm such that the library can be misconfigured to use legacy, insecure key types for signature verification. For example, DSA keys could be used with the RS256 algorithm.
Exploitability
Users are affected when using an algorithm and a key type other than the combinations mentioned below:
EC: ES256, ES384, ES512
RSA: RS256, RS384, RS512, PS256, PS384, PS512
RSA-PSS: PS256, PS384, PS512
And for Elliptic Curve algorithms:
ES256: prime256v1
ES384: secp384r1
ES512: secp521r1
Workaround
Users who are unable to upgrade to the fixed version can use the allowInvalidAsymmetricKeyTypes option to true in the sign() and verify() functions to continue usage of invalid key type/algorithm combination in 9.0.0 for legacy compatibility.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: fast-xml-parser
- Introduced through: @salesforce/source-deploy-retrieve@2.2.0 and salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › fast-xml-parser@3.21.1Remediation: Upgrade to @salesforce/source-deploy-retrieve@7.15.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › fast-xml-parser@3.21.1
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.8.3.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › fast-xml-parser@3.21.1Remediation: Upgrade to salesforce-alm@54.5.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 Prototype Pollution due to improper argument validation, which is exploitable via the aName variable.
PoC
const { XMLParser, XMLBuilder, XMLValidator} = require("fast-xml-parser");
let XMLdata = "<__proto__><polluted>hacked</polluted></__proto__>"
const parser = new XMLParser();
let jObj = parser.parse(XMLdata);
console.log(jObj.polluted)
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 fast-xml-parser to version 4.1.2 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: @salesforce/core@2.37.1, @salesforce/command@4.2.2 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/core@3.32.12.
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/command@5.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-org@2.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-user@2.0.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/source-deploy-retrieve@6.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-org@2.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-user@2.0.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Improper Restriction of Security Token Assignment via the secretOrPublicKey argument due to misconfigurations of the key retrieval function jwt.verify(). Exploiting this vulnerability might result in incorrect verification of forged tokens when tokens signed with an asymmetric public key could be verified with a symmetric HS256 algorithm.
Note:
This vulnerability affects your application if it supports the usage of both symmetric and asymmetric keys in jwt.verify() implementation with the same key retrieval function.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: request
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.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: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › sfdx-faye@1.0.9 › tough-cookie@2.4.3
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
- Vulnerable module: jsonwebtoken
- Introduced through: @salesforce/core@2.37.1, @salesforce/command@4.2.2 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/core@3.32.12.
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/command@5.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-org@2.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-user@2.0.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/source-deploy-retrieve@6.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-org@2.0.0.
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to @salesforce/plugin-user@2.0.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsonwebtoken@8.5.0Remediation: Upgrade to salesforce-alm@54.5.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Improper Authentication such that the lack of algorithm definition in the jwt.verify() function can lead to signature validation bypass due to defaulting to the none algorithm for signature verification.
Exploitability
Users are affected only if all of the following conditions are true for the jwt.verify() function:
A token with no signature is received.
No algorithms are specified.
A falsy (e.g.,
null,false,undefined) secret or key is passed.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: uuid
- Introduced through: salesforce-alm@53.12.0, @salesforce/core@2.37.1 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › jsforce@1.11.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › jsforce@1.11.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
- Vulnerable module: inflight
- Introduced through: salesforce-alm@53.12.0, @salesforce/source-deploy-retrieve@2.2.0 and others
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › archiver@4.0.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › archiver@4.0.1 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › archiver@4.0.1 › zip-stream@3.0.1 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › unzipper@0.10.11 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › bunyan-sfdx-no-dtrace@1.8.2 › mv@2.1.1 › rimraf@2.4.5 › glob@6.0.4 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › @salesforce/core@2.24.2 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › unzipper@0.10.11 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › archiver-utils@2.1.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-org@1.13.2 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › @salesforce/plugin-user@1.7.1 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/command@4.2.2 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › unzipper@0.10.11 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › @salesforce/kit@1.9.2 › shx@0.3.4 › shelljs@0.8.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › @salesforce/core@2.37.1 › archiver@5.3.2 › zip-stream@4.1.1 › archiver-utils@3.0.4 › glob@7.2.3 › inflight@1.0.6
Overview
Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres function due to improperly deleting keys from the reqs object after execution of callbacks. This behavior causes the keys to remain in the reqs object, which leads to resource exhaustion.
Exploiting this vulnerability results in crashing the node process or in the application crash.
Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.
To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.
PoC
const inflight = require('inflight');
function testInflight() {
let i = 0;
function scheduleNext() {
let key = `key-${i++}`;
const callback = () => {
};
for (let j = 0; j < 1000000; j++) {
inflight(key, callback);
}
setImmediate(scheduleNext);
}
if (i % 100 === 0) {
console.log(process.memoryUsage());
}
scheduleNext();
}
testInflight();
Remediation
There is no fixed version for inflight.
References
medium severity
- Vulnerable module: got
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › heroku-cli-util@8.0.12 › got@8.3.2
Overview
Affected versions of this package are vulnerable to Open Redirect due to missing verification of requested URLs. It allowed a victim to be redirected to a UNIX socket.
Remediation
Upgrade got to version 11.8.5, 12.1.0 or higher.
References
medium severity
- Vulnerable module: http-cache-semantics
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › heroku-cli-util@8.0.12 › got@8.3.2 › cacheable-request@2.1.4 › http-cache-semantics@3.8.1
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The issue can be exploited via malicious request header values sent to a server, when that server reads the cache policy from the request using this library.
PoC
Run the following script in Node.js after installing the http-cache-semantics NPM package:
const CachePolicy = require("http-cache-semantics");
for (let i = 0; i <= 5; i++) {
const attack = "a" + " ".repeat(i * 7000) +
"z";
const start = performance.now();
new CachePolicy({
headers: {},
}, {
headers: {
"cache-control": attack,
},
});
console.log(`${attack.length}: ${performance.now() - start}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 http-cache-semantics to version 4.1.1 or higher.
References
medium severity
- Vulnerable module: unzipper
- Introduced through: @salesforce/source-deploy-retrieve@2.2.0 and salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › @salesforce/source-deploy-retrieve@2.2.0 › unzipper@0.10.11
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-deploy-retrieve@5.15.0 › unzipper@0.10.11
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › @salesforce/source-tracking@1.5.0 › @salesforce/source-deploy-retrieve@5.15.0 › unzipper@0.10.11
Overview
unzipper is a library for the Uzip cross-platform streaming AP.I
Affected versions of this package are vulnerable to Arbitrary File Write via Archive Extraction (Zip Slip) in the extraction path validation in lib/extract.js and lib/Open/directory.js, which check only that the resolved path begins with the destination string (extractPath.indexOf(opts.path) != 0) without enforcing a directory-separator boundary. An attacker can write files outside the intended extraction directory, enabling file overwrite or code execution, by supplying a ZIP archive whose entry resolves to a sibling path such as /tmp/dest-evil/escaped.txt that shares the destination's string prefix, which a victim then extracts. Exploitation requires the victim to extract an untrusted archive with unzipper, and it works through sibling-prefix paths since standard ../../ traversal remains blocked.
Note: This is a bypass of the fix for the vulnerability described in CVE-2018-1002203.
Details
It is exploited using a specially crafted zip archive, that holds path traversal filenames. When exploited, a filename in a malicious archive is concatenated to the target extraction directory, which results in the final path ending up outside of the target folder. For instance, a zip may hold a file with a "../../file.exe" location and thus break out of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicous file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
+2018-04-15 22:04:29 ..... 19 19 good.txt
+2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
There is no fixed version for unzipper.
References
medium severity
- Vulnerable module: xml2js
- Introduced through: salesforce-alm@53.12.0
Detailed paths
-
Introduced through: scdx@dsl12/scdx › salesforce-alm@53.12.0 › xml2js@0.4.19
Overview
Affected versions of this package are vulnerable to Prototype Pollution due to allowing an external attacker to edit or add new properties to an object. This is possible because the application does not properly validate incoming JSON keys, thus allowing the __proto__ property to be edited.
PoC
var parseString = require('xml2js').parseString;
let normal_user_request = "<role>admin</role>";
let malicious_user_request = "<__proto__><role>admin</role></__proto__>";
const update_user = (userProp) => {
// A user cannot alter his role. This way we prevent privilege escalations.
parseString(userProp, function (err, user) {
if(user.hasOwnProperty("role") && user?.role.toLowerCase() === "admin") {
console.log("Unauthorized Action");
} else {
console.log(user?.role[0]);
}
});
}
update_user(normal_user_request);
update_user(malicious_user_request);
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 xml2js to version 0.5.0 or higher.