CriticalGHSA-xxvw-45rp-3mj2CVE-2013-4660

Deserialization Code Execution in js-yaml

Published 24 Oct 2017 · Updated 8 Nov 2023

Affected package

Affected
<2.0.5
Fixed in
2.0.5
Update to the fixed version for your release line, for example:npm install js-yaml@2.0.5

Details

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.

Is GHSA-xxvw-45rp-3mj2 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected js-yaml, and gives you the command that fixes it.

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.