Skip to content
IDOR Write-up Intermediate

Exploiting vulnerabilities in iOS Application

The iOS app used the user's email address as the sole identifier for viewing and updating profile details, and did not enforce server-side access control, allowing an attacker to read or modify other users' profiles. The change PIN endpoint also lacked rate limiting, enabling brute force of the old PIN for any known email, leading to account takeover.

Raj Singh Chauhan Follow

Published on lonewolf-raj.medium.com

Hello Everyone, Here I’m going to share one of my findings which I got while enumerating iOS application, below are my findings and the process of exploiting the vulnerability. let’s assume the application/hostname as “application.com” OS -> Kali Linux Device -> iOS

Raj Singh, on lonewolf-raj.medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

The target is an iOS application, referred to throughout as application.com. The application has a profile section from which a user can view and modify their own details, and a change PIN function that requires the current (old) PIN before setting a new one. In both the profile view and profile update requests, the application uses the user's email address as the identifier (UID) for the user being acted on.

The researcher found two issues: an improper access control flaw on the profile view and update endpoints, and an account takeover path through brute forcing the old PIN in the change PIN function. The first gives an attacker a valid victim email address and the ability to change the victim's registered mobile number, which the report says can lead to takeover via the forgot password recovery PIN. The second lets an attacker with a valid email address brute force the old PIN and set a new one.

Setup

  • OS: Kali Linux.
  • Device: iOS.
  • The application had jailbreak detection and SSL pinning enabled.
  • Jailbreak detection was bypassed with the Liberty tool.
  • SSL pinning was bypassed with SSL Kill Switch 2.
  • Both tools are available in Cydia. The researcher also mentions Frida with objection as an alternative for both bypasses.

With both protections bypassed, the researcher could intercept the application's traffic and inspect the requests and responses.

Finding it

While enumerating the application, the researcher intercepted the profile view and profile update requests. In both, the application sends the user's email address as the UID field to identify the user in the request. That is the signal: a user-controlled identifier that names the record being read or written, rather than being derived from the authenticated session.

Exploitation

Step 1: View another user's profile

The view details request was URL-encoded; below is the decoded request as shown in the report.

Text
…
},"requestData":{"serviceid":42,"UID":"ANONYMOUS****@GMAIL.COM****","LANG_ID":"EN"}}}}]
….

The UID field carries the email address of the account whose details are being requested. The response returns the profile record for that email:

Text
…
”ProfileDetails\”:{\”MOBILE\”:\”9479XXXX\”,\”PROFILE_IMAGE\”:\”\”,\”DOB\”:\”20\”,\”GENDER\”:\”male\”,\”EMAIL\”:\”[redacted]\”,\”NAME\”:\”blabla\”}}”,
…

Replacing the UID with the email address of another user returns that user's profile details. The application does not validate the session against the requested record; it responds only on the basis of the email supplied in the request.

Step 2: Update another user's profile

The update details request follows the same pattern. The UID identifies the account being modified, and the remaining fields carry the new values:

Text
…
”UID”:”a****[redacted]”,”EMAIL”:”[redacted]”,”NAME”:”Attacker”,”MOBILE”:”12345",”LANG_ID”:”EN”,”DOB”:”20",”PROFILE_IMAGE”:””}}}}]
….

The response confirms the write:

