# CVE-2017-3204: golang.org/x/crypto/ssh Man-in-the-Middle attack

> The Go SSH library failed to verify host keys by default, allowing man-in-the-middle attacks unless developers explicitly configured verification.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/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:** 4 Apr 2017
- **Updated:** 5 Aug 2024
- **Also known as:** DEBIAN-CVE-2017-3204, GHSA-xhjq-w7xm-p8qj, GO-2020-0013, UBUNTU-CVE-2017-3204

## What is CVE-2017-3204?

CVE-2017-3204 is a high-severity vulnerability in Go SSH library, published on 4 Apr 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The Go SSH library (x/crypto/ssh) by default does not verify host keys, facilitating man-in-the-middle attacks. Default behavior changed in commit e4e2799 to require explicitly registering a hostkey verification mechanism.

Weakness: CWE-310

## Which versions are affected by CVE-2017-3204?

3 open source packages ship an affected version, including golang.org/x/crypto. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `golang.org/x/crypto` | Go | All versions | 0.0.0-20170330155735-e4e2799dd7aa |
| `golang.org/x/crypto` | Go | All versions | 0.0.0-20170330155735-e4e2799dd7aa |
| `golang.org/x/crypto` | Go | All versions | 0.0.0-20170330155735-e4e2799dd7aa |

Products: Golang Crypto.

## How do I fix CVE-2017-3204?

Upgrade golang.org/x/crypto to 0.0.0-20170330155735-e4e2799dd7aa or later.

## Is CVE-2017-3204 being exploited?

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

## Other vulnerabilities in Go SSH library

- [CVE-2026-46595](https://insights.sbomify.com/CVE-2026-46595/): Invoking VerifiedPublicKeyCallback permissions skip enforcement in golang.org/x/crypto/ssh (critical 10.0)
- [CVE-2026-39830](https://insights.sbomify.com/CVE-2026-39830/): Invoking client can cause server deadlock on unexpected responses in golang.org/x/crypto/ssh (critical 9.1)
- [CVE-2026-39831](https://insights.sbomify.com/CVE-2026-39831/): Invoking bypass of FIDO/U2F security keys physical interaction in golang.org/x/crypto/ssh (critical 9.1)
- [CVE-2026-39832](https://insights.sbomify.com/CVE-2026-39832/): Invoking agent constraints dropped when forwarding keys in golang.org/x/crypto/ssh/agent (critical 9.1)
- [CVE-2026-39833](https://insights.sbomify.com/CVE-2026-39833/): Invoking key constraints not enforced in golang.org/x/crypto/ssh/agent (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2017-3204 and fix it if it is affected.

What it is: CVE-2017-3204 is a high-severity vulnerability in Go SSH library, published on 4 Apr 2017. 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-2017-3204 in the wild and no public exploit code.

Affected packages and fixed versions:
- golang.org/x/crypto (Go): affected all versions; fixed in 0.0.0-20170330155735-e4e2799dd7aa
- golang.org/x/crypto (Go): affected all versions; fixed in 0.0.0-20170330155735-e4e2799dd7aa
- golang.org/x/crypto (Go): affected all versions; fixed in 0.0.0-20170330155735-e4e2799dd7aa

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

## Sources

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

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