GHSA-qrq6-rcpx-pmm6

Suggest an improvement
Source
https://github.com/advisories/GHSA-qrq6-rcpx-pmm6
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-qrq6-rcpx-pmm6/GHSA-qrq6-rcpx-pmm6.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-qrq6-rcpx-pmm6
Aliases
Downstream
CGA (9)
Published
2026-12-01T23:52:47Z
Modified
2026-12-02T00:00:04Z
Severity
  • 4.8 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N CVSS Calculator
Summary
Addressable URI userinfo setters store delimiters raw, so the serialized URI names a different host
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:

Database specific
{
    "cwe_ids":  [
        "CWE-436",
        "CWE-74"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-12-01T23:52:47Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

RubyGems / addressable

Package

Name
addressable
Purl
pkg:gem/addressable

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.0.0
Fixed
2.10.0

Affected versions

2.*
2.0.0
2.0.1
2.0.2
2.1.0
2.1.1
2.1.2
2.2.0
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.2.6
2.2.7
2.2.8
2.3.2
2.3.3
2.3.4
2.3.5
2.3.6
2.3.7
2.3.8
2.4.0
2.5.0
2.5.1
2.5.2
2.6.0
2.7.0
2.8.0
2.8.1
2.8.2
2.8.3
2.8.4
2.8.5
2.8.6
2.8.7
2.8.8
2.8.9
2.8.10
2.9.0
2.9.1
2.9.2

Database specific

last_known_affected_version_range
"<= 2.9.2"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-qrq6-rcpx-pmm6/GHSA-qrq6-rcpx-pmm6.json"