CVE-2025-25291

9.8 CRITICAL

📋 TL;DR

CVE-2025-25291 is an authentication bypass vulnerability in ruby-saml that allows attackers to bypass SAML single sign-on authentication via signature wrapping attacks. The vulnerability stems from parser differentials between ReXML and Nokogiri XML parsers, which can generate different document structures from the same XML input. This affects all Ruby applications using vulnerable versions of ruby-saml for SAML authentication.

💻 Affected Systems

Products:
  • ruby-saml
  • GitLab (versions prior to 17.9.2)
  • Other Ruby applications using ruby-saml
Versions: All ruby-saml versions prior to 1.12.4 and 1.18.0
Operating Systems: All operating systems running Ruby applications with vulnerable ruby-saml
Default Config Vulnerable: ⚠️ Yes
Notes: Any Ruby application using ruby-saml for SAML authentication is vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete authentication bypass allowing attackers to impersonate any user, gain unauthorized access to protected systems, and potentially escalate privileges across integrated applications.

🟠

Likely Case

Authentication bypass enabling unauthorized access to applications protected by SAML SSO, potentially leading to data exposure and unauthorized actions.

🟢

If Mitigated

Limited impact with proper network segmentation, additional authentication factors, and monitoring for suspicious authentication patterns.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires understanding of SAML and XML signature wrapping attacks, but public references provide sufficient technical details.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: ruby-saml 1.12.4 or 1.18.0

Vendor Advisory: https://github.com/SAML-Toolkits/ruby-saml/releases/tag/v1.12.4

Restart Required: Yes

Instructions:

1. Update Gemfile to specify 'gem "ruby-saml", ">= 1.12.4"' or 'gem "ruby-saml", ">= 1.18.0"'. 2. Run 'bundle update ruby-saml'. 3. Restart your Ruby application server. 4. For GitLab, upgrade to version 17.9.2 or later.

🔧 Temporary Workarounds

Force Nokogiri Parser

all

Configure ruby-saml to use only Nokogiri parser to avoid parser differentials

In ruby-saml configuration: settings.security[:xml_security] = true
settings.security[:allowed_clock_drift] = 0

🧯 If You Can't Patch

  • Implement additional authentication factors (MFA) for all SAML-authenticated applications
  • Monitor authentication logs for suspicious patterns and implement rate limiting on authentication endpoints

🔍 How to Verify

Check if Vulnerable:

Check Gemfile.lock or run 'bundle show ruby-saml' to see installed version. If version is below 1.12.4 or 1.18.0, you are vulnerable.

Check Version:

bundle show ruby-saml | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+"

Verify Fix Applied:

After updating, verify with 'bundle show ruby-saml' that version is 1.12.4 or higher, or 1.18.0 or higher. Test SAML authentication flows.

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed authentication attempts followed by successful authentication from same IP
  • Unusual user agent strings in SAML requests
  • XML parsing errors in application logs

Network Indicators:

  • Unusually large SAML responses
  • Multiple SAML authentication requests from single source in short time

SIEM Query:

source="application.log" AND ("SAML" OR "ruby-saml") AND ("error" OR "failed" OR "invalid")

🔗 References

📤 Share & Export