CVE-2026-42154
Description
Prometheus is an open-source monitoring system and time series database. Prior to versions 3.5.3 and 3.11.3, the remote read endpoint (/api/v1/read) does not validate the declared decoded length in a snappy-compressed request body before allocating memory. An unauthenticated attacker can send a small payload that causes a huge heap allocation per request. Under concurrent load this can exhaust available memory and crash the Prometheus process. This issue has been patched in versions 3.5.3 and 3.11.3.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/prometheus/prometheusGo | < 0.311.3 | 0.311.3 |
Affected products
2(expand)+ 1 more
- (no CPE)
- cpe:2.3:a:prometheus:prometheus:*:*:*:*:*:*:*:*range: <3.5.3
Patches
204055ee19081Merge pull request #18584 from roidelapluie/roidelapluie/snappylength
2 files changed · +20 −0
storage/remote/codec.go+8 −0 modified@@ -67,6 +67,14 @@ func DecodeReadRequest(r *http.Request) (*prompb.ReadRequest, error) { return nil, err } + decodedLen, err := snappy.DecodedLen(compressed) + if err != nil { + return nil, err + } + if decodedLen > decodeReadLimit { + return nil, fmt.Errorf("snappy: decoded length %d exceeds limit %d", decodedLen, decodeReadLimit) + } + reqBuf, err := snappy.Decode(nil, compressed) if err != nil { return nil, err
storage/remote/codec_test.go+12 −0 modified@@ -18,6 +18,7 @@ import ( "errors" "fmt" "io" + "net/http" "sync" "testing" @@ -729,6 +730,17 @@ func TestMergeLabels(t *testing.T) { } } +func TestDecodeReadRequestTooLarge(t *testing.T) { + // 5-byte snappy stream whose header claims 256 MiB decoded length, + // well above decodeReadLimit (32 MiB). + bomb := []byte{0x80, 0x80, 0x80, 0x80, 0x01} + req, err := http.NewRequest(http.MethodPost, "/", bytes.NewReader(bomb)) + require.NoError(t, err) + + _, err = DecodeReadRequest(req) + require.ErrorContains(t, err, "exceeds limit") +} + func TestDecodeWriteRequest(t *testing.T) { buf, _, _, err := buildWriteRequest(nil, writeRequestFixture.Timeseries, nil, nil, nil, nil, "snappy") require.NoError(t, err)
3ac006347ae9Merge pull request #18585 from roidelapluie/roidelapluie/snappylength-lts
2 files changed · +20 −0
storage/remote/codec.go+8 −0 modified@@ -67,6 +67,14 @@ func DecodeReadRequest(r *http.Request) (*prompb.ReadRequest, error) { return nil, err } + decodedLen, err := snappy.DecodedLen(compressed) + if err != nil { + return nil, err + } + if decodedLen > decodeReadLimit { + return nil, fmt.Errorf("snappy: decoded length %d exceeds limit %d", decodedLen, decodeReadLimit) + } + reqBuf, err := snappy.Decode(nil, compressed) if err != nil { return nil, err
storage/remote/codec_test.go+12 −0 modified@@ -17,6 +17,7 @@ import ( "bytes" "fmt" "io" + "net/http" "sync" "testing" @@ -616,6 +617,17 @@ func TestMergeLabels(t *testing.T) { } } +func TestDecodeReadRequestTooLarge(t *testing.T) { + // 5-byte snappy stream whose header claims 256 MiB decoded length, + // well above decodeReadLimit (32 MiB). + bomb := []byte{0x80, 0x80, 0x80, 0x80, 0x01} + req, err := http.NewRequest(http.MethodPost, "/", bytes.NewReader(bomb)) + require.NoError(t, err) + + _, err = DecodeReadRequest(req) + require.ErrorContains(t, err, "exceeds limit") +} + func TestDecodeWriteRequest(t *testing.T) { buf, _, _, err := buildWriteRequest(nil, writeRequestFixture.Timeseries, nil, nil, nil, nil, "snappy") require.NoError(t, err)
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
7- github.com/prometheus/prometheus/pull/18584nvdIssue TrackingPatchWEB
- github.com/prometheus/prometheus/pull/18585nvdIssue TrackingPatchWEB
- github.com/advisories/GHSA-8rm2-7qqf-34qmghsaADVISORY
- github.com/prometheus/prometheus/security/advisories/GHSA-8rm2-7qqf-34qmnvdVendor AdvisoryWEB
- nvd.nist.gov/vuln/detail/CVE-2026-42154ghsaADVISORY
- github.com/prometheus/prometheus/releases/tag/v3.11.3nvdRelease NotesWEB
- github.com/prometheus/prometheus/releases/tag/v3.5.3nvdRelease NotesWEB
News mentions
4- Patch Tuesday - May 2026Rapid7 Blog · May 13, 2026
- How Cloudflare responded to the “Copy Fail” Linux vulnerabilityCloudflare Blog · May 7, 2026
- The AI engineering stack we built internally — on the platform we shipCloudflare Blog · Apr 20, 2026
- Orchestrating AI Code Review at scaleCloudflare Blog · Apr 20, 2026