API1:2023 - Broken Object Level Authorization (BOLA)
This is a vulnerability that happens when there is no validation made to do an operation on your API therefore revealing data the consumer shouldn't have access to
This is a vulnerability that happens when there is no validation made to do an operation on your API therefore revealing data the consumer shouldn't have access to
The reason this security risk exists is due to incorrect handling of authorization a user has over a set of resources. When requests that should be unique to a user are not authorized, they can be compromised. The following image shows an explanation of this vulnerability
These are key concepts on the this vulnerability:
Authentication is the action to identifying a user, system or application. A commonly asked question to explain this is: Who are you? and following up with something that backs that up
Examples of Authentication:
Authorization is level of permissions an entity has. In this case the question we make is: What am I allowed to do?
Examples of Authorization:
Example 1: AI Chat Applications (not an actual vulnerability)
URLs like https://ai/chat/3820504f-7a7d-4ff8-9fef-19ed6c9df4c0 can contain conversation tokens. Without proper authorization, sharing or guessing this URL could expose private conversations
Impact: Exposure of sensitive personal or business discussions, potentially including confidential data shared with the AI
Example 2: Current API Solution
Our current code has URLs like https://kong.nonamesec.org/secure/user/{user-id}/settings the user id should be something that a user does not have a control over as an input. Failure to authorize will expose other users data
Impact: Asserting another users id with no validation can lead to exposure of personal data
In the example #2 we are presented a vulnerability where the user id can be passed as a parameter. A solution for this would be a refactor of the URL and the server side handling this. The changes needed are:
In Access Control Lists we can set that URL https://kong.nonamesec.org/secure/user/{user-id}/settings is only accessible for authenticated user: user@nonamesec.org
In this exercise where we are presenting an unsecure and secure API, we tried where possible to rely on Kong's API Gateway as the source of our protection, in some vulnerabilities this was not possible and changes to the server side were needed. In this case for the Broken Object Level Authorization (BOLA) we did manage to cover our vulnerable endpoints only through Kong Plugins without needing to provide a solution in the server side. The following table can be used to cover what controls we have in place:
Available on Kongs Plugin we utilized:
The two combine create a rule that only authenticated and authorized users can access their respective user information. But this still leave the door opened because there is not handling by the server side to control de Basic Auth session.