CVE-2026-53496: Medium severity npm/exifreader vulnerability

Published Jul 17, 2026
·
Updated

Summary

ExifReader 4.40.0 can throw an uncaught RangeError: Offset is outside the bounds of the DataView while parsing crafted HEIC/AVIF files. The file only needs a valid leading ftyp box with a HEIC/AVIF major brand followed by a malformed ISO-BMFF box, such as an empty 8-byte free box or a truncated extended-size box.

This is reachable through the public ExifReader.load() API for in-memory buffers and through the async file/URL loaders when an application parses attacker-supplied images. In applications that do not wrap every parse in a defensive try/catch, a single uploaded or fetched image can abort the request/worker and cause a denial of service.

Credit requested: Yaohui Wang.

Affected version tested

- npm package: exifreader - Version: 4.40.0 - Repository commit tested: 8cb0261a26b7d986955fe0a6780f076dcb7902e7

Root cause

The ISO-BMFF parser assumes that every top-level box with at least an 8-byte header also has enough bytes for the fields required by its parsed form. In src/image-header-iso-bmff.js:

- findMetaBox() calls parseBox(dataView, offset) while only checking that offset + 8 <= dataView.byteLength. - parseBox() calls getBoxLength() and then unconditionally reads fields such as the full-box version byte for meta/iloc/iinf/idat boxes. - getBoxLength() handles boxLength === 1 by calling hasEmptyHighBits(dataView, offset), which reads dataView.getUint32(offset + 8) without first checking that the 64-bit extended size field is present.

As a result, syntactically small or truncated boxes after a valid HEIC/AVIF ftyp box escape the format-detection catch blocks and throw from the main parsing path.

Reproduction

Run this from the repository root against the committed dist/exif-reader.js bundle:

js const ExifReader = require('./dist/exif-reader.js');

function u32be(n) { return [(n >>> 24) & 255, (n >>> 16) & 255, (n >>> 8) & 255, n & 255]; } function ascii(s) { return Array.from(Buffer.from(s, 'ascii')); } function box(type, content = []) { return [...u32be(8 + content.length), ...ascii(type), ...content]; }

for (const brand of ['heic', 'avif']) { for (const badBox of ['free', 'abcd']) { const bytes = Uint8Array.from([ ...box('ftyp', ascii(brand)), ...box(badBox), // 8-byte box header with no content ]);

try { ExifReader.load(bytes.buffer); console.log(${brand}/${badBox}: no throw); } catch (e) { console.log(${brand}/${badBox}: ${e.name}: ${e.message}); console.log(String(e.stack).split('\n').slice(0, 6).join('\n')); } } }

Observed output on Node v23.11.0 with ExifReader 4.40.0:

text heic/free: RangeError: Offset is outside the bounds of the DataView RangeError: Offset is outside the bounds of the DataView at DataView.prototype.getUint8 (<anonymous>) at parseBox (.../dist/exif-reader.js:1:16513) at findMetaBox (.../dist/exif-reader.js:1:19032) at findOffsets (.../dist/exif-reader.js:1:19101)

heic/abcd: RangeError: Offset is outside the bounds of the DataView avif/free: RangeError: Offset is outside the bounds of the DataView avif/abcd: RangeError: Offset is outside the bounds of the DataView

A second variant triggers the extended-size path:

js const truncatedExtendedBox = [...u32be(1), ...ascii('free')]; const heic = Uint8Array.from([...box('ftyp', ascii('heic')), ...truncatedExtendedBox]); ExifReader.load(heic.buffer);

That throws from hasEmptyHighBits() / getBoxLength() because the extended-size high/low fields are not present.

Expected behavior

Malformed/truncated metadata boxes should be handled like other malformed metadata in the project: return only the successfully parsed file type/metadata, return no app markers, or throw a controlled project-specific error. A safe JavaScript bounds error should not escape from the parser for an attacker-controlled image container.

Security impact

This is a denial-of-service issue for services that parse user-provided HEIC/AVIF files with ExifReader. A minimal attacker-controlled image buffer can cause an unhandled exception in the parser and abort the surrounding request/worker if the embedding application does not catch every parse error.

Suggested severity: Medium. Suggested CVSS: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.

Suggested fix

Add explicit bounds checks before every DataView read in the ISO-BMFF box parser, especially:

- before reading the 64-bit extended size fields in getBoxLength(); - before reading the full-box version byte in parseBox(); - before descending into parseSubBoxes() when a declared box length exceeds available bytes; - ensure findMetaBox() breaks on boxes whose declared length is invalid or not fully present.

A regression test should cover ftyp/heic and ftyp/avif followed by an 8-byte empty free/unknown box and by a truncated extended-size box.

Affected Software

1 affected componentFixes available
npm/exifreader<=4.40.0
4.40.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

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

    Fixed in 4.40.1
  2. Upgrade

    Upgrade exifreader to a version that resolves this vulnerability.

    Fixed in 4.40.0
  3. Configuration

    In src/image-header-iso-bmff.js, ensure findMetaBox() breaks when a declared box length is invalid or not fully present, add bounds checks in getBoxLength() before reading the 64-bit extended-size high/low fields (boxLength === 1 path), add bounds checks in parseBox() before reading the full-box version byte, and add bounds checks before descending into parseSubBoxes when a declared box length exceeds available bytes so a RangeError cannot escape the parser for attacker-controlled buffers.

    ISO-BMFF box parser (src/image-header-iso-bmff.js) Bounds checks before DataView reads = Add explicit bounds checks before descending into parseSubBoxes and before every DataView read used by getBoxLength()/parseBox()/findMetaBox()
  4. Operational

    If your service uses ExifReader.load() on user-provided HEIC/AVIF and you observed unhandled RangeErrors (e.g., RangeError: Offset is outside the bounds of the DataView), ensure all parsing is handled so failures become a controlled project-specific error (e.g., return only successfully parsed file type/metadata, return no app markers, or throw a controlled project-specific error instead of aborting the request/worker).

Event History

Jul 17, 2026
Advisory Published
via GitHub·08:19 PM
Data Sourced
via GitHub·08:19 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-53496?

CVE-2026-53496 has a medium severity rating of 5.3.

2

How do I fix CVE-2026-53496?

Upgrading to ExifReader version 4.40.1 or later will fix CVE-2026-53496.

3

What type of attacks can exploit CVE-2026-53496?

CVE-2026-53496 can be exploited by providing crafted HEIC/AVIF files that trigger the uncaught RangeError.

4

What software does CVE-2026-53496 affect?

CVE-2026-53496 affects the ExifReader version 4.40.0.

5

What is the impact of CVE-2026-53496?

CVE-2026-53496 can lead to application crashes due to an uncaught RangeError while parsing certain files.

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