js-yaml@2.0.4 vulnerabilities
YAML 1.2 parser and serializer
-
latest version
4.1.0
-
latest non vulnerable version
-
first published
13 years ago
-
latest version published
4 years ago
-
licenses detected
- >=0
Direct Vulnerabilities
Known vulnerabilities in the js-yaml package. This does not include vulnerabilities belonging to this package’s dependencies.
Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.Vulnerability | Vulnerable Version |
---|---|
js-yaml is a human-friendly data serialization language. Affected versions of this package are vulnerable to Arbitrary Code Execution. When an object with an executable How to fix Arbitrary Code Execution? Upgrade |
<3.13.1
|
The JS-YAML module for Node.js contained a code execution vulnerability prior to version 2.0.5. The maintainers of JS-YAML have patched this vulnerability and, beginning in version 2.1.0, have provided a safeLoad method for parsing YAML. Developers that use this module should make sure they have upgraded and should strongly consider porting their code to use the new safeLoad method. Source: Node Security Project DetailsThe module allowed code execution due to a custom data-type that it defined and parsed called !!js/function. The way it would parse the data was to create a new Function object in JavaScript based on the input, which is equivalent to calling eval on the input:
That meant the code snippet below, when run, would execute code instead of simply defining a function:
How to fix Code Execution due to Deserialization? Developers using the JS-YAML module should make sure that they are working with an up-to-date version and should strongly consider porting their code to use safeLoad in place of load, especially when accepting YAML derived from user input. |
<2.0.5
|