Text
…
”RESPONSE”:”{\”status\”:\”Profile details has been successfully updated.\”,”statusCode”:200
….

Because the session is not checked against the UID, an attacker can point the request at a victim's email address and change the profile fields, including the registered mobile number.

Step 3: Account takeover through the mobile number

The researcher notes that the email parameter can be brute forced, which would allow reading and modifying sensitive information of registered users: username, gender, age and registered mobile number. The update capability extends this: the attacker can set the victim profile's MOBILE field to a number they control. The application has a forgot password facility that sends a recovery PIN to the registered phone number, so with the mobile number replaced, the attacker can request the recovery PIN on their own number and take over the victim account.

From the original on lonewolf-raj.medium.com

Step 4: Brute force the old PIN on the attacker's own account

On further enumeration, the researcher looked at the change PIN functionality. The request takes the UID, the OLD_PIN and the NEW_PIN:

The researcher was able to brute force the old PIN of the current user ([redacted], the attacker's own account) because there was no rate limit on the OLD_PIN check.

Step 5: Brute force the victim's old PIN

Having obtained a victim email address through user enumeration, the researcher changed the UID from the attacker's address to the victim's and generated a brute force pattern for a 4-digit PIN:

Text
…
”requestData”:{"serviceid":40,"UID":"[redacted]","OLD_PIN":"8634","NEW_PIN":"1234",LANG_ID":"EN"}}}}
…

After a certain number of tries, the change succeeded:

Text
…
“isSuccessful”:true,”responseTime”:182,”RESPONSE”:”{\”header\”:{\”status\”:\”PIN had been successfully changed.\”,\,\”TYPE\”:\”M\”,\”status\”:\”1\”}}”,”statusCode”:200
…

With the PIN changed, the attacker controls the victim account.

Root cause

The profile issue comes from the application trusting a client-supplied email address as the identity of the record being read or written. Access control is not enforced server-side against the authenticated session, so any request naming another user's email is processed as if it were that user's own request. The report's remediation section states the principle directly: access controls should enforce record ownership rather than accepting that the user can create, read, update or delete any record.

The change PIN endpoint takes the UID from the request and has no limit on the number of attempts. The researcher generated a brute force pattern for a 4-digit PIN, and after a certain number of tries the change succeeded.

Impact

The researcher notes that brute forcing the email parameter would allow an attacker to read and modify sensitive information of registered users (username, gender, age, registered mobile number). Changing the mobile number enables account takeover through the forgot password recovery PIN sent by phone. Separately, an attacker with a valid user email address can brute force the old PIN of that account and set a new PIN, taking over the account. The report does not state how many attempts the PIN brute force required.

Fix

The report gives two remediation points:

  1. IDOR: enforce access control in trusted server-side code, where the attacker cannot modify the check or its metadata. Model access controls should enforce record ownership rather than accepting that the user can create, read, update or delete any record.
  2. No rate limit on the old PIN: limit the number of PIN change requests, add anti-bot detection such as CAPTCHA, and return HTTP 429 for too many requests.
From the original on lonewolf-raj.medium.com

Variants to test

  • Email or other identifier as UID in profile endpoints. On other targets, swap the identifier in view and update requests for another account's value. A positive result is a response containing the other user's profile fields, or a success status after an update.
  • Mobile number change followed by password recovery. Where a profile update accepts a phone number and recovery is by SMS, change the number to one you control and request recovery. A positive result is a recovery PIN arriving at your number for the victim account.
  • PIN or password change without rate limiting. Send repeated change requests with varying OLD_PIN values against a known account. A positive result is a success response within a feasible number of attempts, with no lockout, CAPTCHA or 429.
  • Short numeric secrets generally. Any 4-digit PIN, OTP or recovery code checked server-side without attempt limits is worth testing the same way, watching for differences in response time or status that reveal a correct guess.
  • Jailbreak and SSL pinning bypass on iOS targets. Use Liberty for jailbreak detection and SSL Kill Switch 2 (or Frida with objection) for pinning, then inspect the traffic for the identifier patterns above.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

A security researcher tested an iPhone app (called application.com in the write-up) and found two problems that, used together, let someone take over another person's account.

The first problem was in the profile section. When the app asks the server for your profile details, or asks it to save changes to your profile, it tells the server who you are by sending your email address in a field called UID. The server believed whatever email was in that field. So if you put someone else's email there, the server happily showed you their details, or saved changes to their account. That kind of bug is called an IDOR (Insecure Direct Object Reference): the app hands you a name tag for a record and never checks that the record is actually yours.

The second problem was in the change PIN function. A PIN here is a short numeric password, four digits in this app. To change your PIN you must first type your old one. The server let you try as many old PINs as you liked, with no limit. Four digits is only 10,000 possible values, so a computer can simply try them all. Once the right old PIN is found, the attacker sets a new PIN and owns the account.

The profile bug lets an attacker change the victim's registered mobile number to one the attacker controls, which the report says can lead to takeover via the recovery PIN. The app has a "forgot password" feature that sends a recovery PIN by SMS to the registered number. With the number swapped, the recovery PIN arrives on the attacker's phone. Separately, the PIN bug lets an attacker with a victim's email address guess the old PIN and set a new one.

Below is the whole story, step by step, with the actual requests the researcher captured.

The setup: getting a look at the app's traffic

When an app talks to its server, it sends requests and receives responses, much like a browser does when you load a web page. If you can watch that conversation, you can see exactly what the app sends, including any identifiers it uses. On a phone this is harder than on a computer, because the app may actively resist being watched.

Two protections stood in the way here:

  • Jailbreak detection. A jailbreak is a way of removing Apple's restrictions from an iPhone so you can install software Apple would not allow. Apps often check for a jailbroken phone and refuse to run, because a jailbroken phone makes it easier for someone to inspect or tamper with the app. The researcher bypassed this check with a tool called Liberty.
  • SSL pinning. SSL (more precisely TLS) is the encryption that protects traffic between an app and a server, the same technology that puts the padlock in your browser. Normally your computer or phone trusts a list of certificate authorities to vouch for a server's identity. Pinning means the app refuses to trust anything except one specific certificate, hard-coded inside it. That stops the usual trick of putting a fake certificate in the middle to read the traffic. The researcher bypassed pinning with a tool called SSL Kill Switch 2.

Both tools are available in Cydia, an app store for jailbroken iPhones. The researcher also mentions Frida with objection as an alternative for both bypasses. The environment was Kali Linux on the computer side and an iOS device on the phone side.

With both protections out of the way, the researcher could intercept the app's traffic and read the requests and responses. That is the starting point for everything that follows: you cannot find a bug in a request you cannot see.

Finding it: the email address as a name tag

While going through the app, the researcher looked at two features in the profile section: viewing your details and updating them. In both requests, the app sends the user's email address in a field called UID. UID stands for user identifier: it is the name tag the app uses to tell the server which account the request is about.

That is the warning sign. A well-built app works out who you are from your logged-in session (the proof that you signed in), not from a value you type into the request. When the name tag comes from the request itself, you can usually change it to someone else's name tag.

Step 1: Viewing another user's profile

The view request was URL-encoded, meaning special characters were replaced with codes so the request could travel safely. The report shows the decoded version, which is easier to read:

Text
…
},"requestData":{"serviceid":42,"UID":"ANONYMOUS****@GMAIL.COM****","LANG_ID":"EN"}}}}]
….

