GHSA-grp7-v8xh-rj7h

Suggest an improvement
Source
https://github.com/advisories/GHSA-grp7-v8xh-rj7h
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-grp7-v8xh-rj7h/GHSA-grp7-v8xh-rj7h.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-grp7-v8xh-rj7h
Aliases
Published
2026-08-25T18:09:53Z
Modified
2026-08-26T00:38:22Z
Severity
  • 9.2 (Critical) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N CVSS Calculator
Summary
gRPC Erlang package vulnerable to Remote Code Execution with attacker-controlled gRPC payloads
Details

Summary

GRPC.Codec.Erlpack.decode/2 calls :erlang.binary_to_term/1 directly on the raw gRPC message body without the :safe option. Any unauthenticated peer that can reach a gRPC endpoint with Content-Type: application/grpc+erlpack can crash the entire BEAM node via atom table exhaustion or, if a decoded fun term flows into a call site that invokes it, achieve remote code execution inside the server process.

Details

Root cause — lib/grpc/codec/erlpack.ex implements decode/2 as a bare :erlang.binary_to_term(binary) call with no :safe flag, no size limit, and no type validation. This has two independent exploitation paths:

1. DoS via atom exhaustion — BEAM atoms are never garbage-collected and the global atom table is bounded (~1,048,576 entries). A crafted payload encoding large numbers of fresh atoms saturates the table and crashes the entire VM, taking down all applications on the node.

2. RCE via fun materialization — Without :safe, binary_to_term/1 reconstructs fun and external-fun terms from wire data. If the decoded value reaches any call site that applies it (e.g. Enum.map, Task.async, direct invocation), attacker-controlled code executes inside the server process.

Configuration requirement: GRPC.Codec.Erlpack is not registered by default and must be explicitly added to the server's codecs option.

PoC

  1. Start a gRPC server with codecs: [GRPC.Codec.Erlpack].
  2. Open an HTTP/2 connection to the server.
  3. Send a gRPC-framed POST to any RPC path with Content-Type: application/grpc+erlpack and a body of :erlang.term_to_binary(fn -> <malicious_code> end).
  4. The server's decode/2 materializes the fun; any downstream call site that invokes the decoded value executes the attacker's code.
  5. For DoS only: send payloads encoding fresh atoms in a loop until the atom table is exhausted and the VM crashes.

Impact

Affects grpc ≥ 0.4.0. Any server that explicitly registers GRPC.Codec.Erlpack is vulnerable to unauthenticated node-level DoS and potentially RCE.

References

Database specific
{
    "cwe_ids":  [
        "CWE-502",
        "CWE-770"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-08-25T18:09:53Z",
    "nvd_published_at":  "2026-06-15T23:16:45Z",
    "severity":  "CRITICAL"
}
References

Affected packages

Hex / grpc

Package

Name
grpc
Purl
pkg:hex/grpc

Affected ranges

Type
SEMVER
Events
Introduced
0.4.0
Fixed
1.0.0

Affected versions

0.*
0.5.0-beta
0.5.0-beta.1
0.5.0
0.6.0
0.7.0
0.8.0
0.8.1
0.9.0
0.10.0
0.10.1
0.10.2
0.11.0
0.11.1
0.11.2
0.11.3
0.11.4
0.11.5
1.*
1.0.0-rc.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-grp7-v8xh-rj7h/GHSA-grp7-v8xh-rj7h.json"