# GHSA-5fm9-h728-fwpj: trust-dns vulnerable to Remote Attackers causing Denial-of-Service (packet loops) with crafted DNS packets

> Remote attackers can cause denial of service in trust-dns by sending crafted DNS packets that trigger infinite response loops, consuming network and CPU resources.

- **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:** 1 Jun 2023
- **Also known as:** RUSTSEC-2023-0041

## What is GHSA-5fm9-h728-fwpj?

GHSA-5fm9-h728-fwpj is a denial of service vulnerability in trust-dns-server, published on 1 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

trust-dns and trust-dns-server are vulnerable to remotely triggered denial-of-service attacks, consuming both network and CPU resources.
DNS messages with the QR=1 bit set are responded to with a `FormErr` response.
This allows creating a traffic loop, in which these `FormErr` responses are sent nonstop between vulnerable servers.

There are two scenarios how this can be exploited: 1) Create a loop between two instances of trust-dns, consuming network resources, or 2) consuming the CPU of a single instance.

With two instances *A* and *B* an attacker sends a DNS query with a spoofed source IP address to *A*.
*A* replies with a `FormErr` to *B*.
Now both servers with ping-pong the message back and forth until by chance the packet is dropped in the network.
Multiple spoofed packets can be sent by the attacker, increasing resource consumption.

A single server can get locked up replying to itself.
Same setup as above, but now *A* sends the reply to itself.
The packet is sent out as fast as the CPU and network stack manage.
This locks up a CPU core.
Multiple packets from the attacker consume multiple CPU cores.

## Which versions are affected by GHSA-5fm9-h728-fwpj?

5 open source packages ship an affected version, including trust-dns-server.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `trust-dns-server` | crates.io | All versions | 0.22.1 |
| `trust-dns-server` | crates.io | All versions | 0.22.1 |
| `trust-dns-server` | crates.io | From 0.0.0-0 | 0.22.1, 0.23.0-alpha.3 |
| `trust-dns-server` | crates.io | From 0.23.0-alpha.2 | 0.23.0-alpha.3 |
| `trust-dns-server` | crates.io | From 0.23.0-alpha.2 | 0.23.0-alpha.3 |

## How do I fix GHSA-5fm9-h728-fwpj?

Upgrade trust-dns-server to a fixed version for your release line: 0.22.1 or 0.23.0-alpha.3.

## Is GHSA-5fm9-h728-fwpj being exploited?

There is no known exploitation of GHSA-5fm9-h728-fwpj in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-5fm9-h728-fwpj and fix it if it is affected.

What it is: GHSA-5fm9-h728-fwpj is a denial of service vulnerability in trust-dns-server, published on 1 Jun 2023. 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-5fm9-h728-fwpj in the wild and no public exploit code.

Affected packages and fixed versions:
- trust-dns-server (crates.io): affected all versions; fixed in 0.22.1
- trust-dns-server (crates.io): affected all versions; fixed in 0.22.1
- trust-dns-server (crates.io): affected from 0.0.0-0; fixed in 0.22.1, 0.23.0-alpha.3
- trust-dns-server (crates.io): affected from 0.23.0-alpha.2; fixed in 0.23.0-alpha.3
- trust-dns-server (crates.io): affected from 0.23.0-alpha.2; fixed in 0.23.0-alpha.3

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-5fm9-h728-fwpj/ (Markdown: https://insights.sbomify.com/GHSA-5fm9-h728-fwpj/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-5fm9-h728-fwpj

---
From sbomify Insights: https://insights.sbomify.com/GHSA-5fm9-h728-fwpj/
Summaries are generated and may contain mistakes; the official description above is the record.
