What are Insecure Direct Object Reference (IDOR) vulnerabilities

IDORs are common, potentially catastrophic vulnerabilities that result from compromised access control in web applications.

idor2

Τα σφάλματα IDOR επιτρέπουν σε έναν εισβολέα να αλληλεπιδράσει κακόβουλα με μια web εφαρμογή χειραγωγώντας μια "direct object reference", όπως ένα κλειδί βάσης δεδομένων, μια παράμετρος ερωτήματος ή ένα όνομα αρχείου.

Καθώς μαθαίνουμε περισσότερα σε αυτό το άρθρο, θα απαντήσουμε σε βασικές ερωτήσεις όπως: "Τι είναι το IDOR;", "Πώς μπορώ να βρω μια ευπάθεια IDOR;" και "Τι μπορώ να κάνω για να προστατευτώ από μια ευπάθεια IDOR;".

How an IDOR vulnerability works

To better understand how an attacker can exploit an IDOR vulnerability, let's take a look at a real-life example. A student at a university was able to access other students' files simply by changing part of the address in his browser.

He logged into the account and noticed that the app was using the code as an identifier to retrieve his course schedule, grades and other personal information. The URL looked something like this:

https://stateuniversity.example/GetStudentRecords?ID=00123456789

Τι θα γινόταν όμως αν απλά αντικαθιστούσε το τμήμα "ID=00123456789" της διεύθυνσης URL με το αναγνωριστικό ενός άλλου φοιτητή; Το δοκίμασε και το σύστημα του έδειξε τα αρχεία του άλλου φοιτητή.

Repeating this process revealed that it was fairly simple to pull the records of any university student or employee, as long as he knew (or could guess) the student's or employee's ID. Given the sensitive data being exposed, he immediately reported the vulnerability to the university.

Πρώτον, η εφαρμογή προφανώς δεν περιελάμβανε ελέγχους εξουσιοδότησης για να δει αν έπρεπε να έχει κάποιος πρόσβαση στα αρχεία που ζητάει ("ανασφαλής" αναφορά).

Δεύτερον, το πανεπιστήμιο σχεδίασε την εφαρμογή του, βασίζοντας την αναζήτηση των εγγραφών από την βάση δεδομένων, αποκλειστικά στο αναγνωριστικό του φοιτητή/εργαζόμενου ("άμεση αναφορά αντικειμένου").

Finally, identifiers are listed in the address bar in an easily recognizable format, making handling them simple even for a cybersecurity novice.

Four common IDOR types

Nowadays, identifiers are more often found in headers or APIs than in a user's address bar. However, the dynamic nature of most websites means that identifiers and parameters are still heavily used in one form or another. Identifiers may include:

  • Database keys
  • Query parameters
  • User or session IDs
  • Filenames

How to spot IDOR vulnerabilities

IDOR vulnerabilities are often simple to exploit, but can be difficult for developers to detect. Tools and techniques such as code analysis and automated scanning are not as good at detecting IDOR bugs as many other common security issues, meaning that finding these vulnerabilities may require manual security testing.

Some ways to identify vulnerabilities include:

goner

Four types of IDOR attacks

Conceptually, most attacks exploiting IDOR work in a similar way, but there are subtle nuances in which the IDOR is exposed and/or manipulated by hackers:

1. URL tampering

URL spoofing is the simplest way to exploit an IDOR vulnerability and often requires little or nothing experience. In this type of attack, we can simply change the value of a parameter in the address bar of our browser.

In our college example, it changed the student's ID to that of other students, faculty, and staff at the university. Tools can also be used to modify the HTTP request, but the end result is the same: o grants some type of improper access to an attacker.

And if you have the advantage of knowing some of these IDs in advance then things are extremely simple. A real attacker would probably spend time enumerating different values ​​and trying to discern a predictable pattern.

Below: A simple URL spoofing attack can consist of of a single parameter identifier in an address bar.

idor1

2. Body manipulation

Body manipulation is very similar to URL tampering, except that the attacker modifies one or more values ​​in the body of a form instead of the URL. This might mean changing the values ​​of radio buttons, check boxes, or other form elements. It may also be possible to change the form's hidden values.

Perhaps a contact has a hidden form value that passes the user ID for the currently connected account. If we can change this hidden value before submitting the form, we can make our request appear to come from a different user.

3. Cookies or JSON ID manipulation

Cookies and JavaScript Object Notation (JSON) are both widely used behind the scenes to store and exchange data between the client and server, helping to make web pages more dynamic.

When we connect to a website, for example, the server may store a user or session ID value inside a cookie or JSON object. If the application contains an IDOR vulnerability, an attacker could change these values.

4. Path traversal

Path traversal, also called directory traversal, is a unique type of IDOR vulnerability that an attacker exploits to access or manipulate files or folders on the server running the web application.

This is a level deeper than other types of IDOR attacks because it allows direct access to file system resources instead of database records. Path traversal can allow an attacker to access configuration files, discover user credentials, or even obtain a fully functional shell on the target.

How an IDOR vulnerability affects data

