l3montree-dev / l3montree-dev/devguard-documentation

GHSA-2883-xcg3-v3hh found in npm/js-yaml@3.15.1

Open Beginner friendly
#303 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cvss-severity:high devguard l3montree-cybersecurity/.../devguard-documentation pkg:devguard/l3montree-c.../devguard-documentation risk:low state:open
Dominant language
MDX
Stars
7
Forks
5
Avg merge
1d 21h
Merged PRs (30d)
13

Description

GHSA-2883-xcg3-v3hh found in npm/js-yaml@3.15.1

[!important]
Risk: 1.73 (Low)
CVSS: 7.5

Description

Summary

maxTotalMergeKeys does not count empty mappings. An attacker can repeatedly merge a large sequence of them and consume significant CPU without reaching the configured limit.

Example

arr: &arr [{}, {}, {}, ...] # N empty mappings
targets:
  - <<: *arr                # repeated K times

For every target, the loader iterates all N elements of arr. This results in O(N * K) work while totalMergeKeys remains unchanged.

PoC

import { performance } from 'node:perf_hooks'
import { load, YAML11_SCHEMA } from 'js-yaml'

const n = 20000

const src =
  'arr: &arr [' + '{},'.repeat(n).slice(0, -1) + ']\n' +
  'targets:\n' +
  '  - <<: *arr\n'.repeat(n)

const started = performance.now()

load(src, { schema: YAML11_SCHEMA })

console.log(`${(performance.now() - started).toFixed(1)} ms`)

Observed results:

N YAML size Time
800 ~13 KB ~20 ms
3200 ~50 KB ~180 ms
20000 ~500 KB ~13 s

Impact

An attacker can submit a relatively small YAML document that causes prolonged CPU consumption despite the default maxTotalMergeKeys limit.

Fix

Count each merge-source mapping as one budget unit, in addition to counting its keys.

Difference with v5

In v3 & v4, merge is enabled by default. So, the severity score is higher.

Affected component

The vulnerability is in pkg:npm/js-yaml@3.15.1, found in artifacts pkg:devguard/l3montree-cybersecurity/devguard/devguard-documentation.

Recommended fix

Upgrade to version 3.15.2 or later.

# Update all vulnerable npm packages
npm audit fix
# Update only this package
npm install js-yaml@3.15.2 
Additional guidance for mitigating vulnerabilities

Visit our guides on devguard.org

See more details...
Path to component
 %%{init: { 'theme':'base', 'themeVariables': {
'primaryColor': '#F3F3F3',
'primaryTextColor': '#0D1117',
'primaryBorderColor': '#999999',
'lineColor': '#999999',
'secondaryColor': '#ffffff',
'tertiaryColor': '#ffffff'
} }}%%
 flowchart TD
Your_application(["Your application"]) --- pkg_npm_gray_matter_4_0_3(["pkg:npm/gray-matter\@4.0.3"])
pkg_npm_gray_matter_4_0_3(["pkg:npm/gray-matter\@4.0.3"]) --- pkg_npm_js_yaml_3_15_1(["pkg:npm/js-yaml\@3.15.1"])

classDef default stroke-width:2px
Risk Factor Value Description
Vulnerability Depth 2 The vulnerability is in a dependency of a dependency in your project. It is 2 levels deep.
EPSS 0.39 % The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.
EXPLOIT Not available We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database. There are no script kiddies exploiting this vulnerability.
CVSS-BE 7.5 - Exploiting this vulnerability significantly impacts availability.
CVSS-B 7.5 - The vulnerability can be exploited over the network without needing physical access.
- It is easy for an attacker to exploit this vulnerability.
- An attacker does not need any special privileges or access rights.
- No user interaction is needed for the attacker to exploit this vulnerability.
- The impact is confined to the system where the vulnerability exists.
- There is a high impact on the availability of the system.

More details can be found in DevGuard


Interact with this vulnerability

You can use the following slash commands to interact with this vulnerability:

👍 Reply with this to acknowledge and accept the identified risk.
/accept I accept the risk of this vulnerability, because ...
⚠️ Mark the risk as false positive: Use one of these commands if you believe the reported vulnerability is not actually a valid issue.
/component-not-present The vulnerable component is not included in the artifact.
/vulnerable-code-not-present The component is present, but the vulnerable code is not included or compiled.
/vulnerable-code-not-in-execute-path The vulnerable code exists, but is never executed at runtime.
/vulnerable-code-cannot-be-controlled-by-adversary Built-in protections prevent exploitation of this vulnerability.
/inline-mitigations-already-exist The vulnerable code cannot be controlled or influenced by an attacker.
🔁 Reopen the risk: Use this command to reopen a previously closed or accepted vulnerability.
/reopen ... 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the dependency declaration or lockfile that brings in npm/js-yaml@3.15.1, then review the recommended npm update to js-yaml@3.15.2 or later. Done means the vulnerable version is no longer present in the project dependency tree; use npm audit fix or the package-specific install command described in the issue to verify the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.