Application Programming Interfaces (APIs) are at the heart of modern applications, enabling functionality, communication and acting as a bridge between different software components.
A common issue that’s found though is Broken Function Level Authorization (BFLA), and this sits at the OWASP API Top 10 2023 Candidate list in position number 5. Let’s take a closer look at this vulnerability.
BFLA allows unauthorized users to access functionality in API endpoints that should be restricted. The payloads used during these attacks often look completely legitimate and pass-through controls such as Web Application Firewalls.
- An e-commerce site has a GET API endpoint to view customer order details /api/v1/orders/:orderId
- This endpoint allows customers to view their own orders, and uses the logged-in user’s ID to verify the access
- After further enumeration, it’s apparent that the DELETE method is available for the same endpoint. Changing the HTTP method from GET to DELETE allows an attacker to remove any order they want, provided they have the order ID, from the system.
In this case, the attacker has access to functionality that should be restricted, and this is a common oversight in many API-driven applications.
If you prefer to watch, a live example can be found on our weekly live stream here: https://www.youtube.com/watch?v=KvantKohRUU
Testing for BFLA
There are a number of approaches we can use to test for BFLA issues. When working with a larger set of APIs it makes sense to build a collection and try to automate this process, however, there may also be times when you need to step through endpoints manually for deeper analysis.
- Understand the user roles and permissions
- What roles exist?
- What is a user supposed to do?
- What can a user actually do?
- What can admins do?
- Map API endpoints to functions
- What API endpoints exist?
- What functionality do they offer?
- Test both authenticated and unauthenticated requests
- Setup Authorize in BURP Suite
- Can you access the same functionality with different user roles?
- Manipulate or fuzz HTTP methods for each endpoint
- Check for authorization across a series of operations
- Is your access verified at step 1?
- Is your access verified at step 2, step 3, etc?
- Keep an eye out for odd behaviour and error messages
APIs are the conduits that drive our connected world, enabling seamless interactions between diverse software systems. However, they are a real target for malicious actors. Broken Function Level Authorization (BFLA) is just one of many vulnerabilities that can impact API-driven systems and other similar vulnerabilities can be found on the OWASP API Top 10, or the more recent Candidate List.