Vulnerabilities in pkg:golang/github.com/klauspost/compress

PACKAGE
Advisory Identifier: GHSA-259r-337f-4rfw
Advisory Summary

CVE-2026-63209 is a HIGH (CVSS 7.5) integer overflow or wraparound and vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Compress/s2 libraries in the Go ecosystem. The issue involves integer overflow or wraparound and out-of-bounds write in compress. Remediation is available by upgrading affected packages to version 1.18.7.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/klauspost/compress

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/klauspost/compress. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-259r-337f-4rfw CVE-2026-63209 HIGH Compress/s2: Integer Overflow or Wraparound and Out-of-bounds Write in compress

CVE-2026-63209 at a Glance

CVE Identifier CVE-2026-63209
GHSA Identifier GHSA-259r-337f-4rfw
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product Compress/s2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-63209

To remediate this vulnerability, upgrade all affected Compress/s2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/klauspost/compress fixed: 1.18.7
Upgrade github.com/klauspost/compress to 1.18.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/klauspost/compress

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-63209, inspect your project dependencies for Compress/s2:

inspect dependencies for github.com/klauspost/compress

Analyze the terminal output to locate any version of Compress/s2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.18.7), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Compress/s2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Signed Integer Overflow in s2.NewDict ## Summary A signed integer overflow vulnerability in `s2.NewDict()` allows an attacker to bypass repeat index validation by supplying a dictionary with a uvarint-encoded repeat value exceeding `MaxInt64`. When `Dict.Encode()` is subsequently called, the overflowed negative repeat value causes an out-of-bounds memory access via `unsafe.Pointer` arithmetic, crashing the process with SIGSEGV. ## Package - **Name:** `github.com/klauspost/compress/s2` - **Ecosystem:** Go - **Affected versions:** <= v1.18.6 (all versions with `NewDict` function) ## Severity **High (7.5)** — CVSS v3.1: `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H` ## Vulnerability ### Type - CWE-190: Integer Overflow or Wraparound - CWE-787: Out-of-bounds Write (via unsafe.Pointer) ### Description The `NewDict()` function reads a uvarint from dictionary data and converts it to `int`: ```go r, n := binary.Uvarint(dict) // ... d.repeat = int(r) if d.repeat > len(dict) { return nil } ``` When `r` exceeds `MaxInt64` (9223372036854775807), `int(r)` overflows to a negative value. Since a negative number is never greater than a positive length, the validation check is bypassed. When `Dict.Encode()` is called, the negative `repeat` value causes an integer overflow in `encodeBlockDictGo()`: ```go repeat := len(dict.dict) - dict.repeat // overflows: 62 - (-5758978476775341977) = huge positive candidate := len(dict.dict) - repeat + s // underflows to negative load32(dict.dict, candidate) // OOB via unsafe.Pointer ``` `load32` calls `le.Load32` which uses `unsafe.Pointer` arithmetic without bounds checking: ```go func Load32[I Indexer](b []byte, i I) uint32 { return *(*uint32)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(b)), i)) } ``` This causes a segmentation fault (SIGSEGV) when the negative index is dereferenced. ## PoC ```go package main import ( "encoding/binary" "fmt" "github.com/klauspost/compress/s2" ) func main() { var dictData []byte buf := make([]byte, binary.MaxVarintLen64) n := binary.PutUvarint(buf, 12687765596934209639) // > MaxInt64 dictData = append(dictData, buf[:n]...) dictData = append(dictData, make([]byte, 16)...) // minimum dict size dict := s2.NewDict(dictData) // dict is non-nil despite invalid repeat value (overflow bypassed validation) src := make([]byte, 64) for i := range src { src[i] = byte(i) } dict.Encode(nil, src) // SIGSEGV: OOB access via unsafe.Pointer } ``` ## Impact - **Denial of Service:** The process crashes immediately with SIGSEGV ## Attack Vector Any application that: 1. Accepts user-supplied S2 dictionary data via `s2.NewDict()` 2. Calls `Dict.Encode()` on any data ≥32 bytes ## Suggested Fix Validate the uvarint value before converting to int: ```go if r > math.MaxInt64 { return nil } d.repeat = int(r) ``` Or use `uint` for the repeat field and validate against `uint(len(dict))`. ## References - Source: `s2/dict.go` lines 59-61 (vulnerability), `s2/encode_all.go` line 947 (crash site) - Commit: 539243b (v1.18.6 + 4 commits) ## Credits Christopher Linke / https://github.com/celinke97/

CVE-2026-63209 Affected Compress/s2 Versions

1 component(s)
Fixed Versions:
1.18.7
Product / Package Ecosystem Affected Versions Fixed Version
github.com/klauspost/compress
Go
< 1.18.7
1.18.7

References

Frequently Asked Questions

