Test default scopes for bypass

Insecure direct object reference (IDOR)Discovery

Written with a model's help from “Killing IDORs in Rails Applications: Make the Database Say "No" By Default” on PentesterLab. Read the writeup before relying on it.

When testing a Rails application, try using the unscoped method to bypass default scopes. This can help you identify potential IDORs (Insecure Direct Object References) by removing tenant boundaries or other authorization checks. Look for instances where unscoped is used to bypass specific default scopes, and verify that it does not inadvertently remove other important constraints. You can use a tool like Rails' console to inspect the SQL queries generated by unscoped and unscope(where: ...). For example, compare the queries generated by Product.unscoped and Product.unscope(where: :deleted_at) to see the difference in the constraints applied.

Follow #authorization or #rails for new tips like this one, on your notifications page and, if you choose, in a daily or weekly email.

Comments

No comments yet.