Line by line:

  • The … marks show that this is a fragment of a larger request; the report only quotes the interesting part.
  • requestData is the section of the request that carries the actual instructions, as opposed to headers or other plumbing.
  • serviceid is a number that tells the server which operation is being asked for. 42 here means "show me profile details".
  • UID is the email address of the account whose details are wanted. In the researcher's own test it is their own address, partly masked with asterisks in the write-up.
  • LANG_ID says which language the response should be in; EN means English.

The server answered with the profile record for that email:

Text
…
”ProfileDetails\”:{\”MOBILE\”:\”9479XXXX\”,\”PROFILE_IMAGE\”:\”\”,\”DOB\”:\”20\”,\”GENDER\”:\”male\”,\”EMAIL\”:\”[redacted]\”,\”NAME\”:\”blabla\”}}”,
…

Line by line:

  • ProfileDetails is the container holding the account's information.
  • MOBILE is the registered mobile number, partly masked in the write-up.
  • PROFILE_IMAGE is the profile picture; here it is empty.
  • DOB is the date of birth, shown as 20.
  • GENDER is male.
  • EMAIL is the account's email address.
  • NAME is the display name, blabla in this test account.

The backslashes are escaping: they tell the parser that the quote marks are part of the text rather than the end of a value. They are an artefact of how the data is wrapped, not something you need to worry about.

The important part is what happened next. When the researcher replaced the UID with another user's email address, the server returned that user's profile details. It did not check whether the session making the request belonged to that email. It answered purely on the basis of the email supplied in the request. That is the IDOR: the server accepted the name tag from the customer instead of checking it against the customer's own identity.

Step 2: Updating another user's profile

The update request follows the same pattern. UID says which account is being changed, and the other fields carry the new values:

Text
…
”UID”:”a****[redacted]”,”EMAIL”:”[redacted]”,”NAME”:”Attacker”,”MOBILE”:”12345",”LANG_ID”:”EN”,”DOB”:”20",”PROFILE_IMAGE”:””}}}}]
….

Line by line:

  • UID is the account being modified. In this example it is the attacker's own address, partly masked.
  • EMAIL is the email address to store on the profile. Here it is set to [redacted].
  • NAME is the display name, set to Attacker.
  • MOBILE is the phone number to store, set to 12345.
  • LANG_ID is the language, EN.
  • DOB is the date of birth, 20.
  • PROFILE_IMAGE is the profile picture, left empty.