IDOR vulnerabilities may be simple to exploit, but the effects of this type of attack are potentially devastating. Listed below are just a few ways an IDOR can affect you confidentiality, The integrity and availability of your organization's data:

  • Confidentiality - Όπως είδαμε στο παράδειγμα με το πανεπιστήμιο, μια επιτυχημένη επίθεση IDOR δίνει στον επιτιθέμενο πρόσβαση σε κάτι που δεν θα έπρεπε να μπορεί να δει. Αυτό θα μπορούσε να είναι οτιδήποτε, από έναν κωδικό έκπτωσης για τους συχνούς αγοραστές σε ένα ψηφιακό κατάστημα μέχρι ευαίσθητες προσωπικές πληροφορίες για την υγεία ή εμπορικά μυστικά.
  • Integrity - Σε ορισμένες περιπτώσεις, ένας εισβολέας μπορεί να είναι σε θέση να χρησιμοποιήσει μια ευπάθεια IDOR για να τροποποιήσει δεδομένα. Συνήθως, αυτοί οι τύποι επιθέσεων χειρίζονται παραμέτρους σε ένα αίτημα HTTP POST. Το 2020, ένας ερευνητής ασφάλειας ανακάλυψε μια ευπάθεια IDOR που θα επέτρεπε σε έναν εισβολέα να αλλάξει τον κωδικό πρόσβασης των λογαριασμών χρηστών σε διακομιστές του Υπουργείου Άμυνας των ΗΠΑ. Οι επιτιθέμενοι μπορούν να χρησιμοποιήσουν παρόμοιες ευπάθειες για να προσθέσουν μη εξουσιοδοτημένα δεδομένα, όπως παραποιημένες οικονομικές πληροφορίες ή ενοχοποιητικά έγγραφα σε έναν ανυποψίαστο χρήστη.
  • Availability - Το IDOR μπορεί επίσης να χρησιμοποιηθεί καταχρηστικά για να επηρεάσει τη διαθεσιμότητα των πόρων. Φανταστείτε μια συνάρτηση σε μια εφαρμογή PHP που διαγράφει έγγραφα με βάση το όνομα του αρχείου. Χωρίς κατάλληλους ελέγχους εξουσιοδότησης, ένας εισβολέας μπορεί να είναι σε θέση να αλλάξει το όνομα αρχείου και να διαγράψει έγγραφα στα οποία δεν έχει καν πρόσβαση!

Four tips to prevent IDOR vulnerabilities

IDOR vulnerabilities can be prevented by avoiding direct object references, implementing user input validation, and implementing globally unique identifiers (known as GUIDs) or random identifiers. While there is no foolproof solution when it comes to preventing IDOR vulnerabilities, some of the steps below can help.

1. Implement appropriate access control and session management

Η OWASP, η οποία επινόησε τον όρο "Insecure Direct Object Reference" (ανασφαλής άμεση αναφορά αντικειμένου), θεωρεί ότι το IDOR είναι πάνω απ' όλα ένα ζήτημα ελέγχου πρόσβασης. Οι κατάλληλοι έλεγχοι πρόσβασης και τα χαρακτηριστικά διαχείρισης των sessions θα πρέπει να αποτρέπουν έναν κακόβουλο χρήστη από το να μπορεί να έχει πρόσβαση ή να χειρίζεται δεδομένα, ακόμη και όταν χρησιμοποιούνται εύκολα αριθμητικά αναγνωριστικά. Τα cheat sheets του OWASP σχετικά με την authorization and authentication may be useful to study them.

2. Avoid direct object references

Access control issues aside, using direct object references in your application is often considered a poor coding practice. This is especially true when it comes to sensitive data, such as student/employee IDs, account numbers, etc. Indirect object references, often in the form of either reference maps or hashes, address IDOR vulnerabilities by hiding the actual identifier, which remains hidden on the server side. If hashes are used, be sure to include a strong and unique identifier, as basic hashing algorithms like MD5 are easy to crack.

3. Use GUIDs or random identifiers 

In applications that use iterative or sequential identifiers or parameter values, enumerating an insecure direct object reference vulnerability is a breeze. If we notice that the user ID looks like something like 0001, for example, we can make an educated guess that user 0002 also exists. Modern computing power and automation techniques make it easy enough to then try every possible value from 0000 to 9999 until we find the user we are looking for.

Neither GUIDs nor globally unique identifiers remove the underlying vulnerability, but they make enumeration and exploitation much more difficult. An ID like f492325c-ae75-4335-a2a6-1a716b723f2a is much harder to decrypt than something less complicated.

4. Validate user input

Validating user input can help mitigate a large number of security issues, including IDOR. Enumeration of identifiers becomes much more difficult if we strictly validate user-supplied parameters for the correct length and format. Validation can take place either client-side or server-side, whichever is more appropriate.

IDOR vulnerabilities: Another threat that should worry us

IDORs are just one potential threat to your organization's data security, and one that can unfortunately require a lot of manual effort to detect and remediate.

There are many tools that can help you automate your privacy and strengthen your protection against resource-consuming threats like ransomware, freeing up time for your most critical tasks.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.087 registrants.
idor, hack, security, vulnerability

Written by Anastasis Vasileiadis

Translations are like women. When they are beautiful they are not faithful and when they are faithful they are not beautiful.

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).