CVE-2025-54572: Ruby saml Denial of Service Vulnerability
MODERATECVE-2025-54572 is a MODERATE denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Ruby saml libraries in the RubyGems ecosystem. The issue involves ruby saml dos vulnerability with large saml response. Remediation is available by upgrading affected packages to version 1.18.1.
CVE-2025-54572 at a Glance
How to Fix CVE-2025-54572
To remediate this vulnerability, upgrade all affected Ruby saml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade ruby-saml to 1.18.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for ruby-saml
How to Check if You Are Affected
To determine whether your application is affected by CVE-2025-54572, inspect your project dependencies for Ruby saml:
inspect dependencies for ruby-saml
Analyze the terminal output to locate any version of Ruby saml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.18.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Ruby saml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-54572 Affected Ruby saml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ruby-saml
|
RubyGems |
< 1.18.1
|
1.18.1
|
References
Frequently Asked Questions
What is CVE-2025-54572?
Which Ruby saml versions are affected?
What version fixes CVE-2025-54572?
Is ruby-saml affected?
What CWE is associated with CVE-2025-54572?
How can I check RubyGems dependencies for CVE-2025-54572?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rrqh-93c8-j966",
"modified" : "2025-11-03T21:34:17Z",
"published" : "2025-07-30T13:20:05Z",
"aliases" : [ "CVE-2025-54572" ],
"summary" : "Ruby SAML DOS vulnerability with large SAML response",
"details" : "### Summary\nA denial-of-service vulnerability exists in ruby-saml even with the message_max_bytesize setting configured. The vulnerability occurs because the SAML response is validated for Base64 format prior to checking the message size, leading to potential resource exhaustion.\n\n### Details\n`ruby-saml` includes a `message_max_bytesize` setting intended to prevent DOS attacks and decompression bombs. However, this protection is ineffective in some cases due to the order of operations in the code:\n\nhttps://github.com/SAML-Toolkits/ruby-saml/blob/fbbedc978300deb9355a8e505849666974ef2e67/lib/onelogin/ruby-saml/saml_message.rb\n\n```ruby\n def decode_raw_saml(saml, settings = nil)\n return saml unless base64_encoded?(saml) # <--- Issue here. Should be moved after next code block.\n\n settings = OneLogin::RubySaml::Settings.new if settings.nil?\n if saml.bytesize > settings.message_max_bytesize\n raise ValidationError.new(\"Encoded SAML Message exceeds \" + settings.message_max_bytesize.to_s + \" bytes, so was rejected\")\n end\n\n decoded = decode(saml)\n ...\n end\n```\n\nThe vulnerability is in the execution order. Prior to checking bytesize the `base64_encoded?` function performs regex matching on the entire input string:\n\n```ruby\n!!string.gsub(/[\\r\\n]|\\\\r|\\\\n|\\s/, \"\").match(BASE64_FORMAT)\n```\n\n### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nWhen successfully exploited, this vulnerability can lead to:\n\n- Excessive memory consumption\n- High CPU utilization\n- Application slowdown or unresponsiveness\n- Complete application crash in severe cases\n- Potential denial of service for legitimate users\n\nAll applications using `ruby-saml` with SAML configured and enabled are vulnerable.\n\n### Potential Solution\n\nReorder the validation steps to ensure max bytesize is checked first\n\n```ruby\ndef decode_raw_saml(saml, settings = nil)\n settings = OneLogin::RubySaml::Settings.new if settings.nil?\n\n if saml.bytesize > settings.message_max_bytesize\n raise ValidationError.new(\"Encoded SAML Message exceeds \" + settings.message_max_bytesize.to_s + \" bytes, so was rejected\")\n end\n \n return saml unless base64_encoded?(saml)\n decoded = decode(saml)\n ...\nend\n```",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "ruby-saml"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.18.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/SAML-Toolkits/ruby-saml/security/advisories/GHSA-rrqh-93c8-j966"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54572"
}, {
"type" : "WEB",
"url" : "https://github.com/SAML-Toolkits/ruby-saml/pull/770"
}, {
"type" : "WEB",
"url" : "https://github.com/SAML-Toolkits/ruby-saml/commit/38ef5dd1ce17514e202431f569c4f5633e6c2709"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/SAML-Toolkits/ruby-saml"
}, {
"type" : "WEB",
"url" : "https://github.com/SAML-Toolkits/ruby-saml/releases/tag/v1.18.1"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/ruby-saml/CVE-2025-54572.yml"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2025/09/msg00001.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400", "CWE-770" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-07-30T13:20:05Z",
"nvd_published_at" : "2025-07-30T14:15:29Z"
}
}