CVE-2026-42091: goshs has Cross-Origin Arbitrary File Write via Missing CSRF on PUT and Wildcard CORS
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.
Published Apr 23, 2026 · Updated May 4, 2026
Affected packages
github.com/patrickhener/goshs/v2
- Ecosystem
- Go
- Affected
- < 2.0.2
- Fixed in
- 2.0.2
- Check
go list -m github.com/patrickhener/goshs/v2
github.com/patrickhener/goshs
- Ecosystem
- Go
- Affected
- <= 1.1.4
- Fixed in
- No patched version yet
- Check
go list -m github.com/patrickhener/goshs
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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
Impact
- Arbitrary file write to the goshs webroot from any website the victim visits
- File overwrite — existing files can be silently replaced
References
- https://github.com/patrickhener/goshs/security/advisories/GHSA-rhf7-wvw3-vjvm
- https://nvd.nist.gov/vuln/detail/CVE-2026-42091
- https://github.com/patrickhener/goshs/commit/0e715b94e10c3d1aa552276000f15f104dee2f32
- https://github.com/patrickhener/goshs/releases/tag/v2.0.2
- https://github.com/advisories/GHSA-rhf7-wvw3-vjvm
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-54719
goshs: File-based .goshs ACL authorization bypass via the ?bulk zip-download route (unauthenticated read; residual of GHSA-wvhv-qcqf-f3cx)
high7.5No fixJul 28, 2026CVE-2026-62325
goshs SFTP authentication bypass via empty password (incomplete fix of CVE-2026-40884)
critical9.1Jul 28, 2026CVE-2026-64863
goshs --no-delete WebDAV MOVE bypass allows file deletion/overwrite
critical9.1No fixJul 28, 2026CVE-2026-66063
goshs has a Path Traversal issue
medium6.5No fixJul 28, 2026CVE-2026-66064
goshs has ACL Bypass & Path Traversal
medium5.3No fixJul 28, 2026CVE-2026-40876
SFTP root escape via prefix-based path validation in goshs
high8.8No fixApr 14, 2026
