# CVE-2023-37475: Attacker-controlled parameter can cause denial of service in hamba avro

> A crafted string in the hamba/avro Go library can cause an unrecoverable out-of-memory error, leading to application denial of service.

- **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:** 17 Jul 2023
- **Updated:** 18 Oct 2024
- **Also known as:** GHSA-9x44-9pgq-cf45, GO-2023-1930

## What is CVE-2023-37475?

CVE-2023-37475 is a high-severity denial of service vulnerability in hamba avro, published on 17 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Hamba avro is a go lang encoder/decoder implementation of the avro codec specification. In affected versions a well-crafted string passed to avro's `github.com/hamba/avro/v2.Unmarshal()` can throw a `fatal error: runtime: out of memory` which is unrecoverable and can cause denial of service of the consumer of avro. The root cause of the issue is that avro uses part of the input to `Unmarshal()` to determine the size when creating a new slice and hence an attacker may consume arbitrary amounts of memory which in turn may cause the application to crash. This issue has been addressed in commit `b4a402f4` which has been included in release version `2.13.0`. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-400 (Uncontrolled Resource Consumption)

## Which versions are affected by CVE-2023-37475?

6 open source packages ship an affected version, including github.com/hamba/avro and github.com/hamba/avro/v2. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/hamba/avro` | Go | All versions | None |
| `github.com/hamba/avro` | Go | All versions | 2.13.0 |
| `github.com/hamba/avro` | Go | All versions | 2.13.0 |
| `github.com/hamba/avro/v2` | Go | All versions | 2.13.0 |
| `github.com/hamba/avro/v2` | Go | All versions | 2.13.0 |
| `github.com/hamba/avro/v2` | Go | All versions | 2.13.0 |

Products: Avro Project Avro.

## How do I fix CVE-2023-37475?

Upgrade github.com/hamba/avro to 2.13.0 or later.

## Is CVE-2023-37475 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-37475 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-37475 and fix it if it is affected.

What it is: CVE-2023-37475 is a high-severity denial of service vulnerability in hamba avro, published on 17 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-37475 exists.

Affected packages and fixed versions:
- github.com/hamba/avro (Go): affected all versions; no fix listed
- github.com/hamba/avro (Go): affected all versions; fixed in 2.13.0
- github.com/hamba/avro (Go): affected all versions; fixed in 2.13.0
- github.com/hamba/avro/v2 (Go): affected all versions; fixed in 2.13.0
- github.com/hamba/avro/v2 (Go): affected all versions; fixed in 2.13.0
- github.com/hamba/avro/v2 (Go): affected all versions; fixed in 2.13.0

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-2023-37475/ (Markdown: https://insights.sbomify.com/CVE-2023-37475/index.md)
```

## Sources

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

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