tag/Id3Load: cap ID3v2 tag-size allocation at 4 MB#2534
Closed
acts-1631 wants to merge 1 commit into
Closed
Conversation
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.
Member
|
Backported to v0.24.x: a9ac72b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.