{"id":"CVE-2026-113440","aliases":["CVE-2026-113440","EEF-CVE-2026-113440"],"related":[],"kind":"vulnerability","state":"published","title":"HTTP/1.1 and HTTP/2 redirects resend basic_auth and cookie to a different scheme or port in hackney","summary":"Insufficiently Protected Credentials vulnerability in hackney in benoitc hackney allows a redirecting server to obtain the basic_auth and cookie credentials of a request via a same-host redirect to another scheme or port. With follow_redirect enabled, hackney:follow_redirect/10 in src/hackney.erl reissues the request to the Location target after hackney:maybe_strip_auth_on_redirect/3, which compared only the hostname of the current and the redirect URL. A redirect from https to http on the same host resent the Authorization and Cookie headers in cleartext, where an on-path attacker can read them, and a redirect to another port on the same host handed them to a different service. location_trusted forwards credentials to any target by design and is unchanged.\n\nThis issue affects hackney: from 2.0.0 before 4.9.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Insufficiently Protected Credentials vulnerability in hackney in benoitc hackney allows a redirecting server to obtain the basic_auth and cookie credentials of a request via a same-host redirect to another scheme or port. With follow_redirect enabled, hackney:follow_redirect/10 in src/hackney.erl reissues the request to the Location target after hackney:maybe_strip_auth_on_redirect/3, which compared only the hostname of the current and the redirect URL. A redirect from https to http on the same host resent the Authorization and Cookie headers in cleartext, where an on-path attacker can read them, and a redirect to another port on the same host handed them to a different service. location_trusted forwards credentials to any target by design and is unchanged.\n\nThis issue affects hackney: from 2.0.0 before 4.9.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nInsufficiently Protected Credentials vulnerability in `hackney` in benoitc hackney allows a redirecting server to obtain the `basic_auth` and `cookie` credentials of a request via a same-host redirect to another scheme or port. With `follow_redirect` enabled, `hackney:follow_redirect/10` in `src/hackney.erl` reissues the request to the `Location` target after `hackney:maybe_strip_auth_on_redirect/3`, which compared only the hostname of the current and the redirect URL. A redirect from `https` to `http` on the same host resent the `Authorization` and `Cookie` headers in cleartext, where an on-path attacker can read them, and a redirect to another port on the same host handed them to a different service. `location_trusted` forwards credentials to any target by design and is unchanged.\n\nThis issue affects hackney: from 2.0.0 before 4.9.0.\n\n## Details\n\n**1. Redirect handling.** With `follow_redirect` set, `hackney:request/5` hands a 3xx response to `hackney:follow_redirect/10` in `src/hackney.erl`, which resolves the `Location` header against the current URL and calls `hackney:request/5` again with the caller's options and an empty header list. HTTP/1.1 and HTTP/2 share this path.\n\n**2. Host-only comparison.** Before the new request, `hackney:maybe_strip_auth_on_redirect/3` removes the `basic_auth` and `cookie` options when the redirect leaves the current host, unless `location_trusted` is set. It compared `#hackney_url.host` of the two URLs.\n\n**3. Consequence.** A redirect that keeps the hostname but changes the scheme or the port passes the check, so the new request carries the same `Authorization` and `Cookie` headers. From `https` to `http` they travel in cleartext; to another port they reach a different service on the same host.\n\n## Impact\n\nA server that answers a credentialed request with a same-host redirect to plain HTTP exposes the client's `Authorization` and `Cookie` headers to anyone on the network path, and a redirect to another port delivers them to whatever service listens there. The captured values can be replayed against the original origin.\n\n## Workarounds\n\nDisable `follow_redirect` and handle the `Location` header in the application, or pass the credentials as explicit `Authorization` and `Cookie` request headers instead of the `basic_auth` and `cookie` options. `hackney:follow_redirect/10` issues the redirected request with an empty header list, so explicit headers reach the first server only.\n\n## Configurations\n\nThe request is made with `follow_redirect` enabled and the `basic_auth` or `cookie` option set, over HTTP/1.1 or HTTP/2, without `location_trusted`. Credentials passed as explicit request headers are not forwarded on redirects and are not affected.","format":"markdown","source":"eef"}],"published":"2026-10-26T13:49:17.377Z","modified":"2026-11-25T06:30:06.748Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6,"rating":"MEDIUM"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6,"rating":"MEDIUM"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"}],"cwes":["CWE-522"],"affected":[{"ranges":[{"type":"semver","introduced":"2.0.0","fixed":"4.9.0","status":"affected"}],"vendor":"benoitc","product":"hackney","package":"hackney","cpe":"cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*","repo":"https://github.com/benoitc/hackney","source":"cvelist"},{"ranges":[{"type":"git","introduced":"8f944559bdb83da60b5c06f6cf6d842591278364","fixed":"6548384b22ea196023a1963e2967d5715b6d9564","status":"affected"}],"vendor":"benoitc","product":"hackney","package":"benoitc/hackney","cpe":"cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*","repo":"https://github.com/benoitc/hackney","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.0.0","status":"affected","fixed":"4.9.0"}],"ecosystem":"Hex","package":"hackney","purl":"pkg:hex/hackney","source":"eef"},{"ranges":[{"type":"git","introduced":"8f944559bdb83da60b5c06f6cf6d842591278364","status":"affected","fixed":"6548384b22ea196023a1963e2967d5715b6d9564"}],"repo":"https://github.com/benoitc/hackney","source":"eef"}],"references":[{"url":"https://github.com/benoitc/hackney/releases/tag/4.9.0","tags":["advisory","related","vendor-advisory"],"sources":["cvelist","eef","nvd"]},{"url":"https://cna.erlef.org/cves/CVE-2026-113440.html","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-113440","tags":["related"],"sources":["cvelist","nvd"]},{"url":"https://github.com/benoitc/hackney/pull/979","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/benoitc/hackney/commit/8f944559bdb83da60b5c06f6cf6d842591278364","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/benoitc/hackney/commit/6548384b22ea196023a1963e2967d5715b6d9564","tags":["fix","patch"],"sources":["cvelist","eef","nvd"]},{"url":"https://hex.pm/packages/hackney","tags":["package"],"sources":["eef"]}],"credits":["Martin Karrer","Jonatan Männchen / EEF","Benoit Chesneau"],"assigner":"EEF","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-02T21:11:36.228Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-113440","url":"https://www.cve.org/CVERecord?id=CVE-2026-113440","licence":"CVE Terms of Use","modified":"2026-11-19T08:07:01.433Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-113440","url":"https://osv.dev/vulnerability/EEF-CVE-2026-113440","licence":"CC-BY-4.0","modified":"2026-11-25T06:30:06.748Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-113440","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-113440","licence":"Public domain","modified":"2026-11-02T22:17:18.147Z"}],"updatedAt":"2026-11-25T22:59:47.119Z","epss":{"score":0.00415,"percentile":0.37794,"date":"2026-12-01T12:00:22.000Z"}}