{"id":"CVE-2026-121808","aliases":["CVE-2026-121808","EEF-CVE-2026-121808","GHSA-xxp9-7hp4-rqwp"],"related":[],"kind":"vulnerability","state":"published","title":"Memory exhaustion via compressed Erlang terms in the elixir-grpc Erlpack codec","summary":"Improper Handling of Highly Compressed Data (Data Amplification) vulnerability in elixir-grpc grpc_core and grpc allows unauthenticated attackers to exhaust server memory via a compressed Erlang external term in a gRPC message body.\n\nGRPC.Codec.Erlpack.decode/2 (grpc_core/lib/grpc/codec/erlpack.ex, and lib/grpc/codec/erlpack.ex before the package split) passes the message body to :erlang.binary_to_term/2. That function inflates a compressed term in full before it returns. The codec sets no limit on the decoded size, and its type checks run only on the decoded term. The server's max_body_size limit counts the compressed bytes of the request. A request with Content-Type: application/grpc+erlpack can therefore make the server allocate a term much larger than the request body.\n\nThis issue affects grpc: from 0.4.0 before 1.0.0; grpc_core: from 1.0.0 before 1.1.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Improper Handling of Highly Compressed Data (Data Amplification) vulnerability in elixir-grpc grpc_core and grpc allows unauthenticated attackers to exhaust server memory via a compressed Erlang external term in a gRPC message body.\n\nGRPC.Codec.Erlpack.decode/2 (grpc_core/lib/grpc/codec/erlpack.ex, and lib/grpc/codec/erlpack.ex before the package split) passes the message body to :erlang.binary_to_term/2. That function inflates a compressed term in full before it returns. The codec sets no limit on the decoded size, and its type checks run only on the decoded term. The server's max_body_size limit counts the compressed bytes of the request. A request with Content-Type: application/grpc+erlpack can therefore make the server allocate a term much larger than the request body.\n\nThis issue affects grpc: from 0.4.0 before 1.0.0; grpc_core: from 1.0.0 before 1.1.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nImproper Handling of Highly Compressed Data (Data Amplification) vulnerability in elixir-grpc grpc_core and grpc allows unauthenticated attackers to exhaust server memory via a compressed Erlang external term in a gRPC message body.\n\n`GRPC.Codec.Erlpack.decode/2` (`grpc_core/lib/grpc/codec/erlpack.ex`, and `lib/grpc/codec/erlpack.ex` before the package split) passes the message body to `:erlang.binary_to_term/2`. That function inflates a compressed term in full before it returns. The codec sets no limit on the decoded size, and its type checks run only on the decoded term. The server's `max_body_size` limit counts the compressed bytes of the request. A request with `Content-Type: application/grpc+erlpack` can therefore make the server allocate a term much larger than the request body.\n\nThis issue affects grpc: from 0.4.0 before 1.0.0; grpc_core: from 1.0.0 before 1.1.0.\n\n## Details\n\n**1. Codec selection**\n\nThe server selects the codec from the request `Content-Type`. `application/grpc+erlpack` selects `GRPC.Codec.Erlpack` when the server registers it. No authentication step comes before this.\n\n**2. Size limit on compressed bytes only**\n\nThe server limits the request body with `max_body_size`, which counts the bytes received. With the gRPC compressed flag set to 0, the transport decompression limit does not apply, and the message reaches the codec unchanged.\n\n**3. Expansion inside `binary_to_term/2`**\n\n`GRPC.Codec.Erlpack.decode/2` calls `:erlang.binary_to_term(binary, [:safe])`. The Erlang external term format has a compressed form (version byte 131, tag 80, a 32-bit uncompressed size, then a zlib stream). `binary_to_term/2` inflates it in full, and the `:safe` option does not limit the size. `ensure_safe_term!/1` runs after the call returns and accepts a large binary.\n\n**4. Result**\n\nIn a test against grpc_server 1.0.6, a 260,932-byte request body decoded to a 268,435,456-byte binary, which the server passed to the application callback.\n\n## Proof of concept\n\n1. Start a gRPC server that registers `GRPC.Codec.Erlpack` in its `codecs` list.\n2. Build the payload with `:erlang.term_to_binary(:binary.copy(<<0>>, 268_435_456), [:compressed])`. The result is 260,932 bytes.\n3. Send the payload as one uncompressed gRPC message (compressed flag 0) to any method of the server, with `Content-Type: application/grpc+erlpack`.\n4. Observe that the server allocates the 268,435,456-byte binary and passes it to the application callback.\n\n## Impact\n\nAn unauthenticated client can make a server that registers the Erlpack codec allocate memory far beyond the size of the request with one request. Memory exhaustion affects every service on that node.\n\n## Workarounds\n\nRemove `GRPC.Codec.Erlpack` from the server's `codecs` list if the codec is not needed.\n\nIf the codec is needed, register a wrapper codec in its place. The wrapper implements the `GRPC.Codec` behaviour, returns `\"erlpack\"` from `name/0`, raises in `decode/2` when the body starts with the bytes `131, 80` (the compressed term tag), and delegates all other calls to `GRPC.Codec.Erlpack`.\n\n## Configurations\n\n`GRPC.Codec.Erlpack` must be explicitly registered as a codec on the gRPC server.","format":"markdown","source":"eef"}],"published":"2026-11-13T15:48:49.871Z","modified":"2026-11-25T17:23:05.311Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.2,"rating":"HIGH"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.2,"rating":"HIGH"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"}],"cwes":["CWE-409"],"affected":[{"ranges":[{"type":"semver","introduced":"0.4.0","fixed":"1.0.0","status":"affected"}],"vendor":"elixir-grpc","product":"grpc","package":"grpc","cpe":"cpe:2.3:a:elixir-grpc:grpc:*:*:*:*:*:*:*:*","repo":"https://github.com/elixir-grpc/grpc","source":"cvelist"},{"ranges":[{"type":"git","introduced":"25bcc569fe2cc4478531a6c546c923205fc751c9","fixed":"0332faae5f5e132314794dbfdae5edecbccea292","status":"affected"}],"vendor":"elixir-grpc","product":"grpc","package":"elixir-grpc/grpc","cpe":"cpe:2.3:a:elixir-grpc:grpc:*:*:*:*:*:*:*:*","repo":"https://github.com/elixir-grpc/grpc","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"1.0.0","fixed":"1.1.0","status":"affected"}],"vendor":"elixir-grpc","product":"grpc_core","package":"grpc_core","cpe":"cpe:2.3:a:elixir-grpc:grpc_core:*:*:*:*:*:*:*:*","repo":"https://github.com/elixir-grpc/grpc","source":"cvelist"},{"ranges":[{"type":"git","introduced":"0332faae5f5e132314794dbfdae5edecbccea292","fixed":"d6bc56ac75dfb6c02db2099909210a37c9be8db6","status":"affected"}],"vendor":"elixir-grpc","product":"grpc_core","package":"elixir-grpc/grpc","cpe":"cpe:2.3:a:elixir-grpc:grpc_core:*:*:*:*:*:*:*:*","repo":"https://github.com/elixir-grpc/grpc","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.4.0","status":"affected","fixed":"1.0.0"}],"ecosystem":"Hex","package":"grpc","purl":"pkg:hex/grpc","source":"eef"},{"ranges":[{"type":"semver","introduced":"1.0.0","status":"affected","fixed":"1.1.0"}],"ecosystem":"Hex","package":"grpc_core","purl":"pkg:hex/grpc_core","source":"eef"},{"ranges":[{"type":"git","introduced":"25bcc569fe2cc4478531a6c546c923205fc751c9","status":"affected","fixed":"0332faae5f5e132314794dbfdae5edecbccea292"}],"repo":"https://github.com/elixir-grpc/grpc","source":"eef"},{"ranges":[{"type":"git","introduced":"0332faae5f5e132314794dbfdae5edecbccea292","status":"affected","fixed":"d6bc56ac75dfb6c02db2099909210a37c9be8db6"}],"repo":"https://github.com/elixir-grpc/grpc","source":"eef"}],"references":[{"url":"https://github.com/elixir-grpc/grpc/security/advisories/GHSA-xxp9-7hp4-rqwp","tags":["advisory","related","vendor-advisory"],"sources":["cvelist","eef","nvd"]},{"url":"https://cna.erlef.org/cves/CVE-2026-121808.html","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-121808","tags":["related"],"sources":["cvelist","nvd"]},{"url":"https://github.com/elixir-grpc/grpc/commit/25bcc569fe2cc4478531a6c546c923205fc751c9","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/elixir-grpc/grpc/commit/0332faae5f5e132314794dbfdae5edecbccea292","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/elixir-grpc/grpc/commit/d6bc56ac75dfb6c02db2099909210a37c9be8db6","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://hex.pm/packages/grpc","tags":["package"],"sources":["eef"]},{"url":"https://hex.pm/packages/grpc_core","tags":["package"],"sources":["eef"]}],"credits":["Han Dai","Hongwei Li","Jiacheng Zhong","Junmin Zhu","Songyang Peng","Suyue Guo","Zhun Wang","Ziyue Pan","zx","Jace","Jonatan Männchen / EEF","Peter Ullrich","Paulo Valente"],"assigner":"EEF","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-16T22:54:59.075Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-121808","url":"https://www.cve.org/CVERecord?id=CVE-2026-121808","licence":"CVE Terms of Use","modified":"2026-11-20T05:56:02.779Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-121808","url":"https://osv.dev/vulnerability/EEF-CVE-2026-121808","licence":"CC-BY-4.0","modified":"2026-11-25T17:23:05.311Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-121808","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-121808","licence":"Public domain","modified":"2026-11-23T15:08:56.100Z"}],"updatedAt":"2026-11-25T22:59:50.733Z","epss":{"score":0.00618,"percentile":0.50965,"date":"2026-12-01T12:00:22.000Z"}}