GitHub Enterprise SAML Authentication Bypass (CVE-2024-4985 / CVE-2024-9487)
GitHub Enterprise's SAML implementation failed to validate the signature of an encrypted assertion when a root signature was present, allowing an attacker to bypass SAML SSO and log in as any user. The attacker could provision unauthorised users and access the instance.
httpvoid.com
Published on httpvoid.com
Note - This is cross post from our work at Projectdiscovery Blog
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the code extracted signatures before decrypting an encrypted assertion and did not re-extract or validate the signature inside the decrypted assertion, so a signature wrapping attack could bypass validation.
Impact
An attacker could bypass SAML SSO and log in as any user, potentially gaining administrative access to the GitHub Enterprise instance.
What the attacker needed
SAML authentication with encrypted assertions enabled; A valid SAMLResponse from the identity provider; Ability to modify and forward the SAMLResponse
The fix
The vulnerability was fixed by GitHub, though initial fixes required additional updates to be fully effective.
How it was found
- Obtain a valid SAMLResponse from the identity provider.
- Modify the Signature node of the Response and add an empty element just after the KeyInfo.
- Copy the whole Response and paste it inside the added element.
- Change the original Response's ID attribute to a different value.
- Create a new Assertion with the victim's details, calculate its digest, and update the DigestValue in its Signature.
- Encrypt the new Assertion with the service provider's public key and forward the modified SAMLResponse.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
SAML is a way for a company to let users log in to an app using a central identity provider. The app checks a signed message from the identity provider to confirm the user's identity. Here, the app checked one signature but missed another, so an attacker could slip in a fake user identity and log in as someone else.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.