Skip to content

fix(deps): patch image-size DoS CVE-2025-71329 / CVE-2025-71330 via vendored fork - #13

Closed
revopushbot wants to merge 1 commit into
mainfrom
fix/cve-2025-71329-71330-image-size
Closed

fix(deps): patch image-size DoS CVE-2025-71329 / CVE-2025-71330 via vendored fork#13
revopushbot wants to merge 1 commit into
mainfrom
fix/cve-2025-71329-71330-image-size

Conversation

@revopushbot

Copy link
Copy Markdown
Contributor

Summary

Resolves the four findings for image-size <= 2.0.2 (CVE-2025-71330 / GHSA-w3rx-r6r6-pgpr and CVE-2025-71329 / GHSA-5p2g-fcmc-qvqq) across both lockfiles.

Why not a version bump like previous fixes

With no fixable version anywhere, this PR vendors a patched fork instead.

What this does

  • vendor/image-size/ — a copy of image-size@1.2.1 (the exact version metro consumed, same 1.x API) versioned 2.0.3 (the next version above the top of the vulnerable range), with two patches applied (documented in vendor/image-size/PATCHES.md):
    • CVE-2025-71330 (ICNS): the parser advanced its offset by the entry length field with no validation; a zero-length entry looped forever, permanently blocking the event loop. It now throws TypeError for entry lengths smaller than the 8-byte entry header, which can never be valid.
    • CVE-2025-71329 (JXL/HEIF): extractPartialStreams set offset = box.offset + box.size; a zero-sized jxlp box never advanced the offset and findBox kept returning the same box. The offset now always advances by at least the 8-byte box header. (The HEIF path only iterates via findBox, which already carried the equivalent guard since 1.2.1.)
  • package.json — the fork is declared as a file: devDependency and forced onto metro through npm overrides ($image-size reference form, since relative file: overrides resolve against the dependent package) and yarn resolutions.
  • Lockfiles — registry image-size@1.2.1 is gone from both; package-lock.json links node_modules/image-size to vendor/image-size@2.0.3 and yarn.lock resolves image-size@file:./vendor/image-size at 2.0.3. yarn regeneration also picked up incidental brace-expansion patch bumps (1.1.17→1.1.18, 2.1.3→2.1.4), same as previous dependency PRs.
  • Testsvendor/image-size/test/security-patches.test.js feeds both advisories' crafted buffers to the parsers and asserts they terminate. Both buffers were verified to hang the unpatched 1.2.1 for 5+ s before being killed, and the suite runs as part of npm test.

Verification

  • Crafted ICNS / JXL buffers: infinite loop reproduced on unpatched 1.2.1, terminate immediately on the fork
  • npm ls image-sizeimage-size@2.0.3 overridden -> ./vendor/image-size (metro deduped to the same copy)
  • npm test ✅ (2 tests) · npm run build ✅ · npm run lint ✅ (0 errors; 192 pre-existing warnings in src/withRevopush.ts)

If upstream is ever revived (the maintainer mentioned continuing on Codeberg) or metro replaces the dependency, the vendor directory and override can simply be deleted.

🤖 Generated with Claude Code

…endored fork

Upstream image-size is archived with no patched release (every published
version <= 2.0.2 is in the vulnerable range) and metro, which requires
image-size@^1.0.2, declined to replace it. A version bump is therefore
impossible, so this vendors image-size 1.2.1 into vendor/image-size as
version 2.0.3 with the two infinite-loop fixes applied:

- CVE-2025-71330 (GHSA-w3rx-r6r6-pgpr): the ICNS parser now rejects
  entry lengths smaller than the 8-byte entry header instead of looping
  forever on a zero length field.
- CVE-2025-71329 (GHSA-5p2g-fcmc-qvqq): the JXL partial-stream extractor
  now always advances past the 8-byte box header when a jxlp box declares
  a zero size instead of re-reading the same box forever.

The fork is forced through npm overrides and yarn resolutions, so both
lockfiles now resolve image-size to the patched 2.0.3 copy. Jest
regression tests reproduce both advisories' crafted buffers (verified to
hang the unpatched 1.2.1) and assert the parsers terminate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ashirman ashirman closed this Aug 10, 2026
@ashirman
ashirman deleted the fix/cve-2025-71329-71330-image-size branch August 10, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants