CVE-2026-140012: Terser Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-6jpm-p5cq-9q44
CVSS 5.3
CWE-540
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2026-140012
GHSA Identifier GHSA-6jpm-p5cq-9q44
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-540: Inclusion of Sensitive Information in Source Code
Affected Product Terser
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (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.

terser fixed: 4.8.2
npm install terser@4.8.2
terser fixed: 5.51.3
npm install terser@5.51.3
Verify Direct and Transitive Dependencies

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

### Impact Leakage of user source code, which may include comments, constants with secret tokens, etc. When 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. ### Details To 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). To 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: ```js const out = await minify(INPUTFILE, { sourceMap: { content: INPUTMAP, }, }); out.map // output source map ``` Source maps may contain the content of files, in their `sourcesContent` property. Files which may include secrets. Terser shouldn't include `sourcesContent` by default, unless we pass `includeSources: true` under `sourceMap` options. But it does include the `sourcesContent` of the INPUTMAP even if `includeSources: false`, which is the leak we're discussing. ### Patches The problem will be patched in version `5.51.3`, and `4.8.2`. ### Workarounds Do not use an input sourcemap (`sourceMap.content` option).

CVE-2026-140012 Affected Terser Versions

2 component(s)
Fixed Versions:
4.8.25.51.3
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?
CVE-2026-140012 is a security vulnerability in Terser involving Input sourcemap sourcesContent leaks, revealing input source code under CWE-540: Inclusion of Sensitive Information in Source Code.
Which Terser versions are affected?
Affected versions include releases prior to 4.8.2, 5.51.3 across affected packages: terser.
What version fixes CVE-2026-140012?
Upgrading to 4.8.2, 5.51.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is terser affected?
Yes, terser is affected in releases prior to 4.8.2, 5.51.3. Upgrade your dependency to 4.8.2, 5.51.3 or later.
What is the CVSS score of CVE-2026-140012?
CVE-2026-140012 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2026-140012?
CVE-2026-140012 is classified under CWE-540: Inclusion of Sensitive Information in Source Code (Source code on a web server or repository often contains sensitive information and should generally not be accessible to users.).
How can I check npm dependencies for CVE-2026-140012?
Run the dependency tree command: 'npm ls terser'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}