How I Exploited IDOR in an Encrypted Mobile API with Frida
An Android app encrypted the request and response bodies of a card-details API, but the mobile number used to look up cards was taken from a client-side value. By hooking the app with Frida, the researcher changed that value and retrieved another user's card details.
Published on systemweakness.com
I am writing this blog to share my recent experience in the Android application Pen testing. I came across an application with functionality to show the user’s card details.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server authorised the card lookup only by the mobile number supplied in the request, without tying it to the authenticated user, and the client-side encryption gave a false sense of protection.
Impact
An attacker could retrieve the card details belonging to other users by changing the mobile number in the request.
What the attacker needed
Android app installed; Frida and Jadx available; a valid account
How it was found
- Notice that the showCard API call has an encrypted request and response body while other calls do not.
- Use Jadx to find the encryption and decryption functions and the JSON values passed to them.
- Use a Frida script to print the request and response bodies before encryption and after decryption.
- Find the mobileNumber parameter in the request body and the CardPrefs class with getMobileNo().
- Write Frida code to control getMobileNo() and supply a different mobile number.
- Run the script and observe card details returned for another user's number.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
An IDOR is when a server trusts an identifier sent by the app, such as a phone number, and returns whatever record matches it without checking that the record belongs to the person asking. Here the app encrypted the traffic, which looks safe, but the phone number inside was still chosen by the app, so changing it changed whose card details came back. Frida is a tool that lets you alter a running app's code in memory to see or change values.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.