# GHSA-8hxh-r6f7-jf45: Memory exhaustion in http4s-async-http-client with large or malicious compressed responses

> A malicious server can exhaust client memory via large compressed responses, causing denial of service in applications using this HTTP client library.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 16 Oct 2020

## What is GHSA-8hxh-r6f7-jf45?

GHSA-8hxh-r6f7-jf45 is a denial of service vulnerability in org.http4s:http4s-async-http-client_2.12, published on 16 Oct 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact
A server we connect to with http4s-async-http-client could theoretically respond with a large or malicious compressed stream and exhaust memory in the client JVM.  It does not affect http4s servers, other client backends, or clients that speak only to trusted servers.  This is related to a transitive dependency on netty-codec-4.1.45.Final, which is affected by [CVE-2020-11612](https://app.snyk.io/vuln/SNYK-JAVA-IONETTY-564897).

### Patches
Upgrade to http4s-async-http-client >= 0.21.8.  All 1.0 milestones are also safe.

### Workarounds
Add an explicit runtime dependency on async-http-client's netty dependencies that evicts them to an unaffected version:

```scala
libraryDependencies ++= Seq(
  "io.netty" %  "netty-codec"         % "4.1.53.Final" % Runtime,
  "io.netty" %  "netty-codec-socks"   % "4.1.53.Final" % Runtime,
  "io.netty" %  "netty-handler-proxy" % "4.1.53.Final" % Runtime,
  "io.netty" %  "netty-common"        % "4.1.53.Final" % Runtime,
  "io.netty" %  "netty-transport"     % "4.1.53.Final" % Runtime,
  "io.netty" %  "netty-handler"       % "4.1.53.Final" % Runtime,
  "io.netty" %  "netty-resolver-dns"  % "4.1.53.Final" % Runtime
)
```

### References
* https://app.snyk.io/vuln/SNYK-JAVA-IONETTY-564897
* https://github.com/http4s/http4s/issues/3681

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [http4s](https://github.com/http4s/http4s/issues/new)
* Contact a maintainer privately per [http4s' security policy](https://github.com/http4s/http4s/blob/master/SECURITY.md#reporting-a-vulnerability)

## Which versions are affected by GHSA-8hxh-r6f7-jf45?

4 open source packages ship an affected version, including org.http4s:http4s-async-http-client_2.12 and org.http4s:http4s-async-http-client_2.13.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.http4s:http4s-async-http-client_2.12` | Maven | All versions | 0.21.8 |
| `org.http4s:http4s-async-http-client_2.12` | Maven | All versions | 0.21.8 |
| `org.http4s:http4s-async-http-client_2.13` | Maven | All versions | 0.21.8 |
| `org.http4s:http4s-async-http-client_2.13` | Maven | All versions | 0.21.8 |

## How do I fix GHSA-8hxh-r6f7-jf45?

Upgrade org.http4s:http4s-async-http-client_2.12 to 0.21.8 or later.

## Is GHSA-8hxh-r6f7-jf45 being exploited?

There is no known exploitation of GHSA-8hxh-r6f7-jf45 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-8hxh-r6f7-jf45 and fix it if it is affected.

What it is: GHSA-8hxh-r6f7-jf45 is a denial of service vulnerability in org.http4s:http4s-async-http-client_2.12, published on 16 Oct 2020. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-8hxh-r6f7-jf45 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.http4s:http4s-async-http-client_2.12 (Maven): affected all versions; fixed in 0.21.8
- org.http4s:http4s-async-http-client_2.12 (Maven): affected all versions; fixed in 0.21.8
- org.http4s:http4s-async-http-client_2.13 (Maven): affected all versions; fixed in 0.21.8
- org.http4s:http4s-async-http-client_2.13 (Maven): affected all versions; fixed in 0.21.8

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/GHSA-8hxh-r6f7-jf45/ (Markdown: https://insights.sbomify.com/GHSA-8hxh-r6f7-jf45/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-8hxh-r6f7-jf45

---
From sbomify Insights: https://insights.sbomify.com/GHSA-8hxh-r6f7-jf45/
Summaries are generated and may contain mistakes; the official description above is the record.
