Skip to content

security: fixes OOM DoS vulnerability. upgrade gnark-crypto v0.12.1 → v0.20.1#20

Open
chris-mercer wants to merge 6 commits into
ethereumclassic:masterfrom
chris-mercer:security/deps-gnark-crypto
Open

security: fixes OOM DoS vulnerability. upgrade gnark-crypto v0.12.1 → v0.20.1#20
chris-mercer wants to merge 6 commits into
ethereumclassic:masterfrom
chris-mercer:security/deps-gnark-crypto

Conversation

@chris-mercer
Copy link
Copy Markdown
Member

@chris-mercer chris-mercer commented Mar 20, 2026

Summary

Upgrades consensys/gnark-crypto from v0.12.1 to v0.20.1, fixing GO-2025-4087 — an unchecked memory allocation during Vector deserialization that allows remote OOM DoS via crafted payloads.

Also upgrades crate-crypto/go-kzg-4844 from v0.7.0 to v1.1.0 for API compatibility (blob parameters changed from pass-by-value to pass-by-pointer in the newer gnark-crypto release).

Vulnerability

  • GO-2025-4087: Vector.ReadFrom(), Vector.AsyncReadFrom(), Vector.UnmarshalBinary() across 20+ curve packages do not validate allocation sizes, allowing memory exhaustion via crafted inputs.
  • Affected versions: v0.9.1 through v0.18.0, and v0.19.0 through v0.19.1
  • Fixed in: v0.18.1 / v0.19.2+

Changes

  • go.mod: gnark-crypto v0.12.1 → v0.20.1, go-kzg-4844 v0.7.0 → v1.1.0
  • crypto/kzg4844/kzg4844_gokzg.go: updated wrapper to use pointer casts for blob arguments (API change in go-kzg-4844 v1.x)
  • Cascaded indirect deps: bitset v1.24.4, testify v1.11.1, go-internal v1.12.0
  • Removed stale indirect deps: bavard, addchain

Dependencies

Requires PR #10 (Go 1.26 upgrade) to be merged first. This PR was branched from #10's branch, so it inherits and layers on top of those changes. gnark-crypto v0.20.1 uses Go generics and requires Go 1.22+; #10 upgrades from Go 1.21 to 1.26.

Verification

  • go build ./... — clean
  • go vet ./... — clean
  • go mod tidy — no changes

References


Road to Olympia — Core-Geth Modernization March

Developed by White B0x Inc. for Ethereum Classic DAO LLC

🤖 Generated with Claude Code

Merge Order

chris-mercer and others added 6 commits March 20, 2026 12:06
Go 1.21 reached end-of-life in August 2024 with no security patches.
This is the primary ETC client — cannot ship on EOL toolchain.

Changes:
- go.mod: Go 1.21 → 1.24
- Dockerfiles: golang:1.22-alpine → golang:1.24-alpine
- CI workflows: all 8 workflow files updated to Go 1.24
- Remove fjl/memsize dependency (incompatible with Go 1.23+ due to
  runtime.stopTheWorld linkname restriction, no upstream fix available)
- Fix Go 1.24 non-constant format string vet errors in 7 test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
blst v0.3.11 used `typedef _Bool bool` which C23-aware GCC in
golang:1.24-alpine rejects (bool is a keyword in C23). v0.3.14
includes explicit C23 harmonization and Go 1.24 support.

Also added -std=gnu11 to gotool.go CGO_CFLAGS as defense-in-depth
against future C23 typedef issues from any CGO dependency. The
Dockerfile ENV approach was ineffective because gotool.go
unconditionally overrides CGO_CFLAGS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Go 1.24 reached end-of-life on 2026-02-11. Go 1.26.1 is the current
stable release. The x/tools package required updating for Go 1.26
compatibility, which cascaded to x/crypto, x/net, x/sys, x/sync,
x/text, and x/mod.

Changes:
- go.mod: Go 1.24 → 1.26
- golang.org/x/tools v0.21 → v0.43 (Go 1.26 compat)
- golang.org/x/crypto v0.31 → v0.49 (cascading dep)
- golang.org/x/net v0.33 → v0.52 (cascading dep)
- golang.org/x/sys v0.28 → v0.42 (cascading dep)
- golang.org/x/sync v0.10 → v0.20 (cascading dep)
- golang.org/x/text v0.21 → v0.35 (cascading dep)
- golang.org/x/mod v0.17 → v0.34 (cascading dep)
- All 8 CI workflows: go-version 1.24 → 1.26
- Both Dockerfiles: golang:1.24-alpine → golang:1.26-alpine

Verified: go build ./..., go vet ./..., go mod tidy (clean)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Latest stable release (Sep 2024). Includes lifted limitation for
384-bit modular inversion and hardened operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Brings x/time to current release. Used in p2p/dnsdisc rate limiting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
….1.0

Fixes GO-2025-4087: unchecked memory allocation during Vector
deserialization allows OOM DoS via crafted payloads.

gnark-crypto v0.20.1 requires updated go-kzg-4844 v1.1.0 due to API
change (blob parameters changed from value to pointer). Updated
kzg4844_gokzg.go wrapper accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates cryptography dependencies to address an OOM DoS vector in gnark-crypto deserialization and adjusts related tooling/wrappers to stay compatible with the upgraded libraries and Go toolchain.

Changes:

  • Upgrade github.com/consensys/gnark-crypto to v0.20.1 (and related dependency cascade) and bump go-kzg-4844 to v1.1.0.
  • Update the Go KZG wrapper to match the new go-kzg-4844 API (blob arguments now passed by pointer).
  • Bump Go/tooling to 1.26 across module, CI, and Dockerfiles; remove the fjl/memsize debug endpoint and fix vet-unfriendly test logging/formatting.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
metrics/json_test.go Fix t.Fatalf to use a constant format string (vet compliance).
internal/debug/flags.go Remove memsizeui import/state and /memsize/ pprof handler wiring.
internal/build/gotool.go Add -std=gnu11 to CGO C flags for C compiler compatibility.
go.sum Reflect updated direct/indirect dependency versions and removals.
go.mod Bump Go version to 1.26 and update required module versions (gnark-crypto, go-kzg, blst, x/*).
crypto/kzg4844/kzg4844_gokzg.go Update go-kzg calls to pass blobs by pointer per v1.x API.
core/rawdb/accessors_chain_test.go Fix t.Fatalf to use a constant format string (vet compliance).
cmd/rlpdump/main.go Make Fprintf usage explicit with a format string.
cmd/geth/main.go Remove debug.Memsize.Add(...) usage.
cmd/geth/logging_test.go Fix t.Logf calls to use constant format strings (vet compliance).
cmd/evm/t8n_test.go Fix t.Logf calls to use constant format strings (vet compliance).
accounts/abi/unpack_test.go Fix incorrect t.Fatalf formatting when hex decode fails.
Dockerfile.alltools Update builder image to golang:1.26-alpine.
Dockerfile Update builder image to golang:1.26-alpine.
.github/workflows/test-linux.yml Update CI Go version to 1.26.
.github/workflows/release-packages.yml Update CI Go version to 1.26.
.github/workflows/go-generate-check.yml Update CI Go version to 1.26.
.github/workflows/evmc.yml Update CI Go version to 1.26.
.github/workflows/bench-vm.yml Update CI Go version to 1.26.
.github/workflows/bench-trie.yml Update CI Go version to 1.26.
.github/workflows/bench-core.yml Update CI Go version to 1.26.
.github/workflows/audit-bootnodes.yml Update CI Go version to 1.26.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/build/gotool.go
Comment thread go.mod
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