Am I affected?
Description
Interpretation Conflict vulnerability in hackney_url in benoitc hackney allows Server Side Request Forgery via a percent-encoded bracketed IPv6 literal or an IP literal with a trailing dot. A host such as %5B%3A%3Affff%3A127%2E0%2E0%2E1%5D (decoding to [::ffff:127.0.0.1]) or 127.0.0.1. is not an IP address to a caller's allowlist built on uri_string:parse/1 and inet:parse_address/1, while hackney connects to the address it denotes. The same applies to a Location target when redirects are followed.
The IP-literal gate that hackney_url:normalize/2 applies to a percent-decoded host, added to close the percent-encoded IP bypass of CVE-2026-47076, passes the decoded value to inet_parse:address/1 as is. The connect path in hackney_happy:parse_address/1 drops a surrounding bracket pair, and the resolver ignores a trailing dot, so both forms pass the gate and still reach the literal address. Domain names with a trailing dot and unencoded IPv6 literals are not affected.
This issue affects hackney: from 4.0.1 before 4.9.0.
Technical analysis
1. The gate. hackney_url:normalize/2 in src/hackney_url.erl percent-decodes a host that is not already an IP literal and raises invalid_url_host when inet_parse:address/1 accepts the decoded value. This closed the plain percent-encoded IP case.
2. What the connect path accepts. hackney_happy:parse_address/1 removes a surrounding [...] pair before calling inet:parse_address/1, and the resolver treats a trailing dot as the root label. Neither form is accepted by inet_parse:address/1, so [::ffff:127.0.0.1] and 127.0.0.1. pass the gate.
3. Result. A percent-encoded bracketed IPv6 literal such as %5B%3A%3Affff%3A127%2E0%2E0%2E1%5D, or an IPv4 literal with a trailing dot, is not an IP address to a caller's check based on uri_string:parse/1 and inet:parse_address/1, but hackney connects to the address it denotes. The same applies to a Location target when redirects are followed. The fix strips one bracket pair and one trailing dot in ip_candidate/1 before the gate.
Weaknesses & attack patterns
Weakness
CWE-436
·
Interpretation Conflict
in catalog →
MITRE ↗
CWE-918
·
Server-Side Request Forgery (SSRF)
in catalog →
MITRE ↗
Attack patterns
CAPEC-664
·
Server Side Request Forgery
MITRE ↗
An application that checks user-supplied URLs against an IP allowlist before handing them to hackney can be made to request loopback, link-local metadata and private-network addresses that the allowlist rejects when they are written plainly.
Affected — Hex / hackney Hex.pm ↗ Repository ↗
modules · source files · routines
Affected — GitHub / benoitc/hackney Repository ↗
modules · source files · routines
Workarounds
Run the allowlist on the host that hackney_url:normalize/1 returns for the parsed URL, and strip a surrounding bracket pair and a trailing dot from it before the IP check, so the check sees the same address the connect path uses.
Configurations
The application passes URLs that an untrusted party can influence to hackney and relies on its own host allowlist, built on uri_string:parse/1 or inet:parse_address/1, to keep requests away from internal addresses.
References
Credits
CVSS breakdown
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N