6.5medium
goshs has Cross-Origin Arbitrary File Write via Missing CSRF on PUT and Wildcard CORS
- Severity
- 6.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.17% (higher than 6% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-rhf7-wvw3-vjvmGO-2026-5625
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| patrickhener goshs | < 2.0.2 | CVE List |
| github.com/patrickhener/goshs/v2 (Go) | before 2.0.2 | GitHub Advisory Database |
| github.com/patrickhener/goshs (Go) | up to 1.1.4, all versions | GitHub Advisory Database, Go Vulnerability Database |
| goshs.de/goshs (Go) | all versions | Go Vulnerability Database |
| goshs.de/goshs/v2 (Go) | before 2.0.2 | Go Vulnerability Database |
| goshs goshs | before 2.0.2 | NVD |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
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.
GitHub Advisory Database
Summary
The PUT upload handler (httpserver/updown.go) lacks the CSRF token validation that was added to the POST upload handler during the GHSA-jrq5-hg6x-j6g3 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).
Details
Root Cause 1 — Missing CSRF on PUT (httpserver/updown.go:19)
When GHSA-jrq5-hg6x-j6g3 was fixed (commit e3c3d37), checkCSRF() was added to the POST upload() function (line 78) but not to the PUT put() function directly above it in the same file. This means PUT requests are accepted without any CSRF token.
// POST — protected
func (fs *FileServer) upload(w http.ResponseWriter, req *http.Request) {
if !fs.checkCSRF(w, req) { return }
// ...
}
// PUT — unprotected
func (fs *FileServer) put(w http.ResponseWriter, req *http.Request) {
// No checkCSRF call
// ...
}
Root Cause 2 — Wildcard CORS (httpserver/server.go:126)
The OPTIONS handler unconditionally returns permissive CORS headers:
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "POST, PUT, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
This allows any website's JavaScript to pass the browser's CORS preflight check and send PUT requests to the goshs server.
PoC
Please extract the uploaded compressed file before proceeding
- bash poc.sh 스크린샷 2026-04-17 오후 11 08 13
Impact
- Arbitrary file write to the goshs webroot from any website the victim visits
- File overwrite — existing files can be silently replaced
Go Vulnerability Database
goshs has Cross-Origin Arbitrary File Write via Missing CSRF on PUT and Wildcard CORS in github.com/patrickhener/goshs
NVD (es)
goshs es un SimpleHTTPServer escrito en Go. Antes de la versión 2.0.2, el gestor de subida PUT (httpserver/updown.go) carece de la validación de token CSRF que se añadió al gestor de subida POST durante la corrección de CVE-2026-40883. Combinado con el Access-Control-Allow-Origin: * incondicional en el gestor de pre-vuelo OPTIONS (httpserver/server.go), cualquier sitio web puede escribir archivos arbitrarios en una instancia de goshs a través del navegador de la víctima - eludiendo el aislamiento de red (p. ej., localhost, red interna). Este problema ha sido parcheado en la versión 2.0.2.
References
| https://github.com/patrickhener/goshs/security/advisories/GHSA-rhf7-wvw3-vjvm | advisory, exploit, vendor-advisory, web | |
| https://github.com/patrickhener/goshs/commit/0e715b94e10c3d1aa552276000f15f104dee2f32 | fix, patch, web | |
| https://github.com/patrickhener/goshs/releases/tag/v2.0.2 | product, release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-42091 | advisory | |
| https://github.com/patrickhener/goshs | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-42091 changed 2026-05-05 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-rhf7-wvw3-vjvm changed 2026-06-25 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-5625 changed 2026-06-25 | CC-BY-4.0 |
| NVD | CVE-2026-42091 changed 2026-10-26 | Public domain |