What is CVE-2026-63209?
CVE-2026-63209 is a security vulnerability in Compress/s2 involving Integer Overflow or Wraparound and Out-of-bounds Write in compress under CWE-190: Integer Overflow or Wraparound.
Which Compress/s2 versions are affected?
Affected versions include releases prior to 1.18.7 across affected packages: github.com/klauspost/compress.
What version fixes CVE-2026-63209?
Upgrading to 1.18.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/klauspost/compress affected?
Yes, github.com/klauspost/compress is affected in releases prior to 1.18.7. Upgrade your dependency to 1.18.7 or later.
What is the CVSS score of CVE-2026-63209?
CVE-2026-63209 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-63209?
CVE-2026-63209 is classified under CWE-190: Integer Overflow or Wraparound (The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.).
How can I check Go dependencies for CVE-2026-63209?
Run the dependency tree command: 'inspect dependencies for github.com/klauspost/compress'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-259r-337f-4rfw",
  "modified" : "2026-10-20T14:33:33Z",
  "published" : "2026-10-20T14:33:33Z",
  "aliases" : [ "CVE-2026-63209" ],
  "summary" : "Compress/s2: Integer Overflow or Wraparound and Out-of-bounds Write in compress",
  "details" : "# Signed Integer Overflow in s2.NewDict\n\n## Summary\n\nA signed integer overflow vulnerability in `s2.NewDict()` allows an attacker to bypass repeat index validation by supplying a dictionary with a uvarint-encoded repeat value exceeding `MaxInt64`. When `Dict.Encode()` is subsequently called, the overflowed negative repeat value causes an out-of-bounds memory access via `unsafe.Pointer` arithmetic, crashing the process with SIGSEGV.\n\n## Package\n\n- **Name:** `github.com/klauspost/compress/s2`\n- **Ecosystem:** Go\n- **Affected versions:** <= v1.18.6 (all versions with `NewDict` function)\n\n## Severity\n\n**High (7.5)** — CVSS v3.1: `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`\n\n## Vulnerability\n\n### Type\n- CWE-190: Integer Overflow or Wraparound\n- CWE-787: Out-of-bounds Write (via unsafe.Pointer)\n\n### Description\n\nThe `NewDict()` function reads a uvarint from dictionary data and converts it to `int`:\n\n```go\nr, n := binary.Uvarint(dict)\n// ...\nd.repeat = int(r)\nif d.repeat > len(dict) {\n    return nil\n}\n```\n\nWhen `r` exceeds `MaxInt64` (9223372036854775807), `int(r)` overflows to a negative value. Since a negative number is never greater than a positive length, the validation check is bypassed.\n\nWhen `Dict.Encode()` is called, the negative `repeat` value causes an integer overflow in `encodeBlockDictGo()`:\n\n```go\nrepeat := len(dict.dict) - dict.repeat  // overflows: 62 - (-5758978476775341977) = huge positive\ncandidate := len(dict.dict) - repeat + s // underflows to negative\nload32(dict.dict, candidate)             // OOB via unsafe.Pointer\n```\n\n`load32` calls `le.Load32` which uses `unsafe.Pointer` arithmetic without bounds checking:\n\n```go\nfunc Load32[I Indexer](b []byte, i I) uint32 {\n    return *(*uint32)(unsafe.Add(unsafe.Pointer(unsafe.SliceData(b)), i))\n}\n```\n\nThis causes a segmentation fault (SIGSEGV) when the negative index is dereferenced.\n\n## PoC\n\n```go\npackage main\n\nimport (\n    \"encoding/binary\"\n    \"fmt\"\n    \"github.com/klauspost/compress/s2\"\n)\n\nfunc main() {\n    var dictData []byte\n    buf := make([]byte, binary.MaxVarintLen64)\n    n := binary.PutUvarint(buf, 12687765596934209639) // > MaxInt64\n    dictData = append(dictData, buf[:n]...)\n    dictData = append(dictData, make([]byte, 16)...) // minimum dict size\n\n    dict := s2.NewDict(dictData)\n    // dict is non-nil despite invalid repeat value (overflow bypassed validation)\n\n    src := make([]byte, 64)\n    for i := range src { src[i] = byte(i) }\n    dict.Encode(nil, src) // SIGSEGV: OOB access via unsafe.Pointer\n}\n```\n\n## Impact\n\n- **Denial of Service:** The process crashes immediately with SIGSEGV\n\n## Attack Vector\n\nAny application that:\n1. Accepts user-supplied S2 dictionary data via `s2.NewDict()`\n2. Calls `Dict.Encode()` on any data ≥32 bytes\n\n## Suggested Fix\n\nValidate the uvarint value before converting to int:\n\n```go\nif r > math.MaxInt64 {\n    return nil\n}\nd.repeat = int(r)\n```\n\nOr use `uint` for the repeat field and validate against `uint(len(dict))`.\n\n## References\n\n- Source: `s2/dict.go` lines 59-61 (vulnerability), `s2/encode_all.go` line 947 (crash site)\n- Commit: 539243b (v1.18.6 + 4 commits)\n\n## Credits\nChristopher Linke / https://github.com/celinke97/",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/klauspost/compress"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.18.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.18.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/klauspost/compress/security/advisories/GHSA-259r-337f-4rfw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-63209"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/klauspost/compress/pull/1163"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/klauspost/compress/commit/539243b8823ee8f03e49969823d57c348c917536"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/klauspost/compress/commit/8668e357e776d5152ed62f33c17f21b8690664fa"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/klauspost/compress"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/klauspost/compress/releases/tag/v1.18.7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190", "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-20T14:33:33Z",
    "nvd_published_at" : "2026-09-29T15:17:27Z"
  }
}