CVE-2026-49356: Babel: Arbitrary File Read via sourceMappingURL Comment in @babel/core
Impact
Using @babel/core to compile maliciously crafted code can allow ab attacker to read any source map from the system that is running Babel, if these conditions are all true: - the attacker controls the input source code - the attacker can read the output source code - the attacker knows the path of the source map file that they want to read
Users that only compile trusted code are not impacted.
Patches
The vulnerability has been fixed in @babel/core@7.29.6 and @babel/core@8.0.0-rc.6.
Workarounds
Callers can mitigate the issue without upgrading by setting inputSourceMap: false in their Babel options.
Callers can also manually extract the #sourceMappingURL comment from the input source code, validate whether the source map that it links to is allowed to be read, and if it is pass an object to inputSourceMap (passing false when it's not).
Credits
Thanks Teodor-Cristian Radoi for reporting the vulnerability.
Other sources
Babel is a compiler for writing next generation JavaScript. Prior to 8.0.0-rc.6 and 7.29.6, @babel/core affected by an arbitrary file read via a sourceMappingURL comment. Using @babel/core to compile maliciously crafted code can allow an attacker to read any source map from the system that is running Babel, if the attacker controls the input source code, can read the output source code, and knows the path of the source map file that they want to read. This vulnerability is fixed in 8.0.0-rc.6 and 7.29.6.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/@babel/coreto a version that resolves this vulnerability.Fixed in 7.29.6 - Upgrade
Upgrade
npm/@babel/coreto a version that resolves this vulnerability.Fixed in 8.0.0-rc.6 - Upgrade
Upgrade
@babel/coreto a version that resolves this vulnerability.Fixed in 7.29.6 - Upgrade
Upgrade
@babel/coreto a version that resolves this vulnerability.Fixed in 8.0.0-rc.6 - Configuration
Set Babel option `inputSourceMap: false` to mitigate arbitrary file read via `sourceMappingURL` comment when not upgrading.
@babel/core inputSourceMap = false
Event History
Frequently Asked Questions
What is the severity of CVE-2026-49356?
The severity of CVE-2026-49356 is classified as low, with a score of 3.2.
What is the impact of CVE-2026-49356?
CVE-2026-49356 can allow an attacker to read source maps from the system running Babel if they control the input source code and can read the output.
How do I fix CVE-2026-49356?
To fix CVE-2026-49356, ensure that your version of @babel/core is updated to the latest patched version.
What is a possible attack vector for CVE-2026-49356?
The attack vector for CVE-2026-49356 involves an attacker supplying malicious input source code that can exploit path traversal to access sensitive data.
Which software is affected by CVE-2026-49356?
The affected software for CVE-2026-49356 is npm/@babel/core.