CVE-2026-140012: Terser Remote Code Execution Vulnerability
MODERATECVE-2026-140012 is a MODERATE (CVSS 5.3) remote code execution vulnerability (CWE-540: Inclusion of Sensitive Information in Source Code) affecting Terser libraries in the npm ecosystem. The issue involves input sourcemap sourcescontent leaks, revealing input source code. Remediation is available by upgrading affected packages to version 4.8.2, 5.51.3.
CVE-2026-140012 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2026-140012
To remediate this vulnerability, upgrade all affected Terser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install terser@4.8.2
npm install terser@5.51.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls terser
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-140012, inspect your project dependencies using npm:
npm ls terser
Analyze the terminal output to locate any version of Terser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.8.2), your application is affected.
Note: The npm ls terser 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-540: Inclusion of Sensitive Information in Source Code, where source code on a web server or repository often contains sensitive information and should generally not be accessible to users. In Terser, 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
CVE-2026-140012 Affected Terser Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
terser
|
npm |
< 4.8.2
|
4.8.2
|
|
terser
|
npm |
≥ 5.0.0
< 5.51.3
|
5.51.3
|
References
Frequently Asked Questions
What is CVE-2026-140012?
Which Terser versions are affected?
What version fixes CVE-2026-140012?
Is terser affected?
What is the CVSS score of CVE-2026-140012?
What CWE is associated with CVE-2026-140012?
How can I check npm dependencies for CVE-2026-140012?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6jpm-p5cq-9q44",
"modified" : "2026-12-01T18:35:11Z",
"published" : "2026-12-01T18:35:11Z",
"aliases" : [ "CVE-2026-140012" ],
"summary" : "Terser: Input sourcemap sourcesContent leaks, revealing input source code",
"details" : "### Impact\n\nLeakage of user source code, which may include comments, constants with secret tokens, etc.\n\nWhen using Terser with an input sourcemap (sourceMap.content), and this input sourcemap has original source information (`sourcesContent`), Terser leaks this `sourcesContent` into the output, even when the user specified `includeSources: false` to opt-out.\n\n### Details\n\nTo help developers debug their JS applications, Terser's minify function reads and produces [source maps](https://developer.mozilla.org/en-US/docs/Glossary/Source_map).\n\nTo minify a JS file that has a corresponding source map, and generate a source map in turn, we call Terser's minify function like so:\n\n```js\nconst out = await minify(INPUTFILE, {\n sourceMap: {\n content: INPUTMAP,\n },\n});\nout.map // output source map\n```\n\nSource maps may contain the content of files, in their `sourcesContent` property. Files which may include secrets.\n \nTerser shouldn't include `sourcesContent` by default, unless we pass `includeSources: true` under `sourceMap` options.\n\nBut it does include the `sourcesContent` of the INPUTMAP even if `includeSources: false`, which is the leak we're discussing.\n\n### Patches\n\nThe problem will be patched in version `5.51.3`, and `4.8.2`.\n\n### Workarounds\n\nDo not use an input sourcemap (`sourceMap.content` option).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "terser"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.8.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "terser"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0"
}, {
"fixed" : "5.51.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/terser/terser/security/advisories/GHSA-6jpm-p5cq-9q44"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140012"
}, {
"type" : "WEB",
"url" : "https://github.com/terser/terser/commit/a63e814e816405e1d9cad106b1aeaa29c5c12bdc"
}, {
"type" : "WEB",
"url" : "https://github.com/terser/terser/commit/bab93bde6e2156cdd2fdd27eadc4dffd7362dee3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/terser/terser"
}, {
"type" : "WEB",
"url" : "https://github.com/terser/terser/releases/tag/v4.8.2"
}, {
"type" : "WEB",
"url" : "https://github.com/terser/terser/releases/tag/v5.51.3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-540" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-01T18:35:11Z",
"nvd_published_at" : "2026-11-30T22:17:31Z"
}
}