CVE-2026-140012: Terser: Input sourcemap sourcesContent leaks, revealing input source code

Published Nov 30, 2026
·
Updated

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.

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

Other sources

Terser is a JavaScript parser, mangler, and compressor toolkit for ES6+. Prior to 4.8.2, and from 5.0.0 to before 5.51.3, when minify() is given an input source map through the sourceMap.content option, Terser copies that map's sourcesContent into the generated source map even when includeSources is false. Anyone who receives the generated source map can read the original source code, which may include comments, constants, or embedded secret tokens. This issue is fixed in versions 4.8.2 and 5.51.3.

— MITRE

Affected Software

3 affected componentsFixes available
npm/terser<4.8.2, >=5.0.0<5.51.3
npm/terser>=5.0.0<5.51.3
5.51.3
npm/terser<4.8.2
4.8.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/terser to a version that resolves this vulnerability.

    Fixed in 5.51.3
  2. Upgrade

    Upgrade npm/terser to a version that resolves this vulnerability.

    Fixed in 4.8.2
  3. Configuration

    Do not provide an input source map through the sourceMap.content option.

    Terser sourceMap.content = disabled

Event History

Nov 30, 2026
CVE Published
via MITRE·09:56 PM
Data Sourced
via MITRE·09:56 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:17 PM
DescriptionSeverityWeakness
Dec 1, 2026
Advisory Published
via GitHub·06:35 PM
Data Sourced
via GitHub·06:35 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·06:35 PM
Affected Software

Frequently Asked Questions

1

When is an application exposed to this issue?

Exposure requires a build process that passes an input source map to Terser through sourceMap.content and distributes the generated source map to someone who should not be able to view the original source. Builds that do not use sourceMap.content are not described as affected.

2

Does setting includeSources to false prevent the leak in affected versions?

No. In affected versions, Terser copies sourcesContent from the input source map into the generated source map even when includeSources is false.

3

What could be disclosed through an affected generated source map?

Anyone with access to the generated source map may be able to read the original input source code contained in sourcesContent. This can expose comments, constants, or embedded secret tokens.

4

Which Terser versions contain the fix?

The issue is fixed in Terser 4.8.2 and 5.51.3. Affected releases are versions before 4.8.2, plus versions from 5.0.0 up to but not including 5.51.3.

5

What can be done if upgrading is not immediately possible?

Avoid providing input source maps through sourceMap.content, or prevent generated source maps from being distributed to untrusted recipients. Review already published generated source maps for copied sourcesContent and remove or restrict access to maps containing sensitive source material.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203