URI allows for userinfo Leakage in URI#join, URI#merge, and URI#+
Published 3 Mar 2025 · Updated 10 Sept 2026
Is your project on an affected uri?
Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <0.11.3
- Fixed in
- 0.11.3
bundle update --conservative uri # Gemfile: '>= 0.11.3'- Affected
- >=0.12.0 <0.12.4
- Fixed in
- 0.12.4
bundle update --conservative uri # Gemfile: '>= 0.12.4'- Affected
- >=0.13.0 <0.13.2
- Fixed in
- 0.13.2
bundle update --conservative uri # Gemfile: '>= 0.13.2'- Affected
- >=1.0.0 <1.0.3
- Fixed in
- 1.0.3
bundle update --conservative uri # Gemfile: '>= 1.0.3'Details
There is a possibility for userinfo leakage by in the uri gem. This vulnerability has been assigned the CVE identifier CVE-2025-27221. We recommend upgrading the uri gem.
Details
The methods URI#join, URI#merge, and URI#+ retained userinfo, such as user:password, even after the host is replaced. When generating a URL to a malicious host from a URL containing secret userinfo using these methods, and having someone access that URL, an unintended userinfo leak could occur.
Please update URI gem to version 0.11.3, 0.12.4, 0.13.2, 1.0.3 or later.
Affected versions
uri gem versions < 0.11.3, 0.12.0 to 0.12.3, 0.13.0, 0.13.1 and 1.0.0 to 1.0.2.
Credits
Thanks to Tsubasa Irisawa (lambdasawa) for discovering this issue. Also thanks to nobu for additional fixes of this vulnerability.
Is GHSA-22h5-pq3x-2gf2 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 uri, and gives you the command that fixes it.
More advisories for uri
- LowCVE-2025-61594URI Credential Leakage Bypass over CVE-2025-27221 · 30 Dec 2025
- MediumCVE-2023-36617URI gem has ReDoS vulnerability · 29 Jun 2023
- HighCVE-2023-28755Ruby URI component ReDoS issue · 31 Mar 2023
References
- Advisorynvd.nist.gov/vuln/detail/CVE-2025-27221
- Linkgithub.com/ruby/uri/pull/154
- Linkgithub.com/ruby/uri/pull/155
- Linkgithub.com/ruby/uri/pull/156
- Linkgithub.com/ruby/uri/pull/157
- Linkhackerone.com/reports/2957667
- Packagegithub.com/ruby/uri
- Linkgithub.com/rubysec/ruby-advisory-db/blob/master/gems/uri/CVE-2025-27221.yml
- Linklists.debian.org/debian-lts-announce/2025/03/msg00008.html
- Linklists.debian.org/debian-lts-announce/2025/05/msg00015.html
- Linkwww.cve.org/CVERecord?id=CVE-2025-27221
- Linkwww.ruby-lang.org/en/news/2025/02/26/security-advisories
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.