CVE-2013-4660: Js yaml Deserialization Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-xxvw-45rp-3mj2
CWE-20
Published
Advisory Summary

CVE-2013-4660 is a CRITICAL deserialization code execution vulnerability (CWE-20: Improper Input Validation) affecting Js yaml libraries in the npm ecosystem. The issue involves deserialization code execution in js-yaml. Remediation is available by upgrading affected packages to version 2.0.5.

CVE-2013-4660 at a Glance

CVE Identifier CVE-2013-4660
GHSA Identifier GHSA-xxvw-45rp-3mj2
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product Js yaml
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2013-4660

To remediate this vulnerability, upgrade all affected Js yaml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

js-yaml fixed: 2.0.5
npm install js-yaml@2.0.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls js-yaml

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2013-4660, inspect your project dependencies using npm:

npm ls js-yaml

Analyze the terminal output to locate any version of Js yaml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.5), your application is affected.

Note: The npm ls js-yaml command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Js yaml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2013-4660 Affected Js yaml Versions

1 component(s)
Fixed Versions:
2.0.5
Product / Package Ecosystem Affected Versions Fixed Version
js-yaml
npm
< 2.0.5
2.0.5

References

Frequently Asked Questions

What is CVE-2013-4660?
CVE-2013-4660 is a security vulnerability in Js yaml involving Deserialization Code Execution in js-yaml under CWE-20: Improper Input Validation.
Which Js yaml versions are affected?
Affected versions include releases prior to 2.0.5 across affected packages: js-yaml.
What version fixes CVE-2013-4660?
Upgrading to 2.0.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is js-yaml affected?
Yes, js-yaml is affected in releases prior to 2.0.5. Upgrade your dependency to 2.0.5 or later.
What CWE is associated with CVE-2013-4660?
CVE-2013-4660 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2013-4660?
Run the dependency tree command: 'npm ls js-yaml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xxvw-45rp-3mj2",
  "modified" : "2021-09-22T18:27:56Z",
  "published" : "2017-10-24T18:33:37Z",
  "aliases" : [ "CVE-2013-4660" ],
  "summary" : "Deserialization Code Execution in js-yaml",
  "details" : "Versions 2.0.4 and earlier of `js-yaml` are affected by a code execution vulnerability in the YAML deserializer.\n\n## Proof of Concept\n```\nconst yaml = require('js-yaml');\n\nconst x = `test: !!js/function >\nfunction f() { \nconsole.log(1); \n}();`\n\nyaml.load(x);\n```\n\n\n## Recommendation\n\nUpdate 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.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "js-yaml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2013-4660"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-xxvw-45rp-3mj2"
  }, {
    "type" : "WEB",
    "url" : "https://nealpoole.com/blog/2013/06/code-execution-via-yaml-in-js-yaml-nodejs-module"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/16"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T22:05:02Z",
    "nvd_published_at" : null
  }
}