Insecure Direct Object Reference
IDOR
Introduction
Insecure Direct Object References(IDOR) occur when an application provides direct access to objects based on user-supplied input. As a result of this vulnerability, attackers can bypass authorization and access resources in the system directly, for example, database records or files.In simple words, it’s like getting sensitive information by just changing a few values in the parameter.
How to Test
Hacker identifies web application using direct object reference(s) and requests verified information. Valid http request is executed and direct object reference entity is revealed.

Direct object reference entity is manipulated and http request is performed again. Http request is performed without user verification and hacker is granted access to sensitive information.

How to Fix
Enforce access control policies such that users cannot act outside of their intended permissions.
Use hash function and use hashed values instead of normal numbers or strings.
Instead of this,
http://www.example.com/user.php?id=12
We can make it like this,
http://www.example.com/user.php?id=ea3eda3d3w2293
PHP
$RandomAccountNumber = uniqid();
move_uploaded_file($ProfilePicTemp, "Content/" . $RandomAccountNumber);
JAVA
Randomrandom=new Random();
Stringext = ".jpeg";
Filedir = new File("/home/pregzt");
Stringname = String.format("%s%s",System.currentTimeMillis(),random.nextInt(100000)+ext);
Filefile = new File(dir, name);
References
Last updated
Was this helpful?