Cyber Security News

Critical ruby-saml Vulnerabilities Let Attackers Bypass Authentication

Two critical authentication bypass vulnerabilities have been discovered in the ruby-saml library, potentially exposing numerous web applications to account takeover attacks. 

Security researchers from GitHub Security Lab have identified parser differential vulnerabilities (CVE-2025-25291 and CVE-2025-25292) affecting ruby-saml versions up to 1.17.0, which could allow attackers to impersonate any user within affected systems.

GitHub reports that the vulnerabilities stem from ruby-saml’s use of two different XML parsers—REXML and Nokogiri—during the SAML response signature verification process. 

This dual-parser approach creates a critical security flaw where the parsers interpret the same XML document differently, allowing attackers to manipulate verification checks.

In the affected code, ruby-saml uses REXML to extract the signature element and SignatureValue, while Nokogiri is used to extract and canonicalize the SignedInfo element.

Critical ruby-saml Vulnerabilities

The disconnect between these two operations creates an exploitable condition. When validating SAML responses, the library performs two critical checks: comparing a calculated hash against a DigestValue and verifying the SignedInfo element against the SignatureValue. The summary of both vulnerabilities is given below:

Risk FactorsDetails
Affected Productsruby-saml < 1.12.4 and ≥ 1.13.0, < 1.18.0; omniauth-saml < 2.2.2, < 1.10.5
ImpactAuthentication bypass; Account takeover
Exploit PrerequisitesPossession of a single valid signature created with the target organization’s key; Can be obtained from an unprivileged user’s assertion or publicly accessible IdP metadata
CVSS 3.1 Score8.8 (High)

Researchers discovered that an attacker could craft a malicious SAML response containing two different Signature elements—one visible to REXML and another visible to Nokogiri. The code in xml_security.rb first queries for signature elements with REXML:

Later, it queries again using Nokogiri:

Due to parser differences, these queries can return different elements from the same document. 

An attacker exploits this by ensuring that a valid SignedInfo with DigestValue is verified against a legitimate signature, while simultaneously having a fabricated assertion compared against its calculated digest.

Attack Scenario

The security impact is severe. An attacker with a valid signature created with the target organization’s key can construct SAML assertions for any user. 

This signature could come from a legitimate SAML response belonging to an unprivileged user or, in some cases, even from publicly accessible signed metadata of a SAML identity provider.

For example, an attacker could create a malicious SAML response containing an additional Signature element hidden within a StatusDetail element that would only be visible to Nokogiri. 

This technique effectively disconnects the hash verification from the signature verification, allowing attackers to bypass authentication mechanisms and gain unauthorized access to protected resources.

The vulnerabilities have been confirmed in popular projects using ruby-saml, including GitLab. GitHub Security Lab notified GitLab’s security team to protect their users against potential attacks

Mitigations

Organizations using ruby-saml should immediately update to version 1.18.0, which contains fixes for both CVE-2025-25291 and CVE-2025-25292. 

Additionally, references to libraries making use of ruby-saml, such as omniauth-saml, must be updated to versions that reference the fixed version of ruby-saml.

For developers implementing temporary mitigations, checking for Nokogiri parsing errors can help prevent some exploitation techniques:

However, this is not a complete solution, and updating to the fixed version remains the recommended approach.

The vulnerabilities were discovered through a private bug bounty engagement initiated by GitHub to evaluate the security of the ruby-saml library. Both a bug bounty participant identified as “ahacker1” and GitHub Security Lab researchers independently identified the parser differential issues. 

The maintainer of ruby-saml, Sixto Martín, worked with security researchers to develop and release the fixes.

No reliable indicators of compromise have been identified, making it crucial for organizations to proactively update their implementations and monitor for suspicious SAML-based authentication attempts.

Are you from SOC/DFIR Teams? – Analyse Malware Incidents & get live Access with ANY.RUN -> Start Now for Free. 

Guru Baran

Gurubaran is a co-founder of Cyber Security News and GBHackers On Security. He has 10+ years of experience as a Security Consultant, Editor, and Analyst in cybersecurity, technology, and communications.

Recent Posts

GitAuto Strengthens Code Security By Automating QA At Scale

In the current software landscape, security breaches caused by untested or poorly tested code are…

45 minutes ago

Cybersecurity in Mergers and Acquisitions – CISO Focus

Cybersecurity in mergers and acquisitions is crucial, as M&A activities represent key inflection points for…

3 hours ago

Top Cybersecurity Trends Every CISO Must Watch in 2025

In 2025, cybersecurity trends for CISOs will reflect a landscape that is more dynamic and…

3 hours ago

Zero Trust Architecture – A CISO’s Blueprint for Modern Security

Zero-trust architecture has become essential for securing operations in today’s hyper-connected world, where corporate network…

3 hours ago

Chrome 136 Released With Patch For 20-Year-Old Privacy Vulnerability

The Chrome team has officially promoted Chrome 136 to the stable channel for Windows, Mac,…

3 hours ago

SecAI Debuts at RSA 2025, Redefining Threat Investigation with AI

By fusing agentic AI and contextual threat intelligence, SecAI transforms investigation from a bottleneck into…

13 hours ago