Ruby-SAML / GitLab SAML Authentication Bypass (CVE-2024-45409)
Published: 2026-11-27 • Researcher: Alexis Danizan (GitHub: 0x4144), Synacktiv; independent analysis by Harsh Jaiswal and Rahul Maini (ProjectDiscovery); advisory by the ruby-saml maintainers
- Severity
- Critical
- CVE
- CVE-2024-45409
- Category
- web
- Affected product
- ruby-saml (OneLogin Ruby SAML) and omniauth-saml, as used by GitLab CE/EE SAML SSO
- Affected versions
- ruby-saml 1.13.0 through 1.16.0 and releases up to 1.12.2; fixed in 1.17.0 and 1.12.3. GitLab CE/EE below 16.11.10, 17.0.0 to 17.0.7, 17.1.0 to 17.1.7, 17.2.0 to 17.2.6 and 17.3.0 to 17.3.2 (fixed in 16.11.10, 17.0.8, 17.1.8, 17.2.7 and 17.3.3)
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2024-45409
- https://github.com/SAML-Toolkits/ruby-saml/security/advisories/GHSA-jw9c-mfg7-9rx2
- https://about.gitlab.com/releases/2024/09/17/patch-release-gitlab-17-3-3-released/
- https://projectdiscovery.io/blog/ruby-saml-gitlab-auth-bypass/
- https://github.com/synacktiv/CVE-2024-45409
- https://github.com/SAML-Toolkits/ruby-saml/commit/4865d030cae9705ee5cdb12415c654c634093ae7
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2024-10-07 (upstream commit f91fb1fc3b416b1a59c517876ac470c850cd8c95, “Update README.md”) |
| Author / Researcher | Alexis Danizan (GitHub: 0x4144), Synacktiv; independent analysis by Harsh Jaiswal and Rahul Maini (ProjectDiscovery); advisory by the ruby-saml maintainers |
| CVE / Advisory | CVE-2024-45409 |
| Category | web |
| Severity | Critical |
| CVSS Score | 10.0 (CVSSv3.1, NVD); EPSS 0.091 |
| Status | Weaponized (complete forgery tool; the upstream README documents a successful GitLab login with the patched response) |
| Tags | SAML, XML signature wrapping, authentication bypass, GitLab, ruby-saml, omniauth-saml, XPath injection, CWE-347, unauthenticated |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | ruby-saml (OneLogin Ruby SAML) and omniauth-saml, as used by GitLab CE/EE SAML SSO |
| Versions Affected | ruby-saml 1.13.0 through 1.16.0 and releases up to 1.12.2; fixed in 1.17.0 and 1.12.3. GitLab CE/EE below 16.11.10, 17.0.0 to 17.0.7, 17.1.0 to 17.1.7, 17.2.0 to 17.2.6 and 17.3.0 to 17.3.2 (fixed in 16.11.10, 17.0.8, 17.1.8, 17.2.7 and 17.3.3) |
| Language / Platform | Python 3 forging script using lxml; target is a Ruby on Rails application (GitLab) with SAML SSO |
| Authentication Required | No — the attacker is unauthenticated, but must possess any SAML Response signed by the target IdP (for example one issued for the attacker’s own account) |
| Network Access Required | Yes — HTTPS access to the GitLab SAML callback endpoint |
Summary
Ruby-SAML validates a SAML signature by recomputing a digest over the signed element and comparing it with a DigestValue that it locates with a permissive document-wide XPath expression. An attacker who holds any correctly signed SAML Response can smuggle a second DigestValue inside an extension container such as samlp:StatusDetail, rewrite the assertion so it names a different user, and have the library compare the recomputed digest against the attacker’s value while the IdP signature over the untouched SignedInfo still verifies. The archived script automates the XML surgery and emits a URL-encoded SAMLResponse that GitLab accepts, logging the attacker in as an arbitrary account including an administrator.
Vulnerability Details
Root Cause
After computing the hash of the canonicalized signed element, ruby-saml reads the expected digest with REXML::XPath.first(reference, “//ds:DigestValue”). The leading double-slash makes the selector search the whole document instead of the Reference child inside SignedInfo, so the first ds:DigestValue in document order wins. SAML permits extension containers such as samlp:Extensions and samlp:StatusDetail, and their contents are attacker-controlled. By placing a DigestValue that matches a rewritten assertion in one of those containers, the attacker supplies the value that the digest comparison uses, while SignedInfo and therefore the IdP signature remain untouched and valid. The same permissive XPath style is used to resolve the Reference target, which is what makes the accompanying signature-wrapping step possible: the IdP signature block is moved into the forged assertion and a duplicate reference is injected alongside it. The ruby-saml fix (commit 4865d030) switches to relative XPaths and rejects references that resolve to more than one node.
Attack Vector
An attacker captures a SAMLResponse issued by the target IdP (the Base64 value posted to /users/auth/saml/callback when any user signs in through SAML), modifies the NameID and conditions with the script, and reposts the result to the same callback endpoint. The response must be a valid, still-fresh IdP assertion and the Service Provider must accept its Destination, Audience and InResponseTo values, so the practical starting point is the attacker’s own SAML login captured in a proxy.
Impact
Authentication bypass: the attacker becomes any user in GitLab, including an administrator, without knowing that user’s password or having access to their IdP account. On an administrator account this yields full control of the GitLab instance — source code, CI/CD variables and runners, project and group settings, and the ability to create persistent access tokens. Because the flaw is in the signature check rather than in a specific GitLab feature, any application embedding the affected ruby-saml or omniauth-saml gem inherits the same bypass.
Environment / Lab Setup
OS: Linux host running a browser and Python 3
Target: GitLab CE/EE in a vulnerable range with SAML SSO configured
(for example 17.3.2), served over HTTPS
IdP: Any SAML IdP (Keycloak, SimpleSAMLphp, Authentik, Azure AD)
with at least one test account that can sign in to GitLab
Attacker: The same host, capturing traffic with browser devtools or a proxy
Tools: Python 3.11+ with lxml, a browser, mitmproxy or Burp SuiteSetup Steps
| |
The IdP, the GitLab deployment and the captured signed response are external preconditions; the script does not create any of them.
Proof of Concept
Step-by-Step Reproduction
Capture a signed SAML response — sign in to the target as a low-privileged SAML user and intercept the callback POST; copy the SAMLResponse value into a file.
HTTP request1 2 3 4 5POST /users/auth/saml/callback HTTP/1.1 Host: gitlab.test.local Content-Type: application/x-www-form-urlencoded SAMLResponse=PHNhbWxwOlJlc3BvbnNl...Forge the response — decode the input, rewrite the NameID and validity windows, move the signature, inject the malicious reference and digest, then encode the output.
Shell script1python3 CVE-2024-45409.py -r response.url_base64 -n admin@test.local -d -e -o response_patched.url_base64Replay it — replace the SAMLResponse parameter with the generated value and submit the callback request with the original RelayState.
Check the session — a successful bypass answers with a 302 to the GitLab homepage and the browser is authenticated as the forged user.
Exploit Code
See
CVE-2024-45409.pyin this folder for the complete implementation.
| |
The core of the forgery is the smuggled reference and its digest:
| |
Expected Output
[+] Parse response
Digest algorithm: sha256
Canonicalization Method: http://www.w3.org/2001/10/xml-exc-c14n#
[+] Remove signature from response
[+] Patch assertion ID
[+] Patch assertion NameID
[+] Patch assertion conditions
[+] Move signature in assertion
[+] Patch response ID
[+] Insert malicious reference
[+] Clone signature reference
[+] Create status detail element
[+] Patch digest value
[+] Write patched file in response_patched.url_base64and on replay:
HTTP/1.1 302 Found
Location: http://gitlab.test.local/Detection & Indicators of Compromise
ds:DigestValue appearing outside ds:SignedInfo (inside samlp:StatusDetail or samlp:Extensions)
More than one ds:Reference, or a ds:Signature nested inside saml:Assertion after transport
Assertion ID equal to the Reference URI but a different Response ID than the one the IdP issued
saml:NameID that does not match the Subject of the IdP's own audit record for that assertion
Condition timestamps (NotOnOrAfter) that differ from the IdP-issued assertion
Successful GitLab SAML login with no matching authentication event at the IdP
SAML logins for administrator accounts from new source addresses or user agents
Repeated callback submissions carrying the same response IDSIEM / IDS Rule (example):
alert http any any -> any any (msg:"CVE-2024-45409 SAML response with smuggled DigestValue"; flow:to_server,established; content:"/users/auth/saml/callback"; http_uri; content:"StatusDetail"; http_client_body; content:"DigestValue"; http_client_body; reference:cve,2024-45409; sid:9024409; rev:1;)Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade ruby-saml to 1.17.0 or 1.12.3 and omniauth-saml to a release built on it; upgrade GitLab to 16.11.10, 17.0.8, 17.1.8, 17.2.7 or 17.3.3 (or later). |
| Workaround | If patching is delayed, restrict the SAML callback to expected IdPs and networks, and monitor for extension containers or duplicate references in SAMLResponse payloads at the reverse proxy. |
| Config Hardening | Enforce SAML response signing at the IdP, pin the IdP certificate, reject responses whose Destination or Audience do not match the instance, keep assertion lifetimes short, and require MFA at the IdP for administrator accounts. After a suspected bypass, review administrator audit events and revoke sessions and personal access tokens. |
References
Notes
Auto-prepared on 2026-11-27 from https://github.com/synacktiv/CVE-2024-45409 (stars 86, single Python script).
Review verdict: ingested. This is a genuine exploit: it parses a real signed SAML response, performs the XML signature-wrapping and digest-smuggling steps, and produces a complete response that the upstream author reports as accepted by vulnerable GitLab. It is not a detector, a version checker or a placeholder, and it contains no C2, persistence, evasion, credential-theft or mining components. Only the exploit script and the upstream README are copied.
License: the repository has no LICENSE file, so copyright remains with Synacktiv and no reuse rights are granted. The archived script keeps the original code and adds only a two-line research-use header; the upstream README is copied verbatim as upstream-README.md.
Limitations: the tool needs a valid, unexpired SAML response signed by the target IdP — the attacker’s own login is enough — and it does not obtain one itself. It supports only exclusive XML canonicalization and the sha1/sha256 digest algorithms, raising ValueError on anything else, and it assumes the second Transform in SignedInfo is the exclusive c14n entry (index 1). It requires Python 3.11 or later because it imports UTC from datetime, and it requires lxml. The script does not forge the signature; it relies on the IdP signature over the untouched SignedInfo, so a Service Provider that enforces InResponseTo state or assertion audience checks strictly may reject the replay. No exploit was executed during preparation of this entry; the status Weaponized reflects the complete implementation and the successful run documented upstream, not an independent reproduction here.
| |