js-yaml@5.2.0

YAML 1.2 parser and serializer

  • latest version

    5.5.0

  • latest non vulnerable version

  • first published

    15 years ago

  • latest version published

    1 months ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the js-yaml package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Inefficient Algorithmic Complexity

    js-yaml is a human-friendly data serialization language.

    Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the readFlowCollection function of parser.ts, which reaches exponential time when a flow sequence entry turns out to be a key: value pair and the parser rewinds to parse that entry a second time as the key. An attacker can exhaust CPU and block the Node event loop by supplying a small YAML document, under 200 bytes, with deeply nested flow sequences of key: value entries, since the re-parsing makes the work grow as O(2^n) in nesting depth. Exploitation occurs under the default configuration when the application parses untrusted YAML with load() or loadAll(), and needs no special schema, anchors, aliases, or merge keys.

    How to fix Inefficient Algorithmic Complexity?

    Upgrade js-yaml to version 5.2.2 or higher.

    >=5.0.0 <5.2.2
    • M
    Inefficient Algorithmic Complexity

    js-yaml is a human-friendly data serialization language.

    Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the omapTag.addItem() function of src/tag/sequence/omap.ts, which performs a linear scan for duplicate keys on every insertion into an ordered map. An attacker can block the Node.js event loop and cause denial of service by supplying an !!omap value with many entries, around 50,000 in a roughly 2 MB document, which forces O(n²) duplicate-key checks. Exploitation requires the application to parse untrusted YAML with the YAML 1.1 schema (yaml.load(input, { schema: yaml.YAML11_SCHEMA })), under which the !!omap tag is resolved.

    How to fix Inefficient Algorithmic Complexity?

    Upgrade js-yaml to version 5.2.1 or higher.

    >=5.0.0 <5.2.1