- by x32x01 ||
OAuth scopes are supposed to limit what an application can access after a user grants permission. But what happens when an access token issued with identity-only scopes can also read sensitive data from a REST API?
This scenario demonstrates a potential Broken Access Control issue caused by improper OAuth scope enforcement, where an application authorized with openid profile email could access additional API resources that were not disclosed on the consent screen.
On the consent screen, the user was told: “Read your full name and email address.”
This suggested that the application only needed access to basic profile information, such as the user's name and email address.
After the user approved the request, the application received an Authorization Code and exchanged it for an Access Token through:
The returned token was associated with the requested identity scopes, which was the expected behavior at this stage.
Despite being issued with identity scopes, the token could read additional resources through several API endpoints, including:
An application authorized with identity-only scopes could potentially access additional resources, including:
This scenario demonstrates a potential Broken Access Control issue caused by improper OAuth scope enforcement, where an application authorized with openid profile email could access additional API resources that were not disclosed on the consent screen.
🔎 How the OAuth Authorization Flow Worked
1. Identity-Only OAuth Scopes
The application requested authorization using the following scopes:openid profile emailOn the consent screen, the user was told: “Read your full name and email address.”
This suggested that the application only needed access to basic profile information, such as the user's name and email address.
After the user approved the request, the application received an Authorization Code and exchanged it for an Access Token through:
POST /trust/oauth/tokenThe returned token was associated with the requested identity scopes, which was the expected behavior at this stage.
2. Broken Access Control: Improper Scope Enforcement
The issue appeared when the identity-only Access Token was used against REST API endpoints instead of being limited to identity-related resources.Despite being issued with identity scopes, the token could read additional resources through several API endpoints, including:
/api/v2/projects/api/v2/flags/default/api/v2/members/api/v2/tokens/api/v2/integrations/api/v2/webhooks/api/v2/projects//environments//sdk-keys
200 OK, indicating that the API accepted the token and returned the requested data.🚨 Why Is This a Security Vulnerability?
OAuth scopes are intended to restrict what an application can access. In this case, there was a mismatch between the permissions presented to the user and the access actually granted by the API.An application authorized with identity-only scopes could potentially access additional resources, including:
- Project information and configurations.
- API token metadata.
- Webhooks and integrations.
- Environment SDK keys.
- Team members' information, email addresses, and roles.