GHSA-mxg3-432p-mr72: goshs: SSH host key verification disabled, allowing transparent MITM of every tunnelled HTTP request
Noroxi assessment
Priority: Monitor (action score 29/100)
- The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
- Anyone who can reach it over the internet can trigger it. No account or password is required. No user action is required. Special conditions such as timing or configuration are required.
- Fixed version: goshs.de/goshs/v2 (Go) 2.0.7.
Low priority for now. Upgrade to goshs.de/goshs/v2 (Go) 2.0.7 or later.
Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it
Primary sources: OSV
### Summary The `--tunnel` / `-t` flag opens an outbound SSH connection to `localhost.run:22` with `HostKeyCallback: ssh.InsecureIgnoreHostKey()`. The Go documentation for that function states verbatim: *"It should not be used for production code."* With the callback disabled the client accepts any host key the server presents, so an attacker who can intercept the operator's TCP connection to `localhost.run:22` (any router on the path, malicious local network, ARP/DNS spoof on the operator's LAN, BGP hijack, malicious VPN) can present their own SSH host key, terminate the SSH session locally, and proxy onward — sitting transparently in the middle of the tunnel. Because `localhost.run` does TLS termination at their end, the HTTP traffic on the SSH leg is plaintext, so the on-path attacker reads and rewrites every request and response in cleartext. The goshs operator gets no warning; the public URL works normally. ### Affected Code **File:** `tunnel/tunnel.go` ```go func Start(localIP string, localPort int) (*Tunnel, error) { config := &ssh.ClientConfig{ User: "nokey", Auth: []ssh.AuthMethod{ssh.Password("")}, HostKeyCallback: ssh.InsecureIgnoreHostKey(), // accepts any server key Timeout: 10 * time.Second, BannerCallback: func(banner string) error { return nil }, } client, err := ssh.Dial("tcp", "localhost.run:22", config) ... } ``` There is no fallback verification — no `ssh.FixedHostKey`, no `known_hosts` read, no TOFU pin. Every invocation of `goshs --tunnel` is equally vulnerable. ### Exploit Chain 1. Operator runs `goshs --tunnel`. `tunnel.Start()` opens an SSH client to `localhost.run:22` with `InsecureIgnoreHostKey()`. 2. Attacker positioned on the network path (compromised router, café Wi-Fi MITM, malicious VPN exit, hostile ISP, BGP hijack, or `arpspoof` + DNS spoof on the operator's LAN) intercepts the outbound TCP connection to `localhost.run:22` and answers with their own SSH server. 3. The attacker's fake SSH server presents an attacker-generated host key. The goshs client's `HostKeyCallback` returns nil unconditionally. Handshake completes; the client believes it is talking to `localhost.run`. 4. The attacker proxies the SSH session onward to the real `localhost.run:22`, forwarding the URL capture so `Start()` reads back the genuine `https://*.lhr.life` line and returns successfully. The operator sees the public URL printed to stdout exactly as expected. 5. Every HTTP request arriving at the public URL is routed over the SSH session. The attacker reads every URL, query string, header, body, and `Authorization` value sent by every visitor. 6. For each response the attacker can rewrite the body or headers — serving modified files, injecting HTML/JS, redirecting requests, or stripping `Set-Cookie` attributes. 7. Captured basic-auth credentials give the attacker authenticated access to upload, share-link, catcher, clipboard, and CLI endpoints. If goshs is running credential-collection listeners (SMB/LDAP/SMTP), the captured NTLM hashes and SMTP messages flowing through the tunnel are also exposed. ### Impact - **Confidentiality (High):** all HTTP request and response content is readable by the on-path attacker (URLs, headers, basic-auth `Authorization`, file contents, share-link tokens, the `?goshs-info` JSON dump). - **Integrity (High):** attacker can modify responses in-flight — replace served files, inject `<script>` into HTML responses, swap offered binaries for backdoored ones. - **Availability:** not affected. ### Preconditions - Operator must be running `goshs --tunnel` / `goshs -t`. - Attacker must hold a network-on-path position between the operator and `localhost.run:22` (LAN MITM, malicious Wi-Fi, hostile ISP/VPN, BGP hijack, or DNS spoofing combined with an attacker-controlled SSH endpoint). --- ### Fix (applied in v2.0.7) `ssh.InsecureIgnoreHostKey()` has been replaced with a **Trust-On-First-Use (TOFU)** host key callback backed by `~/.config/goshs/known_hosts`. **Behaviour after the fix:** - On **first connection**: goshs accepts the host key presented by `localhost.run`, writes it to `~/.config/goshs/known_hosts` (mode `0600`), and prints two warning lines: ``` WARN tunnel: pinned new host key for localhost.run:22 (SHA256:<fingerprint>) in ~/.config/goshs/known_hosts WARN tunnel: verify with: ssh-keyscan localhost.run 2>/dev/null | ssh-keygen -l -f - ``` The operator should compare the printed fingerprint against the `ssh-keyscan` output to confirm no MITM occurred on that first connection. - On **subsequent connections**: the stored key is loaded via `golang.org/x/crypto/ssh/knownhosts` and the presented key is verified against it. A mismatch returns a typed `HostKeyMismatchError` and goshs exits immediately with: ``` FATAL tunnel: ssh: host key mismatch for localhost.run:22 — possible MITM attack. If localhost.run legitimately rotated its key, delete ~/.config/goshs/known_hosts and reconnect ``` **Files changed:** | File | Change | |------|--------| | `config/config.go` | Added `Dir()` — creates and returns `~/.config/goshs` (mode `0700`) | | `main.go` | Calls `config.Dir()` on every startup to ensure the directory exists | | `tunnel/tunnel.go` | Replaced `InsecureIgnoreHostKey()` with `buildTOFUCallback(knownHostsFile)`; added exported `HostKeyMismatchError` type | | `httpserver/server.go` | Resolves `~/.config/goshs/known_hosts` via `config.Dir()`, passes it to `tunnel.Start()`; fatal-exits on `HostKeyMismatchError` | **Implementation uses only already-vendored dependencies** (`golang.org/x/crypto/ssh/knownhosts` is part of the existing `golang.org/x/crypto` direct dependency — no new modules added).
- Published
- May 15, 2026
- Updated
- Jun 25, 2026
- EPSS
- —
- CWE
- CWE-295
Report tools
Action score
29
Low priority for now.
- CVSS
- 29 / 40 · 7.4 / 10
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 0 / 30 · —
Get told when this record changes
- Not in KEV: no record of exploitation in the wild
- No public exploit code on record
- A fix has been released
If any of these changes, we'll tell you in the daily email digest.
Check your site's encryptionRun the SSL check
Is your version affected? Check itNoroxi analysis
What does it mean in your environment?
The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.
We use this product, ask for helpAffected systems
Is your version affected?
Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.
| Vendor | Product | CPE |
|---|---|---|
| Go | goshs.de/goshs/v2 | pkg:golang/goshs.de/goshs/v2 |
Check your site's encryption
This vulnerability is about certificate validation or weak cryptography. The free SSL checker tests your certificate, enabled TLS versions and weak ciphers.
Run the SSL checkPackage-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Go | goshs.de/goshs | from 0 | — |
| Go | goshs.de/goshs/v2 | before 2.0.7 | 2.0.7 |
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| Go:goshs.de/goshs/v2 | 2.0.7 | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
Patch and commit links
Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.
Not on record for this CVE: EPSS history · researcher credit · variant or chain candidate · public bounty program.
Technical details
Attack conditions
- Anyone who can reach it over the internet can trigger it.
- No account or password is required.
- No user action is required.
- Special conditions such as timing or configuration are required.
If successful
- Confidentiality
- high · data can be read
- Integrity
- high · data or configuration can be modified
- Availability
- none
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality impact
- High
- Integrity impact
- High
- Availability impact
- None
Weakness class (CWE)
CWE-295 · Improper Certificate ValidationCVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
osv
Root cause
A certificate validation error is silently swallowed instead of terminating the connection. Often, code added for a test environment makes its way into production.
The bug in code
The whole CWE-295 classA representative example of this vulnerability class. Not the vendor's source code; it shows the faulty pattern and its fix.
Vulnerable
override fun checkServerTrusted(chain: Array<X509Certificate>, type: String) {
// Left empty for the test environment
}Fixed
val client = OkHttpClient.Builder()
.certificatePinner(
CertificatePinner.Builder()
.add("api.sirius.example", "sha256/…")
.build()
).build()Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
Attack patterns (CAPEC)
ATT&CK techniques
—
Change log (1)
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
Show all references (3 more)Show less
Vendor advisories and official records. Exploit/PoC links are deliberately left out.