{"id":"GHSA-8j8c-7jfh-h6hx","aliases":["GHSA-8j8c-7jfh-h6hx"],"related":[],"kind":"vulnerability","state":"published","title":"Code Injection in js-yaml","summary":"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.\n\nAn example payload is \n`{ toString: !<tag:yaml.org,2002:js/function> 'function (){return Date.now()}' } : 1` \nwhich returns the object \n{\n  \"1553107949161\": 1\n}\n\n\n## Recommendation\n\nUpgrade to version 3.13.1.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"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.\n\nAn example payload is \n`{ toString: !<tag:yaml.org,2002:js/function> 'function (){return Date.now()}' } : 1` \nwhich returns the object \n{\n  \"1553107949161\": 1\n}\n\n\n## Recommendation\n\nUpgrade to version 3.13.1.","format":"markdown","source":"ghsa"}],"published":"2019-06-04T20:14:07.000Z","modified":"2020-08-31T18:36:43.000Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"HIGH"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"HIGH"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.13.1"}],"ecosystem":"npm","package":"js-yaml","purl":"pkg:npm/js-yaml","source":"ghsa"}],"references":[{"url":"https://github.com/nodeca/js-yaml/pull/480","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/nodeca/js-yaml/pull/480/commits/e18afbf1edcafb7add2c4c7b22abc8d6ebc2fa61","tags":["web"],"sources":["ghsa"]},{"url":"https://www.npmjs.com/advisories/813","tags":["web"],"sources":["ghsa"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8j8c-7jfh-h6hx","url":"https://github.com/advisories/GHSA-8j8c-7jfh-h6hx","licence":"CC-BY-4.0","modified":"2020-08-31T18:36:43.000Z"}],"updatedAt":"2026-11-25T22:56:44.750Z"}