# CVE-2025-27221: URI allows for userinfo Leakage in URI#join, URI#merge, and URI#+

> Attackers can leak authentication credentials when URI methods retain userinfo after host changes, affecting Ruby applications using the URI gem.

- **Severity:** Low 3.2 (`CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Mar 2025
- **Updated:** 3 Nov 2025
- **Also known as:** AZL-57778, AZL-57893, CLEANSTART-2026-JV54364, CLEANSTART-2026-RX39488, CLSA-2026-1768314331, DEBIAN-CVE-2025-27221, ECHO-0f02-8857-9466, GHSA-22h5-pq3x-2gf2, MINI-6c4r-w2x8-j455, MINI-6h56-9hp5-pv35, MINI-99gx-v4vj-qrx8, MINI-9x5x-9qgw-wrhq, MINI-fm47-8mvq-9f46, MINI-g2r5-q7w6-mmf2, MINI-g36m-x3vr-xg5w, MINI-gfcv-pr58-vg2w, MINI-h375-x4hx-vg53, MINI-q6qw-jj6h-f3h9, MINI-wp63-cqhf-vf9g, MINI-wv4q-r7rh-gwrf, MINI-x3ch-cgwc-f4m9, MINI-xqqg-375w-hwcg, UBUNTU-CVE-2025-27221

## What is CVE-2025-27221?

CVE-2025-27221 is a low-severity vulnerability in ruby-lang URI, published on 3 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

In the URI gem before 1.0.3 for Ruby, the URI handling methods (URI.join, URI#merge, URI#+) have an inadvertent leakage of authentication credentials because userinfo is retained even after changing the host.

Weakness: CWE-212 (Improper Removal of Sensitive Information Before Storage or Transfer)

## Which versions are affected by CVE-2025-27221?

8 open source packages ship an affected version, including uri. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `uri` | RubyGems | All versions | 0.11.3 |
| `uri` | RubyGems | All versions | 0.11.3 |
| `uri` | RubyGems | From 0.12.0 | 0.12.4 |
| `uri` | RubyGems | From 0.12.0 | 0.12.4 |
| `uri` | RubyGems | From 0.13.0 | 0.13.2 |
| `uri` | RubyGems | From 0.13.0 | 0.13.2 |
| `uri` | RubyGems | From 1.0.0 | 1.0.3 |
| `uri` | RubyGems | From 1.0.0 | 1.0.3 |

Products: Ruby-Lang Uri.

## How do I fix CVE-2025-27221?

Upgrade uri to a fixed version for your release line: 0.11.3, 0.12.4, 0.13.2 or 1.0.3.

## Is CVE-2025-27221 being exploited?

There is no known exploitation of CVE-2025-27221 in the wild and no public exploit code.

## Other vulnerabilities in ruby-lang URI

- [CVE-2023-36617](https://insights.sbomify.com/CVE-2023-36617/): URI gem has ReDoS vulnerability (medium 5.3)
- [CVE-2025-61594](https://insights.sbomify.com/CVE-2025-61594/): URI Credential Leakage Bypass over CVE-2025-27221 (low 2.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-27221 and fix it if it is affected.

What it is: CVE-2025-27221 is a low-severity vulnerability in ruby-lang URI, published on 3 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-27221 in the wild and no public exploit code.

Affected packages and fixed versions:
- uri (RubyGems): affected all versions; fixed in 0.11.3
- uri (RubyGems): affected all versions; fixed in 0.11.3
- uri (RubyGems): affected from 0.12.0; fixed in 0.12.4
- uri (RubyGems): affected from 0.12.0; fixed in 0.12.4
- uri (RubyGems): affected from 0.13.0; fixed in 0.13.2
- uri (RubyGems): affected from 0.13.0; fixed in 0.13.2
- uri (RubyGems): affected from 1.0.0; fixed in 1.0.3
- uri (RubyGems): affected from 1.0.0; fixed in 1.0.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-27221/ (Markdown: https://insights.sbomify.com/CVE-2025-27221/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-27221
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-27221
- OSV: https://osv.dev/vulnerability/CVE-2025-27221

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-27221/
Summaries are generated and may contain mistakes; the official description above is the record.
