Skip to content

tag/Id3Load: cap ID3v2 tag-size allocation at 4 MB#2534

Closed
acts-1631 wants to merge 1 commit into
MusicPlayerDaemon:masterfrom
acts-1631:fix/id3-tag-size-cap
Closed

tag/Id3Load: cap ID3v2 tag-size allocation at 4 MB#2534
acts-1631 wants to merge 1 commit into
MusicPlayerDaemon:masterfrom
acts-1631:fix/id3-tag-size-cap

Conversation

@acts-1631

Copy link
Copy Markdown
Contributor

ReadId3Tag() allocates a buffer sized by the ID3v2 syncsafe size field
before validating that the file actually contains that many bytes. A
crafted 1 KB file with a header claiming ~256 MB forces a ~256 MB heap
allocation (256000x amplification). The sibling function
tag_id3_riff_aiff_load already caps at 4 MB for the same reason, but the
main ID3v2 path never got the same bound.

A remote MPD client with the default READ permission can trigger this
via the readcomments command pointing at an attacker-controlled HTTP
server that serves a crafted file, causing denial of service through
memory exhaustion (repeatable across connections, and the SEEK-frame
loop in the same function allows repeated spikes within a single
request).

This adds the same 4 MB cap already used by tag_id3_riff_aiff_load,
placed right after tag_size is computed and before the allocation.

ReadId3Tag() allocates a buffer sized by the ID3v2 syncsafe size field
before validating that the file actually contains that many bytes.  A
crafted 1 KB file with a header claiming ~256 MB forces a ~256 MB heap
allocation (256Kx amplification).  The sibling tag_id3_riff_aiff_load
already caps at 4 MB for the same reason; this applies the same bound
to the main ID3v2 path.

A remote MPD client with READ permission (the default) can trigger this
via the readcomments command pointing at an attacker-controlled HTTP
server, causing denial of service through memory exhaustion.
@MaxKellermann

Copy link
Copy Markdown
Member

Backported to v0.24.x: a9ac72b

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