All vulnerabilities

npm

CVE-2026-140012

Terser: Input sourcemap sourcesContent leaks, revealing input source code

Severity
Medium 5.3
Published
1 Dec 2026
Last changed
1 Dec 2026
Added to UpHeron
1 Dec 2026
Fixed in
4.8.2, 5.51.3
Exploit chance
0.4% in the next 30 daysHigher than 40% of CVEs. EPSS by FIRST, 1 Dec 2026
Weakness
CWE-540
Attack
Over the network · No login needed · No user action needed
Attacker can
Read some data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Also known as
GHSA-6jpm-p5cq-9q44
Sources
OSV.dev and GitHub

Description

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.

To help developers debug their JS applications, Terser's minify function reads and produces source maps.

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:

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.

From the GitHub Advisory Database, CC BY 4.0.

Workarounds

Do not use an input sourcemap (sourceMap.content option).

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
tersernpm · osv:npm:terser
  • Every version before 4.8.2
  • From 5.0.0 before 5.51.3

About terser

Weekly downloads (npm)
111,376,752npm, 1 Dec 2026

This is the only vulnerability in terser in our list.

References