Why are These Vulnerabilities So Prevalent? A01 Broken Access Control
Intro
In my last blog post, I walked through a blind out-of-band SQL Injection vulnerability I discovered during a web application pentest and the complexities / difficulties I faced during that engagement. In this post we’re going to look at Broken Access Control which is #1 on the OWASP Top 10.
IDOR is a type of Broken Access Control that is commonly showcased across blogs and courses, mainly because it is easy to understand, but the main underlying problem of all Broken Access Control vulnerabilities is that applications and APIs don’t check whether the user is authorised to do what they’re attempting to do.
I have found several serious BAC issues on real engagements this year, infact it is one of my most common findings in webapp pentests, particularly in complex web applications, and that has prompted me to do deeper research into why these vulnerabilities occur in the first place alongside the more difficult to find issues. We’ll start with why Broken Access Control is so common and then go and exploit abit of a trickier IDOR case.
Why is it still A01?
According to the OWASP top 10 2025 100% of the applications tested had some form of broken access control, with 40 CWEs falling under this category, keeping it at the #1 spot. There were over 1.8 million total occurrences, 32,654 associated CVEs, and an average weighted exploit score of 7.04. In 2021 broken access control also sat at #1 on the list with over 318,000 instances and 94% of applications being tested for some form of it. The API top 10 similarly lists three of its top five as access control vulnerabilities: Broken Object-Level Authorization (BOLA), Broken Function-Level Authorization (BFLA), and Broken Object Property-Level Authorization (BOPLA).
So, why exactly is Broken Access Control so common? Building a secure access control system in a complex application is difficult. Unlike vulnerabilities like SQL injection and XSS which have consistent and repeatable mitigations (parameterised queries, output encoding, etc.), access control is fundamentally a logic problem. The authorisation check for viewing a user’s profile settings is different than the check for editing a user’s document, which is different from accessing paid custom functionality, or deleting the user account altogether, and so on.
To illustrate, consider a healthcare application. A patient logs in to view their records and their browser sends GET /patients/5/records. The backend now has to confirm two things: that the request is authenticated and that this session is actually allowed to read record 5, whether because the user is patient 5 or because they have a legitimate reason to be there, such as being the doctor or a sysadmin. The first check is obvious but the second one is often missed. Further, if the patient can see their own ID in the request, what stops them from changing 5 to 6? If the backend only checks that the request is authenticated and never checks whose record is being asked for, then GET /patients/6/records will just hand over the 6’s medical history, diagnoses, prescriptions, and anything else in their “records”. Because the IDs are sequential, patient 5 could also then just script a loop from 1 to N and walk the entire patient database, extracting all patient records.
The above is a simple example. Modern applications are unfortunately not as simple, they’re not built like they used to be, a system with 50 microservices can have over 500 API endpoints with single requests potentially triggering 10-20 internal API calls across different services. Each of those services needs to check whether the user is allowed to do what they’re asking, and the problem is that in a lot of modern architectures, service A checks the user’s token and then calls service B internally, and service B trusts it because it came from inside the network. Service B then calls service C to pull the actual data, and service C trusts the request because it came from service B. Introduce D and E and things start getting very complicated. Ultimately if that first check on service A is wrong or missing then everything downstream of that may be vulnerable.
Vulnerability scanners?
You might be wondering if Broken Access Control is so common, why don’t vulnerability scanners find it? Most automated detection in scanners is built to detect the presence of something dangerous, it injects various malicious payloads into the application and monitors the response for something that shouldn’t happen, such as a database error, a reflected <script> tag, or time delays that correlate with the injected payload. A 200 ok response displaying another users sensitive patient data is not an error or anomaly, from a scanners perspective nothing looks out of place the application has simply returned a valid response.
The burden mainly falls on the people writing and reviewing the code manually rather than automated tooling. To get a sense of that side of it, I asked a few developers why they think these vulnerabilities are so common. A common answer I received was that access control mostly comes down to human discipline. One software engineer put it like this:
Access control necessarily involves some cognitive overhead and engineering responsibility. Not all business rules can/should be captured as middleware. If they are, you need to remember to add it correctly. If it is not, like in the case of “can authenticated user x mess with y”, this will be captured at the handler level. Without discipline and a good code review system it’s easy for these things to slip through the cracks. No linter or CI/CD pipeline can catch semantic mistakes like this for you. - Maximilian, Software Engineer
So, similarly to the vulnerability scanner problem, a linter won’t catch it for the same reason Burp Suite won’t, because there’s nothing actually wrong with the code, it runs fine and returns a valid response, except really it is disclosing very sensitive patient data to an unauthorised user.
The responses I received align with day-to-day pentesting as well, as I mentioned earlier in this post, on nearly every webapp engagement I’ve done this year I’ve found some form of BAC. Several of my colleagues have also found some very serious issues while on webapp tests, everything from textbook IDOR to full privilege escalation to admin and account take overs. I felt it was worth writing about for this reason, these vulnerabilities aren’t edge cases they are very common, simple, and often have a high impact.
What about AI?
A big question in 2026 is whether any of this matter now that models can read code and reason about it. There is a growing market of agentic pentest tools, some of which attempt to do what a pentester would do when testing for BAC issues, they are given several accounts across different roles and then similar to the Burpsuite Autorize plugin, repeat the same requests, compare the responses, and flag where a low-privilege account gets something back that only a higher-privileged one should.
AI struggles with business logic, where it hasn’t been directly fed the context it needs and even then it will struggle to understand where it fits into existing code. Take a banking app for example that lets staff move money in two steps, one person raises a payment and the second person approves it before it leaves. The business rule is that the two can’t be the same person. If the approval endpoint checks that the caller has the approver role but never checks that the approver isn’t the same account that raised the payment, then anyone with an approver account can raise a payment and also approve it, sending money out on their own. AI using an Autorize-style diff would likely miss this because every approver can approve payments, so comparing two approver accounts shows the same allowed behaviour for both, and comparing the payment raiser against the approver only confirms that the raiser can’t approve, which is the check working as intended. In many cases the rule isn’t in the traffic or the code so a model reading the requests has nothing to go off of and requires human input.
Right, lets get into the fun stuff!!
Broken Access Control - hackxpert lab
Before I get into it I want to give a quick shout out to Wesley Thijs, aka The XSS Rat, who built the hackxpert labs I’m using for this part. He kindly gave me access to the private repo so I could go through the source code and write about it. If you don’t already follow him, he’s a hacker who’s spent years teaching web app security through his labs, courses and bug bounty streams.
The lab is filed under “second-order IDOR” but it more like a client side access control check. The application is a products grid, three products each with an id, a name and a price, and you update them by clicking a cell. The application says that you’re not allowed to update product 1 - “you can’t update product number 1, or can you? Make the system work for you.” There’s also a CSV upload on the page for editing products in bulk. Product 1 = no touchy.
You can’t edit product 1 in the browser because the cell won’t take a cursor and the row’s greyed out, while product 2 and 3 edit fine. There is an example CSV file download, so lets upload that and have a look at the request.
So the example CSV data is 99,'newProduct',19.99. Uploading it sends a POST request to the products page with the file attached.
It seems that because product ID 99 didn’t exist, the import has added it as a new row in the grid.
This tells us that there clearly no check on whether you’re allowed to set the ID you send, it just accepted 99 and added it as a new row. So what happens if we change that 99 to 1?
Nice! We have changed product 1, and put a stupidly long number in the price which it gladly accepted.
So that’s it from the black box side, lets have a look at the code.
The front end blocks making changes to product 1 in a few places. The first is this:
This puts contenteditable="false" on product 1’s cells and true on the rest, and puts a read-only class on product 1’s row. So the server works out one time when it renders the page which rows you can edit, then hands that off to the browser to enforce. A little side quest also, <td><?php echo $product['productName']; ?></td> is echoing the value out with no encoding, so you can just set the name to something like <img src=x onerror=alert(document.domain)> and get stored XSS when the grid renders.
The CSS then greys the locked row so it looks disabled:
And app.js only attaches the save handler to the cells that are editable:
So product 1’s cells don’t have the edit listener, which is why clicking the row does nothing. All of it runs in the browser.
This is the server-side code that handles the upload:
It reads the id out of each line $productID = $line[0] and passes it to a lookup that finds a matching product:
If nothing matches, the id gets added as a new product. If something matches, this line overwrites that product with the row from the file:
There’s no check for product 1 anywhere in here. The import looks the id up, but only to decide whether to add or overwrite, it never checks whether you’re allowed to write that id. So when I put 1 in the file, the lookup found the real product 1 and the record got replaced.
The ID comes out of the CSV as a string, but the stored one is an integer. The lookup uses loose equality though, so “1” == 1 matches anyway. From there it just overwrites the whole product record and has no validation on any of it, which is why the stupidly long number got in there.
Second-order IDOR - PatientPortal
For this next part I’ve gone and built my own vulnerable app, a little patient portal in Python and Flask. This one’s a second-order IDOR. Instead of explaining the differences between normal IDOR and second-order IDOR in tediously long paragraphs I’m just going to walk you through it.
We log in with the credentials alice and password123.
So looking at the application as a normal user, we are logged in as Alice Bennett, and under my records we have “repeat prescription” and “blood test results”. When we view “repeat prescription” in the browser it takes us to /record/view where we can see some notes about our repeat prescription.
Going back to “My Records” and enabling burpsuite intercept, lets see what the request looks like when we click “View”:
Aha! Instead of going to /record/view a request to /record/open?id=1 is made first. This id=1 is an object reference and is the kind of thing that stands out to an attacker. The first thing worth trying is a textbook classic IDOR, lets send it to repeater and change the id to a record that isn’t ours and see if it gives it us.
Changing it to id=5 gives us a 302 redirect to /record/denied which is a 403 page, the 403 page then tells us we’re not allowed that record.
So /record/open must do a check on whether the record is ours before it shows it, this means that the textbook IDOR is a dead end. This is the point where a scanner, or AI with Autorize-style diff, might mark it as normal and move on, infact, this is something that could even make a lot of pentesters think it is a dead end. It redirects to a 403 correctly, so the PatientPortal application is secure… or is it?
What happens if we simply ignore the 302 redirect?
Clicking “View” didn’t only hit /record/view, it went to /record/open?id= first, and that redirected us on to /record/view or /record/denied depending on whether we are authorised to view the record.
So /record/open denied us but /record/view seems to be a separate request. Lets see what happens if we directly go to /record/view after trying to access /record/open?id=5.
Hm, Bobs next appointment regarding his anxiety, wait, who the heck is Bob?! We’re logged in as Alice, but we’re looking at Bob’s confidential appointment notes!
This is what makes it a second-order IDOR rather than the classic one we tried first, the id we’re not allowed isn’t used on the request we send it on, it gets stored by the app and then trusted on a later request.
Now let’s look at the code and see why.
There are three routes involved.
First, /record/open, the one we sent the id to:
There’s an ownership check in here, _owns, this checks the record belongs to the user we’re logged in as:
If the record is ours we get redirected to /record/view, and if it isn’t we get sent to /record/denied. This check is technically correct.
The problem is this line above the check:
It saves our id into the session as an object reference, without checking whether we’re allowed that object. So by the time the check runs and decides to deny us, that reference is already saved.
Next is /record/view:
This one reads that reference back out of the session and shows the record it points at. There’s no ownership check on it, it just shows whatever /record/open puts there. So between the two, /record/open saves our object reference whether we’re allowed it or not, and /record/view shows whatever’s saved without checking. We ask for record 5, /record/open denies us but saves the reference to 5 anyway, then we hit /record/view and it reads 5 and shows it to us.
So why did we have to skip the denied page? Why couldn’t we just follow the redirect and then visit /record/view?
Here’s /record/denied:
It pops the reference back out of the session. When we followed the redirect earlier and landed on the denied page, that’s what cleared our stored reference, so if we’d gone to /record/view after seeing the denied page it would’ve had nothing to show. The reason the attack worked is we went straight to /record/view without loading the denied page in between, so the reference was still sitting in the session when view read it.
So now that we understand this vulnerability and that we can access other patients data, as an attacker we don’t want to stop at Bob’s data, we want to extract all of the patient data from the portal. Doing it by hand one record at a time would be tedious and slow, there could be hundreds of patient records in the application. Since the vulnerability is the same every time, we can write some code to automate the extraction, /record/open?id=N to load the reference into the session, then /record/view to read it back, for every id in turn, and scrape the record out of the response.
We can’t follow redirects because it will lands us on /record/denied which pops the reference straight back out and leaves /record/view empty. So the script logs in once, then for each id sends the open request without following the redirect, sends the view request, and pulls the record title and body out of the page.
Nice, we wrote an exploit and pulled every patient record out of the portal, and on record 11 there’s a little flag. :D
In conclusion the application looked secure, it logged us in, showed us our own records, and blocked us when we tried to access someone else’s. But the check was on the wrong request. /record/open decided whether to let us in, and /record/view gave us the data without checking anything. A simple but at the same time subtle and tricky vulnerability that is not easy to spot.
I may put PatientPortal on my GitHub at some point so you can have a go yourself!
Wrapping up
So that’s a couple of real cases of broken access control, and hopefully some idea of why it’s still at number one on the OWASP list. Every endpoint and every action needs its own check on whether the user’s actually allowed it, it only takes one to get missed and it won’t always be obvious.













