Skip to content
OAuth / SSO Write-up Advanced

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.

Yurii Sanin Follow

Published on github.com

BranchesTags

Yurii Sanin (@SaninYurii), on github.com

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

  1. Set up a host with the endpoints required for the Konnector handshake.
  2. Obtain a state parameter from Konnector that points to the attacker's host.
  3. Craft an OAuth authorization URL and send it to the victim.
  4. The victim clicks the link and completes the OAuth flow while logged into Hub.
  5. Konnector sends the authorization code to the attacker's host.
  6. 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.

More by Yurii Sanin

View all

1 more disclosed report, best first.

More from JetBrains

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

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.