What’s Vulnerable › Vulnerabilities
GHSA-8j8c-7jfh-h6hx: Code Injection in js-yaml
- Severity: high (CVSS 7.5)
- Exploited in the wild: not listed in CISA KEV
- Public exploit or detection template: none known
- Published: 2019-06-04 · updated 2020-08-31
- Weakness: CWE-94
Description
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.
Affected products
- Npm Js-Yaml: before 3.13.1 — fixed in 3.13.1
How to fix
Upgrade to a fixed version: Npm Js-Yaml 3.13.1. Check the vendor advisory for mitigations.
References
- https://github.com/nodeca/js-yaml/pull/480
- https://github.com/nodeca/js-yaml/pull/480/commits/e18afbf1edcafb7add2c4c7b22abc8d6ebc2fa61
- https://www.npmjs.com/advisories/813
Get alerted when GHSA-8j8c-7jfh-h6hx or the next vulnerability affects your stack