# GHSA-gv9j-4w24-q7vx: Improper random number generation in github.com/coredns/coredns

> Predictable transaction IDs in CoreDNS allow attackers to forge DNS responses, potentially redirecting traffic or poisoning caches.

- **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 Mar 2022
- **Also known as:** GO-2022-0368

## What is GHSA-gv9j-4w24-q7vx?

GHSA-gv9j-4w24-q7vx is a vulnerability in github.com/coredns/coredns, published on 1 Mar 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

CoreDNS before 1.6.6 (using go DNS package < 1.1.25) improperly generates random numbers because math/rand is used. The TXID becomes predictable, leading to response forgeries.

### Patches
The problem has been fixed in 1.6.6+.

### References
- [CVE-2019-19794](https://nvd.nist.gov/vuln/detail/CVE-2019-19794)

### For more information
Please consult [our security guide](https://github.com/coredns/coredns/blob/master/.github/SECURITY.md) for more information regarding our security process.

## Which versions are affected by GHSA-gv9j-4w24-q7vx?

3 open source packages ship an affected version, including github.com/coredns/coredns.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/coredns/coredns` | Go | All versions | 1.6.6 |
| `github.com/coredns/coredns` | Go | All versions | 1.6.6 |
| `github.com/coredns/coredns` | Go | All versions | 1.6.6 |

## How do I fix GHSA-gv9j-4w24-q7vx?

Upgrade github.com/coredns/coredns to 1.6.6 or later.

## Is GHSA-gv9j-4w24-q7vx being exploited?

There is no known exploitation of GHSA-gv9j-4w24-q7vx in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-gv9j-4w24-q7vx and fix it if it is affected.

What it is: GHSA-gv9j-4w24-q7vx is a vulnerability in github.com/coredns/coredns, published on 1 Mar 2022. 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-gv9j-4w24-q7vx in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/coredns/coredns (Go): affected all versions; fixed in 1.6.6
- github.com/coredns/coredns (Go): affected all versions; fixed in 1.6.6
- github.com/coredns/coredns (Go): affected all versions; fixed in 1.6.6

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-gv9j-4w24-q7vx/ (Markdown: https://insights.sbomify.com/GHSA-gv9j-4w24-q7vx/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-gv9j-4w24-q7vx

---
From sbomify Insights: https://insights.sbomify.com/GHSA-gv9j-4w24-q7vx/
Summaries are generated and may contain mistakes; the official description above is the record.
