Skip to content
Medium 4.8

Addressable URI userinfo setters store delimiters raw, so the serialized URI names a different host

CVE-2026-141538 First seen on SecPulse

Affected packages

PackageAffected → Fixed
sporkmongeraddressable —
RubyGemsaddressable
< 2.10.0→ 2.10.0
Original description The description as published by the source.

Impact

Addressable::URI#user=, #password=, #userinfo= and the matching Addressable::URI.new options store the value they are given without encoding or rejecting delimiters. A value containing /, ? or # ends the userinfo early when the URI is serialized, so #to_s names a different host than #host and #origin report.

The URI object keeps the component as assigned, and its own accessors agree with each other: host is the host the application set, and origin is built from it. #to_s joins the components with their delimiters but doesn't encode them, so user = "alice@evil.example/" serializes as https://alice@evil.example/@api.example.com/…. Addressable and Ruby's URI both read evil.example as the host of that string. A [ or ] in the userinfo makes the serialized URI fail to parse, a : in the user moves the rest of it into the password, and browsers read a \ as a /, ending the userinfo there. #normalize encodes all of these correctly.

An application that puts an untrusted value into the userinfo of a URI for a trusted host, checks host or origin, and then passes to_s to an HTTP client sends the request to a host the attacker chose. Headers or a body meant for the trusted service, such as an API token, go with it. The attacker needs the application to build URIs this way, so attack complexity is high.

Affected Versions

This vulnerability affects Addressable >= 2.0.0. In 2.9.2, #userinfo= ignores a value without a col…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details