{"id":"CVE-2025-69725","aliases":["CVE-2025-69725","GHSA-mqqf-5wvp-8fh8","GO-2026-4316"],"related":["CVE-2026-122132","CGA-76m3-5fxv-q2q2"],"kind":"vulnerability","state":"published","title":"chi has an open redirect vulnerability in the RedirectSlashes middleware","summary":"An Open Redirect vulnerability in the go-chi/chi >=5.2.2 RedirectSlashes function allows remote attackers to redirect victim users to malicious websites using the legitimate website domain.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"An Open Redirect vulnerability in the go-chi/chi >=5.2.2 RedirectSlashes function allows remote attackers to redirect victim users to malicious websites using the legitimate website domain.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe `RedirectSlashes` function in middleware/strip.go does not perform correct input validation and can lead to an open redirect vulnerability.\n\n### Details\n\nThe `RedirectSlashes` function performs a `Trim` to all forward slash (`/`) characters, while prepending a single one at the begining of the path (Line 52).\n\nHowever, it does not trim backslashes (`\\`).\n\n```go\nFile: middleware/strip.go\n41: func RedirectSlashes(next http.Handler) http.Handler {\n...\n51: \t\t\t// Trim all leading and trailing slashes (e.g., \"//evil.com\", \"/some/path//\")\n52: \t\t\tpath = \"/\" + strings.Trim(path, \"/\")\n...\n62: }\n```\n\nAlso, from version 5.2.2 onwards the `RedirectSlashes` function does not take into consideration the `Host` Header in the redirect response returned. This was done in order to combat another [[vulnerability](https://github.com/go-chi/chi/security/advisories/GHSA-vrw8-fxc6-2r93)](https://github.com/go-chi/chi/security/advisories/GHSA-vrw8-fxc6-2r93).\n\nThe above make it possible for a response in the following form:\n\n```\nHTTP/1.1 301 Moved Permanently\nLocation: /\\evil.com\n```\n\nThe `/\\evil.com` will be transformed by most browsers (Chrome, Firefox, etc. not Safari) into `//evil.com` which is a protocol relative URL and will result in a redirect to `evil.com`, essentially making it an open redirect vulnerability.\n\n### PoC\n\nA minimal working example can be seen below.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/go-chi/chi/v5\"\n\t\"github.com/go-chi/chi/v5/middleware\"\n)\n\n\n\nfunc main() {\n\tr := chi.NewRouter()\n\n\tr.Use(middleware.RedirectSlashes)\n\n\tr.Get(\"/*\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t})\n\n\tfmt.Println(\"Server starting on port 8081...\")\n\tif err := http.ListenAndServe(\":8081\", r); err != nil {\n\t\tfmt.Printf(\"Error starting server: %v\\n\", err)\n\t}\n}\n\n```\n\nAnd when we request the path `/\\evil.com` (needs a second backslash or URL encoding in the terminal), the HTTP Redirect Location is just `/\\evil.com` without any domain/Host information.\n\n```bash\n$ curl -I  localhost:8081/\\\\evil.com/\nHTTP/1.1 301 Moved Permanently\nContent-Type: text/html; charset=utf-8\nLocation: /\\evil.com\n```\n\n```bash\n$ curl -I  localhost:8081/%5Cevil.com/\nHTTP/1.1 301 Moved Permanently\nContent-Type: text/html; charset=utf-8\nLocation: /\\evil.com\n```\n\nThis opened in a browser (Chrome, Firefox) will result in a transformation to `//evil.com` which in turn will result in a redirect to `evil.com`.\n<img width=\"200\" alt=\"image-20250829115619807\" src=\"https://github.com/user-attachments/assets/44aedad1-64b6-4660-8b26-fad9b4eca036\" />\n\n\n<img width=\"200\" alt=\"image-20250829115632067\" src=\"https://github.com/user-attachments/assets/b976d47d-1975-469c-abd3-deb907a68db2\" />\n\n\n### Impact\n\nThis essentially consists of an open redirect vulnerability, provided that victim users use the most popular browsers (Chrome, Firefox, etc. It does not work in e.g. Safari).\n\nThe attacker can construct a malicious URL on a domain of a legitimate website and send it to the victim user. The victim users thinking that they will click on a legitimate website's URL, they will unknowingly be reidrected to an attacker controlled website.\n\nThis can lead to credential theft if the victim gets redirected to a phishing website, to malware that is hosted on the attacker controlled website etc. Also, it has a greate reputation / business impact for the affected legitimate website.\n\nIn order to exploit this vulnerability the attacker does not need to be authenticated or have ay other priviledge / knowledge regarding the affected application.\n\nCVSS Score: [4.7 (Medium)](https://www.first.org/cvss/calculator/3-0#CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N)","format":"markdown","source":"ghsa"},{"lang":"en","text":"Open redirect vulnerability in the RedirectSlashes middleware in github.com/go-chi/chi","format":"markdown","source":"go"},{"lang":"es","text":"Una vulnerabilidad de redirección abierta en la función RedirectSlashes de go-chi/chi &gt;=5.2.2 permite a atacantes remotos redirigir a usuarios víctimas a sitios web maliciosos utilizando el dominio del sitio web legítimo.","source":"nvd"}],"published":"2026-01-14T21:18:06.000Z","modified":"2026-11-05T10:55:55.386Z","severity":{"scorer":"mitre","scheme":"CVSS:3.1","vector":"CVSS:3.1/AC:L/AV:N/A:N/C:L/I:N/PR:N/S:C/UI:R","score":4.7,"rating":"MEDIUM"},"severities":[{"scorer":"mitre","scheme":"CVSS:3.1","vector":"CVSS:3.1/AC:L/AV:N/A:N/C:L/I:N/PR:N/S:C/UI:R","score":4.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N","score":4.7,"rating":"MEDIUM"}],"cwes":["CWE-601"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"5.2.2","status":"affected","fixed":"5.2.4"}],"ecosystem":"Go","package":"github.com/go-chi/chi/v5","purl":"pkg:golang/github.com/go-chi/chi/v5","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/go-chi/chi","purl":"pkg:golang/github.com/go-chi/chi","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/go-chi/chi/v2","purl":"pkg:golang/github.com/go-chi/chi/v2","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/go-chi/chi/v3","purl":"pkg:golang/github.com/go-chi/chi/v3","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/go-chi/chi/v4","purl":"pkg:golang/github.com/go-chi/chi/v4","source":"go"},{"ranges":[{"type":"semver","introduced":"5.2.2","status":"affected","fixed":"5.2.4"}],"ecosystem":"Go","package":"github.com/go-chi/chi/v5","purl":"pkg:golang/github.com/go-chi/chi/v5","source":"go"}],"references":[{"url":"https://github.com/go-chi/chi/security/advisories/GHSA-mqqf-5wvp-8fh8","tags":["advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-69725","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/go-chi/chi/issues/1037","tags":["report","web"],"sources":["ghsa","go"]},{"url":"https://github.com/go-chi/chi/commit/6eb35881c0e438ffb663ddbad3a61babaa5e5d8a","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/go-chi/chi","tags":["package"],"sources":["ghsa"]},{"url":"http://go-chichi.com","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"mitre","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-02-23T13:55:49.176Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-69725","url":"https://www.cve.org/CVERecord?id=CVE-2025-69725","licence":"CVE Terms of Use","modified":"2026-07-05T01:29:10.470Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mqqf-5wvp-8fh8","url":"https://github.com/advisories/GHSA-mqqf-5wvp-8fh8","licence":"CC-BY-4.0","modified":"2026-11-05T10:55:55.386Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4316","url":"https://pkg.go.dev/vuln/GO-2026-4316","licence":"CC-BY-4.0","modified":"2026-11-05T10:55:55.386Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-69725","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-69725","licence":"Public domain","modified":"2026-07-05T02:17:37.113Z"}],"updatedAt":"2026-11-25T22:59:11.367Z","epss":{"score":0.00264,"percentile":0.19576,"date":"2026-12-01T12:00:22.000Z"}}