fix(remote): reject snappy bombs in /api/v1/read (CVE-2026-42154)#335
Merged
Conversation
Backport of upstream prometheus/prometheus#18584 (GHSA-8rm2-7qqf-34qm). DecodeReadRequest now checks snappy.DecodedLen before allocating, so a small crafted payload that claims a huge decoded size is rejected instead of triggering a multi-GB heap allocation per request. Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Bastrykov Evgeniy <vporoshok@gmail.com>
u-veles-a
approved these changes
May 18, 2026
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.
Summary
Backports the upstream Prometheus security fix prometheus/prometheus#18584 (GHSA-8rm2-7qqf-34qm / CVE-2026-42154) to our fork.
The remote-read endpoint (
/api/v1/read) decompresses the snappy-encoded request body viastorage/remote.DecodeReadRequestwithout checking the declared decoded length. A small crafted payload can claim a huge decoded size and force a multi-GB heap allocation per request; under concurrent load this exhausts memory and crashes the process. The fix callssnappy.DecodedLenfirst and rejects anything above the existing 32 MiBdecodeReadLimitbefore allocating.pp/tools/block_converter(the path Dependabot flagged on alert #186) is an offline CLI that only usestsdb/labels/chunksand never reaches this code path, so that alert is unaffected by this PR — this PR fixes the same class of vulnerability inside our own Prometheus fork tree, which Dependabot doesn't see.Changes
storage/remote/codec.go: validatesnappy.DecodedLen(compressed)againstdecodeReadLimitbefore callingsnappy.Decode.storage/remote/codec_test.go: addTestDecodeReadRequestTooLarge— a 5-byte snappy header claiming 256 MiB decoded length is rejected withexceeds limit.CHANGELOG.md: entry underv0.8.0→Fixes.Test plan
go test -tags stringlabels -run TestDecodeReadRequest ./storage/remote/(new test passes)go test -tags stringlabels ./storage/remote/...(full package, 48s, all green)Made with Cursor