# CVE-2024-34156: Stack exhaustion in Decoder.Decode in encoding/gob

> Attackers can cause a panic and denial of service by sending deeply nested structures to the Go encoding/gob decoder.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Sep 2024
- **Updated:** 26 Sep 2024
- **Also known as:** ALSA-2024:11216, ALSA-2024:11217, ALSA-2024:6946, ALSA-2024:6947, ALSA-2024:7135, ALSA-2024:7136, ALSA-2024:7204, ALSA-2024:8110, ALSA-2024:8111, ALSA-2024:9456, ALSA-2024:9472, ALSA-2025:3773, AZL-78970, AZL-98634, BELL-CVE-2024-34156, BIT-golang-2024-34156, CLSA-2025-1762420153, CLSA-2025-1762868093, DEBIAN-CVE-2024-34156, ECHO-0684-a311-5067, GHSA-crqm-pwhx-j97f, GO-2024-3106, MINI-8gj7-h6vw-783c, MINI-8mxr-h494-43jg, MINI-cjmx-g5r8-63r6, OESA-2024-2503, OESA-2024-2504, OESA-2024-2505, OESA-2024-2506, RHEA-2024:4866, RHSA-2024:11216, RHSA-2024:11217, RHSA-2024:6946, RHSA-2024:6947, RHSA-2024:7102, RHSA-2024:7103, RHSA-2024:7135, RHSA-2024:7136, RHSA-2024:7202, RHSA-2024:7203, RHSA-2024:7204, RHSA-2024:7205, RHSA-2024:7206, RHSA-2024:7207, RHSA-2024:7208, RHSA-2024:7261, RHSA-2024:7350, RHSA-2024:7351, RHSA-2024:7449, RHSA-2024:7455, RHSA-2024:7456, RHSA-2024:7485, RHSA-2024:7487, RHSA-2024:7488, RHSA-2024:7769, RHSA-2024:7791, RHSA-2024:7792, RHSA-2024:7793, RHSA-2024:7794, RHSA-2024:7818, RHSA-2024:7819, RHSA-2024:7820, RHSA-2024:7821, RHSA-2024:7822, RHSA-2024:7852, RHSA-2024:8110, RHSA-2024:8111, RHSA-2024:9456, RHSA-2024:9472, RHSA-2025:0203, RHSA-2025:1190, RLSA-2024:11216, RLSA-2024:11217, RLSA-2024:6946, RLSA-2024:6947, RLSA-2024:7135, RLSA-2024:7136, RLSA-2024:7204, RLSA-2024:8110, RLSA-2024:8111, RLSA-2024:9456, RLSA-2024:9472, UBUNTU-CVE-2024-34156, openSUSE-SU-2024:14375-1, openSUSE-SU-2024:14520-1, openSUSE-SU-2025:15505-1

## What is CVE-2024-34156?

CVE-2024-34156 is a high-severity denial of service vulnerability in encoding/gob, published on 6 Sep 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Calling Decoder.Decode on a message which contains deeply nested structures can cause a panic due to stack exhaustion. This is a follow-up to CVE-2022-30635.

## Which versions are affected by CVE-2024-34156?

2 open source packages ship an affected version, including golang and stdlib.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `golang` | Bitnami | All versions | 1.22.7, 1.23.1 |
| `stdlib` | Go | All versions | 1.22.7, 1.23.1 |
| `git-lfs` | AlmaLinux:8 | All versions | 3.4.1-3.el8_10 |
| `containernetworking-plugins` | AlmaLinux:9 | All versions | 1:1.4.0-6.el9_4 |
| `containernetworking-plugins` | AlmaLinux:9 | All versions | 1:1.5.1-3.el9_5 |
| `delve` | AlmaLinux:9 | All versions | 1.24.1-2.el9_5 |
| `git-lfs` | AlmaLinux:9 | All versions | 3.4.1-4.el9_4 |
| `go-toolset` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang-bin` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang-docs` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang-misc` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang-race` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang-src` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `golang-tests` | AlmaLinux:9 | All versions | 1.23.6-2.el9_5 |
| `grafana` | AlmaLinux:9 | All versions | 9.2.10-17.el9_4 |
| `grafana-pcp` | AlmaLinux:9 | All versions | 5.1.1-3.el9_4 |
| `grafana-pcp` | AlmaLinux:9 | All versions | 5.1.1-9.el9_5 |
| `grafana-selinux` | AlmaLinux:9 | All versions | 9.2.10-17.el9_4 |
| `osbuild-composer` | AlmaLinux:9 | All versions | 101-2.el9_4.alma.1 |
| `osbuild-composer` | AlmaLinux:9 | All versions | 118-2.el9_5.alma.1 |
| `osbuild-composer-core` | AlmaLinux:9 | All versions | 101-2.el9_4.alma.1 |
| `osbuild-composer-core` | AlmaLinux:9 | All versions | 118-2.el9_5.alma.1 |
| `osbuild-composer-worker` | AlmaLinux:9 | All versions | 101-2.el9_4.alma.1 |
| `osbuild-composer-worker` | AlmaLinux:9 | All versions | 118-2.el9_5.alma.1 |
| `skopeo` | AlmaLinux:9 | All versions | 2:1.14.5-2.el9_4 |
| `skopeo` | AlmaLinux:9 | All versions | 2:1.16.1-2.el9_5 |
| `skopeo-tests` | AlmaLinux:9 | All versions | 2:1.14.5-2.el9_4 |
| `skopeo-tests` | AlmaLinux:9 | All versions | 2:1.16.1-2.el9_5 |
| `git-lfs` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.4.1-3.el8_10 |
| `git-lfs-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.4.1-3.el8_10 |
| `git-lfs-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.4.1-3.el8_10 |
| `containernetworking-plugins` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.4.0-6.el9_4 |
| `containernetworking-plugins` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.5.1-3.el9_5 |
| `containernetworking-plugins-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.4.0-6.el9_4 |
| `containernetworking-plugins-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.5.1-3.el9_5 |
| `containernetworking-plugins-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.4.0-6.el9_4 |
| `containernetworking-plugins-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 1:1.5.1-3.el9_5 |
| `git-lfs` | Red Hat:enterprise_linux:9::appstream | All versions | 0:3.4.1-4.el9_4 |
| `git-lfs-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:3.4.1-4.el9_4 |

## How do I fix CVE-2024-34156?

Upgrade golang to a fixed version for your release line: 1.22.7 or 1.23.1.

## Is CVE-2024-34156 being exploited?

There is no known exploitation of CVE-2024-34156 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-34156 and fix it if it is affected.

What it is: CVE-2024-34156 is a high-severity denial of service vulnerability in encoding/gob, published on 6 Sep 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-34156 in the wild and no public exploit code.

Affected packages and fixed versions:
- golang (Bitnami): affected all versions; fixed in 1.22.7, 1.23.1
- stdlib (Go): affected all versions; fixed in 1.22.7, 1.23.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-34156/ (Markdown: https://insights.sbomify.com/CVE-2024-34156/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-34156
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-34156
- OSV: https://osv.dev/vulnerability/CVE-2024-34156

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-34156/
Summaries are generated and may contain mistakes; the official description above is the record.
