Skip to main content
Cyber Security Intermediate Scenario-Based Topic: OWASP API Security

Explain Broken Object-Level Authorization (OWASP API1 BOLA) and how to prevent it

Quick Summary: Broken Object-Level Authorization (BOLA/IDOR) occurs when an authenticated endpoint accepts a record ID (/api/invoices/1042) without verifying server-side that the logged-in user owns or has permission to access that specific resource.

Written by Ravi Shankar Mishra (Founder & Lead Systems Architect, MockAttempt Academy) Reviewed by MockAttempt Engineering Editorial Desk
Last verified:

Direct Interview Answer

Authentication ≠ Authorization. Even if an API checks a valid JWT token, failing to verify ownership on every object ID lookup lets attackers enumerate IDs sequentially and read or tamper with another user’s invoices, mock results, or PII.

Detailed Technical Explanation

Relying on random UUIDs alone is security-through-obscurity—UUIDs leak in URLs, Referer headers, and logs. Enforce ownership predicates directly at the repository/policy layer (WHERE id = ? AND user_id = ? or framework Policies) and return 403/404 consistently.

Practical Walkthrough

Scoped Laravel policy / controller guard isolating guest tokens and user ownership strictly.

Code Example — PHP
// Vulnerable: MockAttempt::findOrFail($id) directly exposes other users' records!

// Secure: enforce strict ownership predicate server-side
public function showAttempt(Request $request, MockAttempt $attempt)
{
    abort_unless(
        $attempt->user_id !== null && (int) $attempt->user_id === (int) $request->user()?->id,
        403
    );

    return view('practice.result', compact('attempt'));
}
Expected Output / Verification
Unauthorized cross-user attempt access cleanly rejected with HTTP 403.

Real-World Production Use Case

Securing fintech account statements, medical records, assessment results, and multi-tenant SaaS admin endpoints.

Common Interview Mistakes to Avoid

  • Swapping auto-increment IDs for UUIDs without adding server-side ownership checks.
  • Hiding unauthorized UI buttons in React while leaving the backend API unguarded.
Topics: #cyber-security #owasp #bola #idor #authorization
Learn. Practise. Prove. Get Career-Ready.

Ready to Build Your IT Career?

Explore industry-led programmes and develop practical skills through training, assessments and interview preparation.