All vulnerabilities

RubyGems

CVE-2026-141538

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

Severity
Medium 4.8
Published
1 Dec 2026
Last changed
2 Dec 2026
Added to UpHeron
2 Dec 2026
Fixed in
2.10.0
Weakness
CWE-436Injection (CWE-74)
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Also known as
GHSA-qrq6-rcpx-pmm6
Sources
OSV.dev and GitHub

Description

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 = "[email protected]/" serializes as https://[email protected]/@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.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

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.
Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
addressableRubyGems · osv:RubyGems:addressable
  • From 2.0.0 before 2.10.0

About addressable

Total downloads (RubyGems)
1,323,514,580RubyGems, 1 Dec 2026

References