CVE-2022-25262 | JetBrains Hub single-click SAML response takeover
JetBrains Hub's SAML identity provider accepted OAuth2 authorization codes issued to any OAuth client, not just its own, allowing an attacker to obtain a code via the YouTrack Konnector service and exchange it for a signed SAML response for a victim. An attacker could thus log in as the victim to a service provider relying on Hub as SAML IdP.
Published on github.com
BranchesTags
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 SAML IdP did not verify which OAuth client the authorization code was issued to, only that the code was valid.
Impact
An attacker could take over a victim's SAML login to a service provider, but the victim must have an active Hub session and click the crafted link.
What the attacker needed
JetBrains Hub <2022.1.14434; Hub configured as SAML IdP; YouTrack Konnector installed; Victim has a valid Hub session
The fix
The YouTrack team added a check that only allows authorization codes issued for the 'JetBrains Hub Service' OAuth client to be used in the OAuth2 to SAML exchange.
How it was found
- Set up a host with the endpoints required for the Konnector handshake.
- Obtain a state parameter from Konnector that points to the attacker's host.
- Craft an OAuth authorization URL and send it to the victim.
- The victim clicks the link and completes the OAuth flow while logged into Hub.
- Konnector sends the authorization code to the attacker's host.
- The attacker exchanges the code for a signed SAML response.
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.
When you log in with a 'Log in with X' button, a short-lived code is passed around to prove who you are. Here, the login server (Hub) would accept a code that was meant for a different application, so an attacker could trick a victim into generating such a code and then use it to get a valid login token for the victim's account on a connected service.
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.