{"id":2609,"date":"2025-03-15T10:04:29","date_gmt":"2025-03-15T10:04:29","guid":{"rendered":"https:\/\/serisec.com\/index.php\/2025\/03\/15\/critical-ruby-saml-vulnerabilities-let-attackers-bypass-authentication\/"},"modified":"2025-03-15T10:04:29","modified_gmt":"2025-03-15T10:04:29","slug":"critical-ruby-saml-vulnerabilities-let-attackers-bypass-authentication","status":"publish","type":"post","link":"https:\/\/serisec.com\/index.php\/2025\/03\/15\/critical-ruby-saml-vulnerabilities-let-attackers-bypass-authentication\/","title":{"rendered":"Critical ruby-saml Vulnerabilities Let Attackers Bypass Authentication"},"content":{"rendered":"<p>    Critical ruby-saml Vulnerabilities Let Attackers Bypass Authentication<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n    <!-- no image --><br \/>\n \t<BR><br \/>\n<BR><\/BR><\/p>\n<div>\n<p>Two critical authentication bypass vulnerabilities have been discovered in the ruby-saml library, potentially exposing numerous web applications to account takeover attacks.\u00a0<\/p>\n<p>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.<\/p>\n<p>GitHub reports that the vulnerabilities stem from ruby-saml\u2019s use of two different XML parsers\u2014REXML and Nokogiri\u2014during the SAML response signature verification process.\u00a0<\/p>\n<p>This dual-parser approach creates a critical security flaw where the parsers interpret the same XML document differently, allowing attackers to manipulate verification checks.<\/p>\n<p>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.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Critical ruby-saml Vulnerabilities<\/strong><\/h2>\n<p>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:<\/p>\n<figure class=\"wp-block-table\">\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td><strong>Risk Factors<\/strong><\/td>\n<td><strong>Details<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Affected Products<\/td>\n<td>ruby-saml &lt; 1.12.4 and \u2265 1.13.0, &lt; 1.18.0; omniauth-saml &lt; 2.2.2, &lt; 1.10.5<\/td>\n<\/tr>\n<tr>\n<td>Impact<\/td>\n<td>Authentication bypass; Account takeover<\/td>\n<\/tr>\n<tr>\n<td>Exploit Prerequisites<\/td>\n<td>Possession of a single valid signature created with the target organization\u2019s key; Can be obtained from an unprivileged user\u2019s assertion or publicly accessible IdP metadata<\/td>\n<\/tr>\n<tr>\n<td>CVSS 3.1 Score<\/td>\n<td>8.8 (High)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>Researchers <a href=\"https:\/\/github.blog\/security\/sign-in-as-anyone-bypassing-saml-sso-authentication-with-parser-differentials\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">discovered<\/a> that an attacker could craft a malicious SAML response containing two different Signature elements\u2014one visible to REXML and another visible to Nokogiri. The code in xml_security.rb first queries for signature elements with REXML:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXeYht0t5Hp59BBb_BlSIXNfDO4CZ4vKn9ZcP_kpLQcBaASWf9Uy0Nbrk53e-2ys7brn_vDsSWBAj9TUyEE9U1tn35PmrcxmYHiwkbNjFPnp6zHqlpS8q7uJEviNG3rq-yGU0PGbdQ?key=Spg9zpC21-jLZ-58RCzZuTcA\" alt=\"\"><\/figure>\n<p>Later, it queries again using Nokogiri:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXeKd27yh-nh3xVQsyR5UEQhVUmgiIhcIdTe9l3eINYg_5ChFE2Z1o7Uqbs4iCB-32qz8wC_GQ6nC3JmuvFQeI3B6wtIySeeJ1M9U34XoZid8EcOUvgYRPO7kPTTrRaDL6-IKTf8rg?key=Spg9zpC21-jLZ-58RCzZuTcA\" alt=\"\"><\/figure>\n<p>Due to parser differences, these queries can return different elements from the same document.\u00a0<\/p>\n<p>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.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Attack Scenario<\/strong><\/h2>\n<p>The security impact is severe. An attacker with a valid signature created with the target organization\u2019s key can construct SAML assertions for any user.\u00a0<\/p>\n<p>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.<\/p>\n<p>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.\u00a0<\/p>\n<p>This technique effectively disconnects the hash verification from the signature verification, allowing attackers to bypass authentication mechanisms and gain unauthorized access to protected resources.<\/p>\n<p>The <a href=\"https:\/\/cybersecuritynews.com\/defending-against-owasp-top-10-vulnerabilities\/\" target=\"_blank\" rel=\"noreferrer noopener\">vulnerabilities<\/a> have been confirmed in popular projects using ruby-saml, including GitLab. GitHub Security Lab notified GitLab\u2019s security team to protect their users against potential attacks<\/p>\n<h2 class=\"wp-block-heading\"><strong>Mitigations<\/strong><\/h2>\n<p>Organizations using ruby-saml should immediately update to version 1.18.0, which contains fixes for both CVE-2025-25291 and CVE-2025-25292.\u00a0<\/p>\n<p>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.<\/p>\n<p>For developers implementing temporary mitigations, checking for Nokogiri parsing errors can help prevent some exploitation techniques:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXflusLff-ekoU7-7Zlyc8LIQV_qcc93Vr9lGHqcdc5WDV8BBbSaxh5HeSBu1pgVvjrwNSSfI_xrc2SLJf1PbQBcwruqJX9Hdkcl_3l4ZW8Gl3JWnSs61sKmJ8--LQHTCKmyGu2Jag?key=Spg9zpC21-jLZ-58RCzZuTcA\" alt=\"\"><\/figure>\n<p>However, this is not a complete solution, and updating to the fixed version remains the recommended approach.<\/p>\n<p>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 \u201cahacker1\u201d and GitHub Security Lab researchers independently identified the parser differential issues.\u00a0<\/p>\n<p>The maintainer of ruby-saml, Sixto Mart\u00edn, worked with security researchers to develop and release the fixes.<\/p>\n<p>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.<\/p>\n<p class=\"has-text-align-center has-background\" style=\"background:linear-gradient(180deg,rgb(238,238,238) 89%,rgb(169,184,195) 100%)\"><strong><strong><code><strong>Are you from SOC\/DFIR Teams? \u2013 Analyse Malware Incidents &amp; get live Access with ANY.RUN -&gt;\u00a0<a href=\"https:\/\/any.run\/demo\/?utm_source=li_csn&amp;utm_medium=post&amp;utm_campaign=6_habits&amp;utm_content=demo&amp;utm_term=100325\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Start Now for Free<\/a>.<\/strong><\/code><\/strong><\/strong>\u00a0<\/p>\n<p>The post <a href=\"https:\/\/cybersecuritynews.com\/ruby-saml-vulnerabilities-bypass-authentication\/\">Critical ruby-saml Vulnerabilities Let Attackers Bypass Authentication<\/a> appeared first on <a href=\"https:\/\/cybersecuritynews.com\/\">Cyber Security News<\/a>.<\/p>\n<\/div>\n<p> \t<BR><br \/>\n <BR><\/BR><br \/>\n    Guru Baran<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n<a href=\"https:\/\/cybersecuritynews.com\/ruby-saml-vulnerabilities-bypass-authentication\/\">Go to cyber-security-news<\/a><br \/>\n \t<BR><br \/>\n <BR><\/BR><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.\u00a0 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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129,63,648],"tags":[130],"class_list":["post-2609","post","type-post","status-publish","format-standard","hentry","category-cyber-security","category-cyber-security-news","category-vulnerability-news","tag-cyber-security-news"],"_links":{"self":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/2609"}],"collection":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/comments?post=2609"}],"version-history":[{"count":0,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/2609\/revisions"}],"wp:attachment":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/media?parent=2609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/categories?post=2609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/tags?post=2609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}