Authentication Bypass: Mis-scoped SAML Sessions Enable User Imper
An attacker who controls a SAML identity provider can create a user with the victim's email and set a password, then log in to obtain a session token that contains the victim's user ID but the attacker's organisation ID. The server authorises requests based only on the user ID, so the attacker can view and edit the victim's profile data and list invited accounts.
Published on 0xoverlord.medium.com
Long time no writeup. I was back poking at a SaaS application when I found dangerous logic gap in its SSO handling.
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 server-side authorisation checks only the user identifier in the session token and fails to verify that the user is a member of the organisation also present in the token.
Impact
The attacker could modify the victim's profile data (name, avatar) and enumerate invited accounts, but password resets remained email-protected and other organisation settings were not accessible because the backend checked the account parameter.
What the attacker needed
Attacker has an account and can configure SAML; attacker controls a SAML identity provider; victim's email address is known
The fix
The server should verify that the user identifier in the session token actually belongs to the organisation identifier in the same token before authorising any request.
How it was found
- Sign in as an organisation owner and configure a SAML 2.0 provider (Okta) for the attacker's organisation.
- Enable SAML authentication and user provisioning.
- In the identity provider, create a user with the victim's email address and set a password.
- Assign that user to the organisation's application in the identity provider.
- In a private browser window, go to the organisation's SAML login URL and sign in with the victim's email and the password set earlier.
- Use the resulting session to send requests that rely on the user identifier, such as editing user settings.
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 through a company's single sign-on (SAML), the system trusts an external identity provider to confirm who you are. Here, the attacker set up their own identity provider and added the victim's email address, so the system issued a login token that said 'this is the victim' but also included the attacker's organisation. The website then let the attacker change the victim's profile because it only checked the user part of the token, not whether that user really belonged to the organisation.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.