js-yaml known bugs
npm4 known bugs in js-yaml, with affected versions, fixes and workarounds. Sourced from upstream issue trackers.
4
bugs
Known bugs
| Severity | Affected | Fixed in | Title | Status | Source |
|---|---|---|---|---|---|
| high | any | 3.13.1 | Code Injection in js-yaml Versions of `js-yaml` prior to 3.13.1 are vulnerable to Code Injection. The `load()` function may execute arbitrary code injected through a malicious YAML file. Objects that have `toString` as key, JavaScript code as value and are used as explicit mapping keys allow attackers to execute the supplied code through the `load()` function. The `safeLoad()` function is unaffected.
An example payload is
`{ toString: !<tag:yaml.org,2002:js/function> 'function (){return Date.now()}' } : 1`
which returns the object
{
"1553107949161": 1
}
## Recommendation
Upgrade to version 3.13.1. | fixed | osv:GHSA-8j8c-7jfh-h6hx |
| medium | 4.0.0 | 4.1.1 | js-yaml has prototype pollution in merge (<<) ### Impact
In js-yaml 4.1.0, 4.0.0, and 3.14.1 and below, it's possible for an attacker to modify the prototype of the result of a parsed yaml document via prototype pollution (`__proto__`). All users who parse untrusted yaml documents may be impacted.
### Patches
Problem is patched in js-yaml 4.1.1 and 3.14.2.
### Workarounds
You can protect against this kind of attack on the server by using `node --disable-proto=delete` or `deno` (in Deno, pollution protection is on by default).
### References
https://cheatsheetseries.owasp.org/cheatsheets/Prototype_Pollution_Prevention_Cheat_Sheet.html | fixed | osv:GHSA-mh29-5h37-fv8m |
| medium | any | 3.13.0 | Denial of Service in js-yaml Versions of `js-yaml` prior to 3.13.0 are vulnerable to Denial of Service. By parsing a carefully-crafted YAML file, the node process stalls and may exhaust system resources leading to a Denial of Service.
## Recommendation
Upgrade to version 3.13.0. | fixed | osv:GHSA-2pr6-76vf-7546 |
| critical | any | 2.0.5 | Deserialization Code Execution in js-yaml Versions 2.0.4 and earlier of `js-yaml` are affected by a code execution vulnerability in the YAML deserializer.
## Proof of Concept
```
const yaml = require('js-yaml');
const x = `test: !!js/function >
function f() {
console.log(1);
}();`
yaml.load(x);
```
## Recommendation
Update js-yaml to version 2.0.5 or later, and ensure that all instances where the `.load()` method is called are updated to use `.safeLoad()` instead. | fixed | osv:GHSA-xxvw-45rp-3mj2 |
API access
Get this data programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/bugs/npm/js-yaml