The server confirmed the write:

Text
…
”RESPONSE”:”{\"status\":\"Profile details has been successfully updated.\",\"statusCode\":200
….

Line by line:

  • RESPONSE is the server's answer.
  • status is a human-readable message: the profile details were updated.
  • statusCode is 200, the standard HTTP code for "OK, it worked".

Because the session is never checked against the UID, an attacker can point the request at a victim's email address and change the profile fields, including the registered mobile number. The server treats the request as if it came from the account named in UID, regardless of who is actually logged in.

Step 3: Turning the profile bug into an account takeover

The researcher notes that the email parameter can be brute forced. Brute forcing means trying many values in turn until one works; here it means guessing or enumerating registered email addresses. The report says this would let an attacker read and modify sensitive information of registered users: username, gender, age and registered mobile number.

The update capability makes this worse. The attacker can set the victim profile's MOBILE field to a number they control. The app has a forgot password facility that sends a recovery PIN to the registered phone number. So with the mobile number replaced, the attacker requests the recovery PIN, it arrives on their own phone, and they use it to take over the victim account. The attacker requests the recovery PIN, it arrives on their own phone, and they use it to take over the victim account.

From the original on lonewolf-raj.medium.com

Step 4: Brute forcing the old PIN on the attacker's own account

On further enumeration, the researcher looked at the change PIN function. To change a PIN you must prove you know the current one, which is a sensible design: it stops someone who borrows your unlocked phone from quietly setting a new PIN. The request carries the UID, the OLD_PIN and the NEW_PIN:

Line by line:

  • requestData is the instruction section of the request.
  • serviceid is 40, the operation for changing a PIN.
  • UID is the account whose PIN is being changed, here the attacker's own address.
  • OLD_PIN is the current PIN, 8634 in this test.
  • NEW_PIN is the PIN to set, 1234.
  • LANG_ID is the language, EN.

The researcher was able to brute force the old PIN of the current user, [redacted], the attacker's own account, because there was no rate limit on the OLD_PIN check. A rate limit is a cap on how often something can be tried in a given time. Without one, a script can send thousands of guesses and the server will answer every one.

Step 5: Brute forcing the victim's old PIN

Having obtained a victim email address through user enumeration, the researcher changed the UID from the attacker's address to the victim's and generated a brute force pattern for a 4-digit PIN:

Text
…
”requestData":{"serviceid":40,"UID":"[redacted]","OLD_PIN":"8634","NEW_PIN":"1234",LANG_ID:"EN"}}}}
…

Line by line:

  • The request is the same change PIN operation, serviceid 40.
  • UID is now [redacted], the account being attacked.
  • OLD_PIN is the guess being tried; the script cycles through values.
  • NEW_PIN is the PIN the attacker wants to set, 1234.
  • LANG_ID is the language, EN.

A 4-digit PIN has only 10,000 possible values, from 0000 to 9999. With no limit on attempts, a script can walk through them in a short time. After a certain number of tries, the change succeeded:

Text
…
“isSuccessful”:true,”responseTime”:182,”RESPONSE”:”{\"header\":{\"status\":\"PIN had been successfully changed.\",\,\"TYPE\":\"M\",\"status\":\"1\"}}”,”statusCode”:200
…

Line by line:

  • isSuccessful is true, meaning the operation worked.
  • responseTime is 182, a timing figure the server returned.
  • RESPONSE contains the server's message.
  • header is a wrapper around status information.
  • status says the PIN had been successfully changed.
  • TYPE is M.
  • status inside the header is 1, a numeric success flag.
  • statusCode is 200, HTTP's "OK".

With the PIN changed, the attacker controls the victim account. The report does not say how many attempts the brute force took.

Why it works: the root cause

The profile issue comes from the application trusting a client-supplied email address as the identity of the record being read or written. Access control is not enforced server-side against the authenticated session, so any request naming another user's email is processed as if it were that user's own request. The report's remediation section states the principle directly: access controls should enforce record ownership rather than accepting that the user can create, read, update or delete any record.

The change PIN endpoint takes the UID from the request and has no limit on the number of attempts. The researcher generated a brute force pattern for a 4-digit PIN, and after a certain number of tries the change succeeded.

What an attacker could do with this

The researcher notes that brute forcing the email parameter would allow an attacker to read and modify sensitive information of registered users (username, gender, age, registered mobile number). Changing the mobile number enables account takeover through the forgot password recovery PIN sent by phone. Separately, an attacker with a valid user email address can brute force the old PIN of that account and set a new PIN, taking over the account. The report does not state how many attempts the PIN brute force required.

How to fix it

The report gives two remediation points:

  1. IDOR: enforce access control in trusted server-side code, where the attacker cannot modify the check or its metadata. Model access controls should enforce record ownership rather than accepting that the user can create, read, update or delete any record. In plain terms: the server should look up who is logged in from the session, and only allow that person to read or change their own record. The email in the request should never be the thing that decides whose account is touched.
  2. No rate limit on the old PIN: limit the number of PIN change requests, add anti-bot detection such as CAPTCHA, and return HTTP 429 for too many requests. HTTP 429 is the standard "too many requests" response, a signal to the client that it has been trying too often.
From the original on lonewolf-raj.medium.com

Other places to look for the same patterns

These are the same ideas applied to other targets, useful when you are learning what to test next:

  • Email or other identifier as UID in profile endpoints. On other targets, swap the identifier in view and update requests for another account's value. A positive result is a response containing the other user's profile fields, or a success status after an update.
  • Mobile number change followed by password recovery. Where a profile update accepts a phone number and recovery is by SMS, change the number to one you control and request recovery. A positive result is a recovery PIN arriving at your number for the victim account.
  • PIN or password change without rate limiting. Send repeated change requests with varying OLD_PIN values against a known account. A positive result is a success response within a feasible number of attempts, with no lockout, CAPTCHA or 429.
  • Short numeric secrets generally. Any 4-digit PIN, OTP or recovery code checked server-side without attempt limits is worth testing the same way, watching for differences in response time or status that reveal a correct guess.
  • Jailbreak and SSL pinning bypass on iOS targets. Use Liberty for jailbreak detection and SSL Kill Switch 2 (or Frida with objection) for pinning, then inspect the traffic for the identifier patterns above.

Glossary

  • API: the set of requests a program can send to a server to read or change data, like a menu of operations a restaurant kitchen will accept.
  • Account takeover: when an attacker gains control of someone else's account, for example by changing its password or PIN.
  • Brute force: trying many possible values in turn until one works, instead of guessing cleverly.
  • CAPTCHA: a test designed to be easy for a human and hard for a script, used to slow down automated attempts.
  • Certificate: a digital document that proves a server's identity, issued by a trusted authority.
  • Cydia: an app store for jailbroken iPhones, used to install tools Apple does not allow.
  • Frida: a tool for inspecting and modifying running programs, often used on mobile apps.
  • HTTP 429: the standard response code meaning "too many requests", used to tell a client it is sending too often.
  • HTTP 200: the standard response code meaning the request succeeded.
  • IDOR (Insecure Direct Object Reference): a bug where the app lets you name a record (by email, ID number and so on) and does not check that the record belongs to you.
  • iOS: Apple's operating system for iPhone.
  • Jailbreak: removing Apple's restrictions from an iPhone so unauthorised software can be installed.
  • Jailbreak detection: an app's check for whether the phone is jailbroken, often refusing to run if it is.
  • Kali Linux: a Linux distribution packaged with security testing tools.
  • Liberty: a tool used here to bypass jailbreak detection.
  • Objection: a toolkit built on Frida, used for mobile app testing.
  • OTP: a one-time password, a short code valid for a single use.
  • PIN: a short numeric password, four digits in this app.
  • Rate limit: a cap on how many times an action can be attempted in a period of time.
  • Recovery PIN: a code sent to a registered phone number to prove ownership during password recovery.
  • Request / response: the message a client sends to a server, and the message the server sends back.
  • Server-side: happening on the server, where the user cannot tamper with it, as opposed to client-side, happening in the app or browser.
  • Session: the server's record that you have logged in, usually represented by a cookie or token the client sends with each request.
  • SSL / TLS: the encryption that protects traffic between a client and a server.
  • SSL Kill Switch 2: a tool used here to bypass SSL pinning.
  • SSL pinning: an app's refusal to trust any certificate except one specific certificate hard-coded inside it.
  • UID: user identifier, the name tag a request uses to say which account it is about.
  • URL encoding: replacing special characters with codes so they can travel safely inside a URL.
  • User enumeration: discovering which accounts exist, for example by trying email addresses and seeing which ones are recognised.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

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.