☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Ruby logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 3.2 🐛 CWE-200
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2025-27221

CVE-2025-27221 Information Disclosure in Ruby
📅 PUBLISHED: 2025-03-03 00:00 UTC 🔄 UPDATED: 2026-09-23 20:36 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: CONFIRMED — 3+ independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.50%
👁️
0.50% probability
12.5× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
3.2
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-27221 is a low-severity information disclosure vulnerability in the Ruby URI gem (versions before 1.0.3). The flaw allows authentication credentials (userinfo) to be inadvertently leaked when using URI manipulation methods such as URI.join, URI#merge, and URI#+. Specifically, when a URI containing userinfo (e.g., http://user:pass@host1/path) is merged with another URI that changes the host (e.g., http://host2/newpath), the resulting URI incorrectly retains the original userinfo. This can lead to credential leakage if the resulting URI is logged, transmitted, or displayed.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability affects the Ruby ecosystem via the uri gem, which is a default gem bundled with Ruby. The gem is widely used in web applications, API clients, and network libraries. An attacker could exploit this in supply chain attacks by crafting malicious URIs that cause credential leakage in downstream applications. The patch is available in version 1.0.3, and all Ruby users should update their uri gem.

CVSS Breakdown & Threat Level

  • CVSS Score: 3.2 (Low)
  • Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: None
  • User Interaction: None
  • Scope: Unchanged
  • Confidentiality Impact: Low (credential leakage)
  • Integrity Impact: None
  • Availability Impact: None

The low score reflects the limited impact (credential leakage) and the specific conditions required for exploitation (use of vulnerable URI methods with userinfo).

Deep Dive & Mechanics

The vulnerability lies in the URI.join, URI#merge, and URI#+ methods. When combining two URIs, the gem incorrectly preserves the userinfo component from the base URI even when the host is changed. For example:

base = URI.parse("http://user:pass@host1/path")
result = URI.join(base, "http://host2/newpath")
# Result: http://user:pass@host2/newpath (userinfo leaked)

The expected behavior is that when the host changes, the userinfo should be discarded because the credentials are specific to the original host. The root cause is a missing check in the URI merging logic that fails to clear the userinfo field when the host component is replaced.

Vulnerable vs. Patched Code

Vulnerable Code (URI gem < 1.0.3):

# In URI::Generic#merge
def merge(oth)
  # ...
  if oth.host
    self.userinfo = self.userinfo  # Incorrectly retains userinfo
    self.host = oth.host
  end
  # ...
end

Patched Code (URI gem >= 1.0.3):

# In URI::Generic#merge
def merge(oth)
  # ...
  if oth.host
    self.userinfo = nil  # Correctly clears userinfo
    self.host = oth.host
  end
  # ...
end

The fix ensures that when the host is changed, the userinfo is set to nil, preventing credential leakage.

Exploitation & Lab Setup

Red Team

  1. Setup: Use Ruby 2.7 or 3.0 with URI gem < 1.0.3.
  2. Exploit: Craft a malicious URI with userinfo and use URI.join to change the host.
  3. Example:
    require 'uri'
    base = URI.parse("http://admin:secret@evil.com/path")
    result = URI.join(base, "http://legitimate.com/newpath")
    puts result.to_s  # Outputs: http://admin:secret@legitimate.com/newpath
    
  4. Impact: The credentials admin:secret are now associated with legitimate.com, potentially leaking them in logs or HTTP requests.

Blue Team

  1. Detection: Monitor for URIs containing @ symbols in logs, especially after URI manipulation.
  2. Mitigation: Update the uri gem to version 1.0.3 or later.
  3. Workaround: Manually clear userinfo before merging:
    base.userinfo = nil
    result = URI.join(base, "http://legitimate.com/newpath")
    

Indicators of Compromise (IOCs)

  • Log Entries: URIs containing user:pass@ in application logs.
  • Network Traffic: HTTP requests with Authorization headers containing leaked credentials.
  • File Hashes: Vulnerable gem files (e.g., uri-0.10.0.gem).
  • Processes: Ruby processes using URI.join, URI#merge, or URI#+ with userinfo.

Detection Engineering

YARA Rule

rule CVE_2025_27221_URI_Leak {
    meta:
        description = "Detects vulnerable URI gem versions"
        author = "Valters IT"
        date = "2025-04-01"
        cve = "CVE-2025-27221"
    strings:
        $vuln_code = /self\.userinfo\s*=\s*self\.userinfo/
    condition:
        $vuln_code
}

Sigma Rule

title: CVE-2025-27221 URI Credential Leakage
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential credential leakage via URI manipulation
logsource:
    category: application
    product: ruby
detection:
    selection:
        EventID: 1001
        Message|contains: "user:pass@"
    condition: selection
falsepositives:
    - Legitimate use of credentials in URIs
level: low

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (
    msg:"CVE-2025-27221 URI Credential Leakage";
    flow:to_server,established;
    content:"@"; http_uri;
    pcre:"/[a-zA-Z0-9]+:[a-zA-Z0-9]+@/";
    sid:1000001;
    rev:1;
)

Remediation & Mitigation

  1. Immediate: Upgrade the uri gem to version 1.0.3 or later:
    gem update uri
    
  2. Workaround: If upgrade is not possible, manually clear userinfo before URI manipulation:
    base.userinfo = nil
    
  3. Code Review: Audit all uses of URI.join, URI#merge, and URI#+ in your codebase.
  4. Logging: Sanitize URIs in logs to remove userinfo.
  5. Monitoring: Implement detection rules to alert on credential leakage.

Valters IT signature: This report is generated for educational and defensive purposes. Always verify with official sources.

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-27221/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.