CVE-2013-4660: Deserialization Code Execution in js-yaml

js-yaml Updated 02 Oct 2025

Summary

24/10/2017
Yes i
Critical
Not published

CVE-2013-4660: Deserialization Code Execution in js-yaml. Affects js-yaml versions < 2.0.5. Fixed in 2.0.5. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The js-yaml package is an open-source JavaScript library that provides a YAML parser and serializer. It allows developers to parse YAML data into JavaScript objects and serialize JavaScript objects into YAML format. The package is widely used in various applications and frameworks for handling YAML data. However, versions 2.0.4 and earlier of js-yaml are vulnerable to a code execution vulnerability in the YAML deserializer.

Vulnerability Detail

The vulnerability in js-yaml arises from a code execution flaw in the YAML deserializer. An attacker can exploit this vulnerability by crafting a malicious YAML payload that includes a specially crafted JavaScript function. When the payload is deserialized using the affected versions of js-yaml, the JavaScript function is executed, leading to arbitrary code execution. This can result in various security risks, including remote code execution, data leakage, and unauthorized access to sensitive information.

How To Fix

Latest published version: 5.5.0 as of 23 Oct 2026

npm install js-yaml@5.5.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.0.5

This is the first release that contains the fix.

npm install js-yaml@2.0.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

A workaround for this vulnerability is to sanitize and validate the YAML data before deserialization. This can be done by implementing a custom validation mechanism that checks the structure and content of the YAML data before passing it to the js-yaml library for deserialization. By carefully validating the input, developers can mitigate the risk of executing malicious code embedded in the YAML payload.

Conclusion

The js-yaml package versions 2.0.4 and earlier are vulnerable to a code execution vulnerability in the YAML deserializer. To mitigate this risk, it is crucial to update to version 2.0.5 or later and replace all instances of the .load() method with .safeLoad(). Additionally, implementing custom validation and sanitization of YAML data can provide an extra layer of protection. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for js-yaml →

Share this vulnerability

FAQ

js-yaml is a JavaScript library that provides a YAML parser and serializer. It allows developers to work with YAML data in JavaScript applications.

Versions 2.0.4 and earlier of js-yaml are affected by this vulnerability.

This vulnerability can lead to arbitrary code execution, enabling attackers to execute malicious code on the affected system, potentially resulting in remote code execution, data leakage, and unauthorized access to sensitive information.

To fix this vulnerability, update the js-yaml package to version 2.0.5 or later and ensure that all instances of the .load() method are replaced with .safeLoad() method.

Yes, a workaround is to implement custom validation and sanitization of the YAML data before deserialization to mitigate the risk of executing malicious code.

Related vulnerabilities

Recent vulnerabilities recorded for js-yaml.

How To Fix

Latest published version: 5.5.0 as of 23 Oct 2026

npm install js-yaml@5.5.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

2.0.5

This is the first release that contains the fix.

npm install js-yaml@2.0.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback