CVE-2025-71405: Github.com/go chi/chi/v5 Chi Allows Host Header Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-vrw8-fxc6-2r93
CWE-601
Published
Advisory Summary

CVE-2025-71405 is a MODERATE chi allows host header injection vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Github.com/go chi/chi/v5 libraries in the Go ecosystem. The issue involves chi allows host header injection which leads to open redirect in redirectslashes. Remediation is available by upgrading affected packages to version 5.2.2.

CVE-2025-71405 at a Glance

CVE Identifier CVE-2025-71405
GHSA Identifier GHSA-vrw8-fxc6-2r93
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Github.com/go chi/chi/v5
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-71405

To remediate this vulnerability, upgrade all affected Github.com/go chi/chi/v5 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/go-chi/chi/v5 fixed: 5.2.2
Upgrade github.com/go-chi/chi/v5 to 5.2.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/go-chi/chi/v5

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-71405, inspect your project dependencies for Github.com/go chi/chi/v5:

inspect dependencies for github.com/go-chi/chi/v5

Analyze the terminal output to locate any version of Github.com/go chi/chi/v5 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.2.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Github.com/go chi/chi/v5, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The RedirectSlashes function in middleware/strip.go is vulnerable to host header injection which leads to open redirect. We consider this a **lower-severity** open redirect, as it can't be exploited from browsers or email clients (requires manipulation of a Host header). ### Details The RedirectSlashes method uses the Host header to construct the redirectURL at this line https://github.com/go-chi/chi/blob/master/middleware/strip.go#L55 The Host header can be manipulated by a user to be any arbitrary host. This leads to open redirect when using the RedirectSlashes middleware ### PoC Create a simple server which uses the RedirectSlashes middleware ``` package main import ( "fmt" "net/http" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" // Import the middleware package ) func main() { // Create a new Chi router r := chi.NewRouter() // Use the built-in RedirectSlashes middleware r.Use(middleware.RedirectSlashes) // Use middleware.RedirectSlashes // Define a route handler r.Get("/", func(w http.ResponseWriter, r *http.Request) { // A simple response w.Write([]byte("Hello, World!")) }) // Start the server fmt.Println("Starting server on :8080") http.ListenAndServe(":8080", r) } ``` Run the server `go run main.go` Once the server is running, send a request that will trigger the RedirectSlashes function with an arbitrary Host header `curl -iL -H "Host: example.com" http://localhost:8080/test/` Observe that the request will be redirected to example.com ``` curl -L -H "Host: example.com" http://localhost:8080/test/ <!doctype html> <html> <head> <title>Example Domain</title> <meta charset="utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style type="text/css"> body { background-color: #f0f0f2; margin: 0; padding: 0; font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; ... snipped ... ``` Without the host header, the response is returned from the test server ``` curl -L http://localhost:8080/test/ 404 page not found ``` ### Impact An open redirect vulnerability allows attackers to trick users into visiting malicious sites. This can lead to phishing attacks, credential theft, and malware distribution, as users trust the application’s domain while being redirected to harmful sites. ### Potential mitigation It seems that the purpose of the RedirectSlashes function is to redirect within the same application. In that case r.RequestURI can be used instead of r.Host by default. If there is a use case to redirect to a different host, a flag can be added to use the Host header instead. As this flag will be controlled by the developer they will make the decision of allowing redirects to arbitrary hosts based on their judgement.

CVE-2025-71405 Affected Github.com/go chi/chi/v5 Versions

1 component(s)
Fixed Versions:
5.2.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/go-chi/chi/v5
Go
< 5.2.2
5.2.2

References

Frequently Asked Questions

What is CVE-2025-71405?
CVE-2025-71405 is a security vulnerability in Github.com/go chi/chi/v5 involving chi Allows Host Header Injection which Leads to Open Redirect in RedirectSlashes under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Github.com/go chi/chi/v5 versions are affected?
Affected versions include releases prior to 5.2.2 across affected packages: github.com/go-chi/chi/v5.
What version fixes CVE-2025-71405?
Upgrading to 5.2.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/go-chi/chi/v5 affected?
Yes, github.com/go-chi/chi/v5 is affected in releases prior to 5.2.2. Upgrade your dependency to 5.2.2 or later.
What CWE is associated with CVE-2025-71405?
CVE-2025-71405 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check Go dependencies for CVE-2025-71405?
Run the dependency tree command: 'inspect dependencies for github.com/go-chi/chi/v5'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vrw8-fxc6-2r93",
  "modified" : "2026-10-02T23:17:44Z",
  "published" : "2025-06-20T16:37:47Z",
  "aliases" : [ "CVE-2025-71405" ],
  "summary" : "chi Allows Host Header Injection which Leads to Open Redirect in RedirectSlashes",
  "details" : "### Summary\nThe RedirectSlashes function in middleware/strip.go is vulnerable to host header injection which leads to open redirect.\n\nWe consider this a **lower-severity** open redirect, as it can't be exploited from browsers or email clients (requires manipulation of a Host header).\n\n### Details\nThe RedirectSlashes method uses the Host header to construct the redirectURL at this line https://github.com/go-chi/chi/blob/master/middleware/strip.go#L55\n\nThe Host header can be manipulated by a user to be any arbitrary host. This leads to open redirect when using the RedirectSlashes middleware\n\n### PoC\nCreate a simple server which uses the RedirectSlashes middleware\n```\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\" // Import the middleware package\n)\n\nfunc main() {\n\t// Create a new Chi router\n\tr := chi.NewRouter()\n\n\t// Use the built-in RedirectSlashes middleware\n\tr.Use(middleware.RedirectSlashes) // Use middleware.RedirectSlashes\n\n\t// Define a route handler\n\tr.Get(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\t// A simple response\n\t\tw.Write([]byte(\"Hello, World!\"))\n\t})\n\n\t// Start the server\n\tfmt.Println(\"Starting server on :8080\")\n\thttp.ListenAndServe(\":8080\", r)\n}\n```\nRun the server `go run main.go`\n\nOnce the server is running, send a request that will trigger the RedirectSlashes function with an arbitrary Host header\n`curl -iL -H \"Host: example.com\" http://localhost:8080/test/`\n\nObserve that the request will be redirected to example.com\n\n```\ncurl -L -H \"Host: example.com\" http://localhost:8080/test/\n\n<!doctype html>\n<html>\n<head>\n    <title>Example Domain</title>\n\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <style type=\"text/css\">\n    body {\n        background-color: #f0f0f2;\n        margin: 0;\n        padding: 0;\n        font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n... snipped ...\n```\nWithout the host header, the response is returned from the test server\n```\ncurl -L http://localhost:8080/test/\n\n404 page not found\n```\n\n### Impact\nAn open redirect vulnerability allows attackers to trick users into visiting malicious sites. This can lead to phishing attacks, credential theft, and malware distribution, as users trust the application’s domain while being redirected to harmful sites.\n\n### Potential mitigation\nIt seems that the purpose of the RedirectSlashes function is to redirect within the same application. In that case r.RequestURI can be used instead of r.Host by default. If there is a use case to redirect to a different host, a flag can be added to use the Host header instead. As this flag will be controlled by the developer they will make the decision of allowing redirects to arbitrary hosts  based on their judgement.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-chi/chi/v5"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-chi/chi/security/advisories/GHSA-vrw8-fxc6-2r93"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-71405"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-chi/chi/commit/1be7ad938cc9c5b39a9dea01a5c518848928ab65"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-chi/chi"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/go-chi-chi-before-open-redirect-via-redirectslashes"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-06-20T16:37:47Z",
    "nvd_published_at" : null
  }
}