Skip to content

Commit 1314447

Browse files
jasnowRubySec CI
authored andcommitted
Updated advisory posts against rubysec/ruby-advisory-db@f4e7641
1 parent f38f260 commit 1314447

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
layout: advisory
3+
title: 'CVE-2025-54572 (ruby-saml): Ruby SAML DOS vulnerability with large SAML response'
4+
comments: false
5+
categories:
6+
- ruby-saml
7+
advisory:
8+
gem: ruby-saml
9+
cve: 2025-54572
10+
ghsa: rrqh-93c8-j966
11+
url: https://github.com/SAML-Toolkits/ruby-saml/security/advisories/GHSA-rrqh-93c8-j966
12+
title: Ruby SAML DOS vulnerability with large SAML response
13+
date: 2025-07-30
14+
description: |
15+
### Summary
16+
17+
A denial-of-service vulnerability exists in ruby-saml even with the
18+
message_max_bytesize setting configured. The vulnerability occurs
19+
because the SAML response is validated for Base64 format prior to
20+
checking the message size, leading to potential resource exhaustion.
21+
22+
### Details
23+
24+
`ruby-saml` includes a `message_max_bytesize` setting intended to
25+
prevent DOS attacks and decompression bombs. However, this protection
26+
is ineffective in some cases due to the order of operations in the code:
27+
28+
https://github.com/SAML-Toolkits/ruby-saml/blob/fbbedc978300deb9355a8e505849666974ef2e67/lib/onelogin/ruby-saml/saml_message.rb
29+
30+
```ruby
31+
def decode_raw_saml(saml, settings = nil)
32+
return saml unless base64_encoded?(saml)
33+
# <--- Issue here. Should be moved after next code block.
34+
35+
settings = OneLogin::RubySaml::Settings.new if settings.nil?
36+
if saml.bytesize > settings.message_max_bytesize
37+
raise ValidationError.new(\"Encoded SAML Message exceeds \" +
38+
settings.message_max_bytesize.to_s +
39+
\" bytes, so was rejected\")
40+
end
41+
decoded = decode(saml)
42+
...
43+
end
44+
```
45+
46+
The vulnerability is in the execution order. Prior to checking
47+
bytesize the `base64_encoded?` function performs regex matching
48+
on the entire input string:
49+
50+
```ruby
51+
!!string.gsub(/[\\r\]|\\\\r|\\\|\\s/, \"\").match(BASE64_FORMAT)
52+
```
53+
54+
### Impact
55+
56+
_What kind of vulnerability is it? Who is impacted?_
57+
58+
When successfully exploited, this vulnerability can lead to:
59+
- Excessive memory consumption
60+
- High CPU utilization
61+
- Application slowdown or unresponsiveness
62+
- Complete application crash in severe cases
63+
- Potential denial of service for legitimate users
64+
65+
All applications using `ruby-saml` with SAML configured and
66+
enabled are vulnerable.
67+
68+
### Potential Solution
69+
70+
Reorder the validation steps to ensure max bytesize is checked first
71+
72+
```ruby
73+
def decode_raw_saml(saml, settings = nil)
74+
settings = OneLogin::RubySaml::Settings.new
75+
if settings.nil?
76+
if saml.bytesize > settings.message_max_bytesize
77+
raise ValidationError.new(\"Encoded SAML Message exceeds \" +
78+
settings.message_max_bytesize.to_s + \" bytes, so was rejected\")
79+
end
80+
return saml unless base64_encoded?(saml)
81+
decoded = decode(saml)
82+
...
83+
end
84+
```
85+
cvss_v4: 6.9
86+
patched_versions:
87+
- ">= 1.18.1"
88+
related:
89+
url:
90+
- https://nvd.nist.gov/vuln/detail/CVE-2025-54572
91+
- https://github.com/SAML-Toolkits/ruby-saml/security/advisories/GHSA-rrqh-93c8-j966
92+
- https://github.com/SAML-Toolkits/ruby-saml/releases/tag/v1.18.1
93+
- https://github.com/SAML-Toolkits/ruby-saml/pull/770
94+
- https://github.com/SAML-Toolkits/ruby-saml/commit/38ef5dd1ce17514e202431f569c4f5633e6c2709
95+
- https://github.com/advisories/GHSA-rrqh-93c8-j966
96+
---

0 commit comments

Comments
 (0)