MediumGHSA-qrq6-rcpx-pmm6CVE-2026-141538

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

Published 1 Dec 2026 · Updated 2 Dec 2026

Affected package

addressableRubyGems
Affected
>=2.0.0 <2.10.0
Fixed in
2.10.0
Update to the fixed version for your release line, for example:bundle update --conservative addressable # Gemfile: '>= 2.10.0'

We confirm your address first. See our privacy policy.

Which addressable does your project really install?

Drop your Gemfile.lock hereWe find the exact addressable version you install, even when another package pulls it in, and tell you if it’s affected and what to run. Free, no sign-up.

Works for private projects: the file is read in memory to run the scan and then dropped. Also reads Gemfile.

Public repo?

Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Details

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 colon, so the injected text has to follow one, as in u:x@evil.example/. It is fixed in 2.10.0, where #user=, #password=, #userinfo=, #authority=, URI.new and URI.parse raise InvalidURIError for /, ?, #, [, ] or \ in the user or password, or : in the user. An @ is still accepted: the last @ ends the userinfo, so it reads the same once serialized.

Workarounds

  • Serialize with uri.normalize.to_s, which encodes the delimiters, instead of uri.to_s.
  • Encode userinfo values before assigning them, for example with Addressable::URI.encode_component(value, Addressable::URI::CharacterClasses::UNRESERVED).
  • Check the host of the final string with Addressable::URI.parse(uri.to_s).host, not of the object.

Credits

Found by Bob Aman (@sporkmonger).

For more information

If there are any questions or comments about this advisory:

Is GHSA-qrq6-rcpx-pmm6 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected addressable, and gives you the command that fixes it.

More advisories for addressable

  • LowCVE-2026-141532Addressable URI#origin= takes the host from the userinfo · 2 Dec 2026
  • LowCVE-2026-141536Addressable URI#request_uri returns control characters unencoded with possible HTTP request splitting · 1 Dec 2026
  • LowCVE-2026-141535Addressable URI#hostname strips brackets from hosts that aren't IP literals · 1 Dec 2026
  • LowCVE-2026-141537Addressable URI normalization takes quadratic time on long runs of combining marks · 1 Dec 2026
  • MediumCVE-2026-141539Addressable native IDNA backend truncates a host at a pct-encoded NUL when normalizing · 1 Dec 2026
  • LowCVE-2026-141531Addressable display_uri shows a deceptive label boundary for a host label that decodes to U+3002 · 1 Dec 2026
All 22 advisories for addressable

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.