# CVE-2026-42091: goshs has Cross-Origin Arbitrary File Write via Missing CSRF on PUT and Wildcard CORS

> Attackers can write arbitrary files to goshs instances via CSRF and wildcard CORS, bypassing network isolation to modify data or execute code.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 4 May 2026
- **Updated:** 5 May 2026
- **Also known as:** GHSA-rhf7-wvw3-vjvm, GO-2026-5625

## What is CVE-2026-42091?

CVE-2026-42091 is a medium-severity vulnerability in patrickhener goshs, published on 4 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

goshs is a SimpleHTTPServer written in Go. Prior to version 2.0.2, the PUT upload handler (httpserver/updown.go) lacks the CSRF token validation that was added to the POST upload handler during the CVE-2026-40883 fix. Combined with the unconditional Access-Control-Allow-Origin: * on the OPTIONS preflight handler (httpserver/server.go), any website can write arbitrary files to a goshs instance through the victim's browser — bypassing network isolation (e.g. localhost, internal network). This issue has been patched in version 2.0.2.

Weakness: CWE-352 (Cross-Site Request Forgery)

## Which versions are affected by CVE-2026-42091?

7 open source packages ship an affected version, including github.com/patrickhener/goshs, github.com/patrickhener/goshs/v2 and goshs.de/goshs. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/patrickhener/goshs` | Go | All versions | None |
| `github.com/patrickhener/goshs` | Go | All versions to 1.1.4 | None |
| `github.com/patrickhener/goshs` | Go | All versions to 1.1.4 | None |
| `github.com/patrickhener/goshs/v2` | Go | All versions | 2.0.2 |
| `github.com/patrickhener/goshs/v2` | Go | All versions | 2.0.2 |
| `goshs.de/goshs` | Go | All versions | None |
| `goshs.de/goshs/v2` | Go | All versions | 2.0.2 |

Products: Goshs Goshs.

## How do I fix CVE-2026-42091?

Upgrade to a fixed version.

## Is CVE-2026-42091 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-42091 exists.

## Other vulnerabilities in patrickhener goshs

- [CVE-2026-40884](https://insights.sbomify.com/CVE-2026-40884/): goshs: Empty-username SFTP password authentication bypass in goshs (critical 9.8)
- [CVE-2026-35392](https://insights.sbomify.com/CVE-2026-35392/): goshs has an Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in goshs PUT Upload (critical 9.8)
- [CVE-2026-35393](https://insights.sbomify.com/CVE-2026-35393/): Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in goshs POST multipart upload (critical 9.8)
- [CVE-2026-35471](https://insights.sbomify.com/CVE-2026-35471/): Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in goshs (critical 9.8)
- [CVE-2026-40189](https://insights.sbomify.com/CVE-2026-40189/): goshs has a file-based ACL authorization bypass in goshs state-changing routes (critical 9.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-42091 and fix it if it is affected.

What it is: CVE-2026-42091 is a medium-severity vulnerability in patrickhener goshs, published on 4 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-42091 exists.

Affected packages and fixed versions:
- github.com/patrickhener/goshs (Go): affected all versions; no fix listed
- github.com/patrickhener/goshs (Go): affected all versions up to 1.1.4; no fix listed
- github.com/patrickhener/goshs (Go): affected all versions up to 1.1.4; no fix listed
- github.com/patrickhener/goshs/v2 (Go): affected all versions; fixed in 2.0.2
- github.com/patrickhener/goshs/v2 (Go): affected all versions; fixed in 2.0.2
- goshs.de/goshs (Go): affected all versions; no fix listed
- goshs.de/goshs/v2 (Go): affected all versions; fixed in 2.0.2

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

## Sources

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

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