{"id":"CVE-2026-42091","aliases":["CVE-2026-42091","GHSA-rhf7-wvw3-vjvm","GO-2026-5625"],"related":[],"kind":"vulnerability","state":"published","title":"goshs has Cross-Origin Arbitrary File Write via Missing CSRF on PUT and Wildcard CORS","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe 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).\n\n### Details\n**Root Cause 1 — Missing CSRF on PUT** (`httpserver/updown.go:19`)\n\nWhen 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.\n\n```go\n// POST — protected \nfunc (fs *FileServer) upload(w http.ResponseWriter, req *http.Request) {\n    if !fs.checkCSRF(w, req) { return }\n    // ...\n}\n\n// PUT — unprotected \nfunc (fs *FileServer) put(w http.ResponseWriter, req *http.Request) {\n    // No checkCSRF call\n    // ...\n}\n```\n\n**Root Cause 2 — Wildcard CORS** (`httpserver/server.go:126`)\n\nThe OPTIONS handler unconditionally returns permissive CORS headers:\n\n```go\nw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\nw.Header().Set(\"Access-Control-Allow-Methods\", \"POST, PUT, OPTIONS\")\nw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, Authorization\")\n```\n\nThis allows any website's JavaScript to pass the browser's CORS preflight check and send PUT requests to the goshs server.\n\n### PoC\n[poc.zip](https://github.com/user-attachments/files/26828829/poc.zip)\n\nPlease extract the uploaded compressed file before proceeding\n\n1. bash poc.sh\n<img width=\"543\" height=\"376\" alt=\"스크린샷 2026-04-17 오후 11 08 13\" src=\"https://github.com/user-attachments/assets/a695cbc8-133e-4e80-a2f5-9fe9fd36b569\" />\n\n\n\n\n### Impact\n- Arbitrary file write to the goshs webroot from any website the victim visits\n- File overwrite — existing files can be silently replaced","format":"markdown","source":"ghsa"},{"lang":"en","text":"goshs has Cross-Origin Arbitrary File Write via Missing CSRF on PUT and Wildcard CORS in github.com/patrickhener/goshs","format":"markdown","source":"go"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-04-23T14:28:14.000Z","modified":"2026-10-26T19:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-352"],"affected":[{"ranges":[{"version":"< 2.0.2","status":"affected"}],"vendor":"patrickhener","product":"goshs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.2"}],"ecosystem":"Go","package":"github.com/patrickhener/goshs/v2","purl":"pkg:golang/github.com/patrickhener/goshs/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"1.1.4"}],"ecosystem":"Go","package":"github.com/patrickhener/goshs","purl":"pkg:golang/github.com/patrickhener/goshs","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/patrickhener/goshs","purl":"pkg:golang/github.com/patrickhener/goshs","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"goshs.de/goshs","purl":"pkg:golang/goshs.de/goshs","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.0.2"}],"ecosystem":"Go","package":"goshs.de/goshs/v2","purl":"pkg:golang/goshs.de/goshs/v2","source":"go"},{"ranges":[{"status":"affected","fixed":"2.0.2"}],"vendor":"goshs","product":"goshs","cpe":"cpe:2.3:a:goshs:goshs:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/patrickhener/goshs/security/advisories/GHSA-rhf7-wvw3-vjvm","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/patrickhener/goshs/commit/0e715b94e10c3d1aa552276000f15f104dee2f32","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/patrickhener/goshs/releases/tag/v2.0.2","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42091","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/patrickhener/goshs","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-05-05T13:07:28.351Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42091","url":"https://www.cve.org/CVERecord?id=CVE-2026-42091","licence":"CVE Terms of Use","modified":"2026-05-05T14:14:46.121Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rhf7-wvw3-vjvm","url":"https://github.com/advisories/GHSA-rhf7-wvw3-vjvm","licence":"CC-BY-4.0","modified":"2026-06-25T23:11:45.118Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5625","url":"https://pkg.go.dev/vuln/GO-2026-5625","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:36.496Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42091","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42091","licence":"Public domain","modified":"2026-10-26T19:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:20.542Z","epss":{"score":0.00171,"percentile":0.06839,"date":"2026-12-01T12:00:22.000Z"}}