Repository navigation
Conversation
IndexedSourceMapConsumer read a section's offset.line/offset.column without validating them beyond a relative ordering check. Downstream consumers of a parsed map (e.g. SourceNode.fromStringWithSourceMap and SourceMapGenerator's mappings serializer) walk generated line numbers one at a time via while loops keyed off these offsets, so an attacker-supplied offset that is extremely large (or Infinity/NaN) can force a synchronous, near-unbounded loop and block the Node.js event loop for extended periods (CWE-1284, CVSS 7.5/8.7). This adds validation when a section offset is read: it must be a finite, non-negative integer, and is capped at 2,000,000 (far beyond any realistic generated file's line/column count) so that even a maximal accepted value keeps the worst-case synchronous work bounded to roughly a hundred milliseconds instead of being unbounded. Adds regression tests covering non-finite, negative, non-integer, non-numeric, and over-the-cap offset values, plus a sanity check that normal, small offsets are still accepted.
zurcacielos
left a comment
There was a problem hiding this comment.
Action: Implements the missing validation for section offsets.
Result: Mitigates the vulnerability by preventing the arbitrary offset values that trigger the event loop blocking condition. It is the correct and necessary fix.
|
Tested this locally — the fix works, but the branch currently conflicts with VerificationRepro: a one-section indexed map with a large
Blocking time scales linearly (~19 ms per million lines) on both 1.2.1 and current Merge conflictThe PR is based on the 1.2.1 tag. Since then
Port onto current
|
|
closed in favour #79 |
Summary: Bumps [[https://github.com/7rulnik/source-map-js | source-map-js]] from 1.2.1 to 1.2.2. == Release notes == //Sourced from [[https://github.com/7rulnik/source-map-js/releases | source-map-js's releases]].// > **v1.2.2** > > - Fix crash when executing in browser with CSP script-src that don't permit unsafe-eval ([[7rulnik/source-map-js#29 | #29]]) [[https://github.com/xfournet | @xfournet]] > - Fix denial of service from malicious indexed source maps (CVE-2026-93749) ([[7rulnik/source-map-js#79 | #79]]) Reported by [[https://github.com/waydeshi | @waydeshi]] in [[7rulnik/source-map-js#76 | #76]]. A fix was also proposed by [[https://github.com/aniebiet | @aniebiet]] in [[7rulnik/source-map-js#78 | #78]]. == Changelog == //Sourced from [[https://github.com/7rulnik/source-map-js/blob/main/CHANGELOG.md | source-map-js's changelog]].// > **1.2.2** > > - Fix crash when executing in browser with CSP script-src that don't permit unsafe-eval ([[7rulnik/source-map-js#29 | #29]]) [[https://github.com/xfournet | @xfournet]] > - Fix denial of service from malicious indexed source maps (CVE-2026-93749) ([[7rulnik/source-map-js#79 | #79]]) Reported by [[https://github.com/waydeshi | @waydeshi]] in [[7rulnik/source-map-js#76 | #76]]. A fix was also proposed by [[https://github.com/aniebiet | @aniebiet]] in [[7rulnik/source-map-js#78 | #78]]. == Commits == - [[7rulnik/source-map-js@0a1d334 | 0a1d334]] 1.2.2 - [[7rulnik/source-map-js@4c6fa26 | 4c6fa26]] Update changelog - [[7rulnik/source-map-js@cf76580 | cf76580]] Fix denial of service from malicious indexed source maps (CVE-2026-93749) ([[7rulnik/source-map-js#79 | #79]]) - [[7rulnik/source-map-js@7899a86 | 7899a86]] Fix crash when executing browser with CSP script-src that don't permit unsafe... - See full diff in [[7rulnik/source-map-js@v1.2.1...v1.2.2 | compare view]] Pull Request resolved: #161 Reviewed By: boujeepossum Differential Revision: D124273775 Pulled By: JacksonGL fbshipit-source-id: db3ef2c2a265f6211e8bbcf6cda1ca4c3b890c6e
IndexedSourceMapConsumer read a section's offset.line/offset.column without validating them beyond a relative ordering check. Downstream consumers of a parsed map (e.g. SourceNode.fromStringWithSourceMap and SourceMapGenerator's mappings serializer) walk generated line numbers one at a time via while loops keyed off these offsets, so an attacker-supplied offset that is extremely large (or Infinity/NaN) can force a synchronous, near-unbounded loop and block the Node.js event loop for extended periods (CWE-1284, CVSS 7.5/8.7).
This adds validation when a section offset is read: it must be a finite, non-negative integer, and is capped at 2,000,000 (far beyond any realistic generated file's line/column count) so that even a maximal accepted value keeps the worst-case synchronous work bounded to roughly a hundred milliseconds instead of being unbounded.
Adds regression tests covering non-finite, negative, non-integer, non-numeric, and over-the-cap offset values, plus a sanity check that normal, small offsets are still accepted.