1 What is IDOR?
Insecure Direct Object Reference (IDOR) occurs when an application uses user-controllable input to directly access objects (database records, files, accounts) without verifying that the requester is authorized to access that specific object.
Classic example — order lookup with no authorization check:
@app.route('/api/orders/<int:order_id>')
@login_required
def get_order(order_id):
# BUG: only checks that the user is logged in, not that they OWN this order
order = Order.query.get_or_404(order_id)
return jsonify(order.to_dict())
An attacker who owns order #1001 simply increments the ID to #1002, #1003, etc. to read every other customer's order. The application authenticates the user but does not authorize access to the specific resource.
IDOR is ranked #1 in the OWASP Top 10 as "Broken Access Control". It appears in APIs, file downloads, profile pages, admin endpoints, and anywhere a reference to a backend resource is exposed to the client.
Common IDOR patterns include: sequential integer IDs in URLs, GUIDs in query strings, filenames in parameters, and account numbers in POST bodies.