Next.js Vendored picomatch Vulnerable Dependency — CVE-2026-33671
by BeLazy167 · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-33671
- Category
- web
- Affected product
- Next.js 16.2.4 (bundles picomatch 4.0.3 at node_modules/next/dist/compiled/picomatch/)
- Affected versions
- Next.js versions bundling picomatch < 4.0.4
- Disclosed
- 2026-07-05
- Patch status
- patched
Tags
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-04 |
| Author / Researcher | BeLazy167 |
| CVE / Advisory | CVE-2026-33671 |
| Category | web |
| Severity | High |
| CVSS Score | Not specified in source (README labels underlying picomatch flaw “HIGH”) |
| Status | PoC |
| Tags | nextjs, picomatch, vendored-dependency, supply-chain, sca-bypass, trivy, nodejs, dependency-scanning |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Next.js 16.2.4 (bundles picomatch 4.0.3 at node_modules/next/dist/compiled/picomatch/) |
| Versions Affected | Next.js versions bundling picomatch < 4.0.4 |
| Language / Platform | Node.js / TypeScript, Next.js App Router |
| Authentication Required | No |
| Network Access Required | No (local build/dependency-scanning issue, not a remotely exploitable network vuln) |
Summary
Next.js 16.2.4 vendors a copy of the picomatch glob-matching library inside its own compiled output at node_modules/next/dist/compiled/picomatch/, pinned to version 4.0.3, which is affected by CVE-2026-33671. Because the vendored copy has its package.json version field stripped and lives inside Next’s own bundled code rather than as a normal top-level dependency, standard remediation via npm overrides cannot reach it — only the directly-installed picomatch gets bumped, while the vendored copy silently remains vulnerable. This repo is a minimal Next.js app used to demonstrate the problem: install, build, containerize, and scan with Trivy to show the CVE is still flagged in the image even after applying an overrides entry. It is a supply-chain/dependency-hygiene repro rather than a functional remote exploit — it proves detection tooling still surfaces the risk and that consumers cannot silence it themselves.
Vulnerability Details
Root Cause
Next.js bundles a stale, vulnerable version of picomatch inside its compiled distribution artifacts instead of resolving it through normal npm dependency resolution, so downstream overrides/resolutions fields in a consumer’s package.json cannot patch the vendored copy.
Attack Vector
- Install Next.js 16.2.4 as a project dependency (
npm install). - Attempt to remediate the underlying picomatch CVE by adding an
overridesentry pinningpicomatchto a patched version. - Run
npx next buildand containerize the app with the providedDockerfile. - Scan the resulting image with
trivy image— the scanner still reports CVE-2026-33671 becausenode_modules/next/dist/compiled/picomatch/was never updated by the override.
Impact
Whatever underlying issue picomatch 4.0.3 carries (denial-of-service / ReDoS-class glob-matching flaw) remains present and unpatchable by consumers until Next.js itself ships a release with the vendored copy rebuilt against a fixed picomatch version; it also causes persistent false “unresolved” findings in supply-chain security scanning.
Environment / Lab Setup
Target: Next.js 16.2.4 project (App Router), Node.js, Docker
Attacker: npm, npx, Docker, Trivy (aquasecurity/trivy) for image scanning
Proof of Concept
PoC Script
See
app/,package.json,next.config.mjs,tsconfig.json, andDockerfilein this folder.
| |
Building and scanning the container image shows Trivy flagging picomatch (package.json) | CVE-2026-33671 | HIGH | 4.0.3 | 4.0.4 even after adding a picomatch entry under overrides in package.json, proving the vendored copy under next/dist/compiled/picomatch/ is untouched by that mechanism.
Detection & Indicators of Compromise
picomatch (package.json) | CVE-2026-33671 | HIGH | fixed | 4.0.3 | 4.0.4
Signs of compromise:
- SCA/container scanners continuing to report CVE-2026-33671 against a Next.js image despite an
overrides/resolutionsfix being present inpackage.json. node_modules/next/dist/compiled/picomatch/package.jsonshowing a stripped/missing version field distinct from the top-level installedpicomatchversion.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to a Next.js release that re-bundles dist/compiled/picomatch/ from picomatch >= 4.0.4; no vendor patch version confirmed as of 2026-07-05 — monitor for a Next.js advisory/release note. |
| Interim mitigation | Do not rely on overrides/resolutions alone for this CVE; track the specific Next.js release notes for the picomatch re-bundle, or patch the vendored file directly in CI as a stopgap. |
References
Notes
Mirrored from https://github.com/BeLazy167/next-picomatch-cve-repro on 2026-07-05.
| |