Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-107387 Overview
CVE-2026-107387 is a memory exhaustion vulnerability in the music-metadata npm package, a widely used metadata parser for audio and video media files. Versions prior to 11.16.0 contain a flaw in the APEv2 tag parser that reads an attacker-controlled item size and allocates a Uint8Array before validating the declared size against the remaining tag or file data. A small crafted APE file can trigger a disproportionately large allocation, including through cover-art items. Repeated or concurrent parsing of malicious files can exhaust process memory and crash the host application.
Critical Impact
A single crafted APE file can force the parser to allocate memory far beyond the file's actual size, enabling local availability loss through process memory exhaustion.
Affected Products
- borewit/music-metadata versions prior to 11.16.0
- Node.js applications and services that parse untrusted APE files using this library
- Downstream packages and media pipelines that embed music-metadata as a dependency
Discovery Timeline
- 2026-10-08 - CVE-2026-107387 published to NVD
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2026-107387
Vulnerability Analysis
The flaw resides in lib/apev2/APEv2Parser.ts, which parses APEv2 tag item headers. For each tag item, the parser reads a tagItemHeader.size field controlled by the file and uses it to allocate a buffer for the item value, including binary cover-art payloads. The pre-patch code decrements bytesRemaining by the declared size without first verifying that the item fits within the remaining tag or file data. The classification aligns with CWE-789: Memory Allocation with Excessive Size Value.
Root Cause
The parser trusted an attacker-controlled length field before performing bounds checks against both the remaining tag bytes and the overall file size. Because Uint8Array allocations grow linearly with the declared size, a tiny APE file with an oversized item length drives the Node.js process toward its heap limit. Concurrent requests multiply the pressure and lead to termination of the host process.
Attack Vector
An attacker supplies a crafted APE file to any application or service that parses untrusted media with music-metadata. The vector is local in CVSS terms because parsing typically runs in the context of the invoking process, but the file itself can be delivered through uploads, media ingestion pipelines, or user-provided content. No authentication beyond the ability to submit a file is required.
// Patch excerpt from lib/apev2/APEv2Parser.ts
// Source: https://github.com/Borewit/music-metadata/commit/b3bf52cb6021b046f33ba47583e19ab8f10dd235
// Only APEv2 tag has tag item headers
const tagItemHeader = await this.tokenizer.readToken<ITagItemHeader>(TagItemHeader);
bytesRemaining -= TagItemHeader.len;
// Reserve the value bytes before looking for the key terminator.
if (tagItemHeader.size >= bytesRemaining) {
throw new ApeContentError(`Invalid tag item size: ${tagItemHeader.size}`);
}
const keyBytes = await this.tokenizer.peekBuffer(keyBuffer, {
length: Math.min(keyBuffer.length, bytesRemaining - tagItemHeader.size),
mayBeLess: true
});
let zero = keyBuffer.subarray(0, keyBytes).indexOf(0);
if (zero === -1) {
throw new ApeContentError('Unterminated tag item key');
}
const key = await this.tokenizer.readToken<string>(new StringType(zero, 'ascii'));
await this.tokenizer.ignore(1);
bytesRemaining -= key.length + 1;
if (this.tokenizer.fileInfo.size !== undefined &&
tagItemHeader.size > this.tokenizer.fileInfo.size - this.tokenizer.position) {
throw new ApeContentError(`Invalid tag item size: ${tagItemHeader.size}`);
}
bytesRemaining -= tagItemHeader.size;
The patch enforces two bounds: the item size must be smaller than bytesRemaining in the tag, and it must not exceed the remaining bytes in the file as reported by tokenizer.fileInfo.size.
Detection Methods for CVE-2026-107387
Indicators of Compromise
- Node.js processes terminating with JavaScript heap out of memory or FATAL ERROR: Reached heap limit messages shortly after media ingestion.
- APE files whose declared tag item or cover-art size is disproportionately large relative to the on-disk file size.
- Repeated spikes in resident memory in services that call music-metadata parsing functions.
Detection Strategies
- Inventory Node.js projects and container images for music-metadata versions below 11.16.0 using npm ls music-metadata or software composition analysis tooling.
- Instrument media parsing workers to log file size, declared APE tag size, and peak heap usage per request to flag outliers.
- Alert on repeated OOM-kills or container restarts correlated with upload or ingestion endpoints.
Monitoring Recommendations
- Track process heap and RSS metrics with per-request granularity on services that handle user-supplied audio.
- Correlate upload telemetry (file hash, size, MIME) with downstream parser crashes to identify malicious submissions.
- Monitor dependency manifests in CI for pinned vulnerable ranges of borewit/music-metadata.
How to Mitigate CVE-2026-107387
Immediate Actions Required
- Upgrade music-metadata to version 11.16.0 or later across all applications and container images.
- Audit transitive dependencies with npm ls music-metadata and rebuild lockfiles after the upgrade.
- Apply request size limits and per-process memory limits to any service that parses user-supplied media.
Patch Information
The fix is published in music-metadata v11.16.0 and implemented in commit b3bf52c via pull request #2744. Additional context is available in the GitHub Security Advisory GHSA-53v6-4h7p-p4gj.
Workarounds
- Reject or pre-filter APE files whose declared tag or item sizes exceed the physical file size before invoking the parser.
- Run parsing in an isolated worker process with a bounded --max-old-space-size so crashes do not take down the main service.
- Rate-limit concurrent parsing jobs per client to prevent memory amplification through repeated submissions.
# Upgrade music-metadata to the patched release
npm install music-metadata@^11.16.0
# Verify the installed version across the dependency tree
npm ls music-metadata
# Run parser workers with a bounded heap and restart policy
node --max-old-space-size=512 parser-worker.js
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

