Skip to content
IDOR Write-up Beginner

Delete IDOR on a Fashion eCommerce Website

The address creation endpoint in the checkout flow accepted a user-supplied address ID, allowing an attacker to overwrite or delete another user's saved address. The attacker could delete addresses from other accounts by manipulating the ID parameter.

Amey Anekar Follow

Published on techkranti.com

Yes, another IDOR. I find a lot of IDORs.

Amey Anekar (@ameyanekar), on techkranti.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. 5 min read.

Context

This is a story about an IDOR (Insecure Direct Object Reference) that I reported on an Asian fashion eCommerce website's private bug bounty program. IDORs are my favourite class of bugs, and I find a lot of them.

Like most eCommerce websites, the target provided a feature to store addresses in the customer's account. The Account section had an option to manage addresses, and the address management was backed by a set of API calls for creating, editing and deleting addresses. The requests below have been URL decoded for readability.

Setup

To test the address feature I created a second test account that I controlled, so that I could try to reach one account's address from the other. No special tools are mentioned in the report.

Finding it

The address management API calls looked like these.

Create an address

HTTP
POST /customer/address/create/?ajax=true&address_id= HTTP/1.1

AddressForm[first_name]=Amey&AddressForm[last_name]=Test&AddressForm[cell_phone]=2418174&phone_prefix=8,9&phone_len=7&AddressForm[phone]=&AddressForm[address1]=2418174&AddressForm[address2]=&AddressForm[postcode]=241817&AddressForm[fk_customer_address_region]=&AddressForm[city]=Singapore&AddressForm[fk_country]=198&AddressForm[id_customer_address]=

Edit an address

HTTP
POST /customer/address/edit/?ajax=true&address_id=2417909 HTTP/1.1

AddressForm[first_name]=Name&AddressForm[last_name]=Two&AddressForm[cell_phone]=98989898&phone_prefix=8,9&phone_len=7&AddressForm[phone]=&AddressForm[address1]=Lkb 122, asdsaasd sad Rd&AddressForm[address2]=12-321&AddressForm[postcode]=423122&AddressForm[fk_customer_address_region]=&AddressForm[city]=Singapore&AddressForm[fk_country]=198&AddressForm[id_customer_address]=2417909

Delete an address

HTTP
GET /customer/address/delete/?address_id=2418179&YII_CSRF_TOKEN=token HTTP/1.1

Note that there are two injection points for triggering an IDOR in the above requests, except for delete: one in the URL query parameter (address_id) and another in the POST body parameter (AddressForm[id_customer_address]). The delete request carries the address ID in the query string only, alongside a YII_CSRF_TOKEN.

I tried all possible ways to impact an address that I did not own by changing the IDs being passed in the request. I tried parameter pollution, passing multiple IDs in an array, and varying values in the query parameter and the body parameter. None of them seemed to work.

While hunting further on the application, I noticed that it provided an option to add an address in the checkout flow as well. What caught my attention was that the endpoint called to create an address from the checkout flow was different from the one above. The create address request from the checkout flow looked like this:

HTTP
POST /checkout/shipment/saveaddress/ HTTP/1.1

AddressForm[first_name]=Amey&AddressForm[last_name]=Test&AddressForm[cell_phone]=2418174&phone_prefix=8,9&phone_len=7&AddressForm[phone]=&AddressForm[address1]=2418174&AddressForm[address2]=&AddressForm[postcode]=241817&AddressForm[id_customer_address]=

This second create endpoint takes the same AddressForm[id_customer_address] parameter but is reached through a different route.

Exploitation

Step 1: Manipulate the address ID on the checkout create endpoint

I immediately tried manipulating the value of the AddressForm[id_customer_address] parameter and set it to an address ID belonging to another test account I had created. I checked the ID of the newly created address, and the ID returned from the server matched the ID I had entered when creating the request.

Step 2: Check the victim account

Feeling elated, I headed over to the other test account to check whether the address had been deleted from there. I refreshed the page, but the address with the same ID was present there as well, and the information contained in the address was unaffected. The manipulated request had caused no visible impact to the victim account's address.

Step 3: Edit the target address from the victim's session

While I was still logged into the victim's account, I attempted to edit the target address in the victim's account. To my surprise, as soon as I tried to edit it, the address disappeared from the list of addresses in the victim's account. I realised that something had happened because of my malformed request.

Step 4: Repeat and verify with a fresh session

I used the same technique again to delete another address from the victim's account. This time, to verify the change, I logged out and logged in again to the victim's account. When I visited the Address Management page, the target address was no longer present in the victim's account. This proved that I was able to delete addresses from other users' accounts by manipulating the AddressForm[id_customer_address] parameter.

I came to the conclusion that a logout was required to see the change because the request was probably being served by a cache server, and hence the address was still visible in the victim's account after deletion. This is true for a lot of websites: unintended changes to a user's information are reflected when a new session is created.

Root cause

The checkout create endpoint (/checkout/shipment/saveaddress/) accepted a client-supplied AddressForm[id_customer_address], and manipulating it led to deletion of another account's address. The account-section endpoints (/customer/address/create/, /customer/address/edit/, /customer/address/delete/) did not yield to the same manipulation attempts, but the checkout flow's separate create endpoint did.

The delete request shown in the report carries a YII_CSRF_TOKEN.

Impact

By manipulating the AddressForm[id_customer_address] parameter on the checkout create endpoint, an authenticated attacker could delete addresses belonging to other users' accounts. In the report the effect was confirmed against a second account the researcher controlled, and the deletion only became visible after logging out and back in, probably because a cache server was still serving the old address list. The report does not describe any other impact, such as reading or modifying the contents of another user's address.

Fix

The report does not say what was changed.

Variants to test

  1. Look for a second implementation of the same feature on a different route, such as a checkout flow versus an account settings page, and replay the ID manipulation against each one separately. A positive result is one endpoint acting on an address ID that belongs to another account while its sibling endpoint refuses.
  2. Try both injection points on requests that carry the ID twice, in the query string and in the POST body, and vary them independently. A positive result is the server honouring the body value while the query value passes an ownership check, or the reverse.
  3. Try parameter pollution and array-style IDs (id=1&id=2, id[]=1) on each endpoint. A positive result is the server resolving to the other user's object rather than rejecting the request.
  4. After a suspected unauthorised change, log out and log in again, or use a fresh session, before concluding there was no impact. A positive result is the change appearing only in the new session, which points to a cache masking the effect.
  5. Repeat the create-with-foreign-ID test and compare the ID returned by the server with the ID you sent. A positive result is the server echoing your supplied ID, which shows it accepted the client-controlled identifier.

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. 12 min read.

What happened, in plain words

A security researcher found a bug on an Asian fashion eCommerce website. The site was part of a private bug bounty program, which means the company invited selected researchers to test it and report problems. The bug he found is called an IDOR, short for Insecure Direct Object Reference. In everyday terms: the website lets you refer to your own records by a number, and it forgets to check that the record with that number actually belongs to you. So if you change the number, you can touch someone else's record.

Think of a cloakroom where you hand in your coat and get a ticket with a number on it. A well-run cloakroom checks the ticket against the coat before handing it back. An IDOR is a cloakroom that just reads the number and hands over whatever coat has that number, without checking whether the ticket is really yours. The number is the "direct object reference"; the missing check is what makes it "insecure".

The feature involved here is the address book. Most online shops let you save delivery addresses in your account so you do not have to type them again at checkout. The site had a page in the Account section to manage those addresses, and behind that page sat a set of API calls. An API is simply the set of behind-the-scenes addresses and messages that a website's pages use to talk to its server. When you click "Save address", your browser sends a small message to one of those addresses, and the server does the work and replies. If you can watch and edit those messages, you can ask the server to do things the page would not normally let you do.

IDORs are the researcher's favourite class of bugs, and he says he finds a lot of them. This is the story of one he reported.

Setup

To test the address feature he created a second test account that he controlled. Having two accounts is the standard way to test for this kind of bug, because you need one account to play the attacker and another to play the victim. If account A can change something in account B, you have proof. If you only have one account, you cannot tell whether a change affected anyone else.

The report does not mention any special tools.

Finding it

The address management API calls looked like these. The researcher notes that the requests have been URL decoded for readability. URLs cannot contain spaces and some other characters directly, so browsers and servers encode them (a space becomes %20, for example). Decoding turns them back into something a human can read.

Create an address

HTTP
POST /customer/address/create/?ajax=true&address_id= HTTP/1.1

AddressForm[first_name]=Amey&AddressForm[last_name]=Test&AddressForm[cell_phone]=2418174&phone_prefix=8,9&phone_len=7&AddressForm[phone]=&AddressForm[address1]=2418174&AddressForm[address2]=&AddressForm[postcode]=241817&AddressForm[fk_customer_address_region]=&AddressForm[city]=Singapore&AddressForm[fk_country]=198&AddressForm[id_customer_address]=

Line by line:

  1. POST /customer/address/create/?ajax=true&address_id= HTTP/1.1 is the first line of an HTTP request. HTTP is the language browsers and servers speak. POST is the method, meaning "I am sending data for you to store or act on". GET (seen later) means "give me something". /customer/address/create/ is the path, the address of the feature on the server. Everything after the ? is the query string, a list of name=value pairs. Here ajax=true tells the server the page is making a background request rather than a full page load, and address_id= is present but empty. HTTP/1.1 is the version of the protocol.
  2. The blank line separates the request line from the body.
  3. The body is one long line of name=value pairs joined by &. This is the same format as the query string, just placed in the body instead of the URL. Each name looks like AddressForm[first_name], which is how web frameworks represent a form field called first_name inside a group called AddressForm. The values are the address details: first name, last name, phone, address lines, postcode, city, country and so on. The last pair, AddressForm[id_customer_address]=, is empty here because this is a brand new address and no ID exists yet.

Edit an address

HTTP
POST /customer/address/edit/?ajax=true&address_id=2417909 HTTP/1.1

AddressForm[first_name]=Name&AddressForm[last_name]=Two&AddressForm[cell_phone]=98989898&phone_prefix=8,9&phone_len=7&AddressForm[phone]=&AddressForm[address1]=Lkb 122, asdsaasd sad Rd&AddressForm[address2]=12-321&AddressForm[postcode]=423122&AddressForm[fk_customer_address_region]=&AddressForm[city]=Singapore&AddressForm[fk_country]=198&AddressForm[id_customer_address]=2417909

Line by line:

  1. The path is now /customer/address/edit/, the edit feature. The query string carries address_id=2417909, a number identifying which address to change. This is the first place the ID appears.
  2. The body carries the new values for the address, and the last pair is AddressForm[id_customer_address]=2417909, the same number again. This is the second place the ID appears.

Delete an address

HTTP
GET /customer/address/delete/?address_id=2418179&YII_CSRF_TOKEN=token HTTP/1.1

Line by line:

  1. GET is used here even though it deletes something. That is unusual, because GET is supposed to be safe and repeatable, but it is what the site did. The path is /customer/address/delete/.
  2. The query string has two pairs. address_id=2418179 is the address to delete. YII_CSRF_TOKEN=token is a CSRF token. CSRF stands for Cross-Site Request Forgery, an attack where a malicious site tricks your browser into sending a request to another site while you are logged in. The token is a random value the server gives your session and expects back on sensitive requests, so a request forged from elsewhere will not have it. Yii is the name of the web framework the site was built with, and this is its token parameter. The value shown is a placeholder, not a real token.

Note that there are two injection points for triggering an IDOR in the above requests, except for delete: one in the URL query parameter (address_id) and another in the POST body parameter (AddressForm[id_customer_address]). "Injection point" here just means a place where you can put a value and see what the server does with it. The delete request carries the address ID in the query string only, alongside the YII_CSRF_TOKEN.

The researcher tried all possible ways to affect an address he did not own by changing the IDs being passed in the request. He tried parameter pollution (sending the same parameter name more than once, for example id=1&id=2, to see which one the server believes), passing multiple IDs in an array (a name like id[]=1 that some frameworks turn into a list), and varying values in the query parameter and the body parameter. None of them seemed to work. This is worth noting: the obvious version of the bug was blocked on these endpoints, which is why the story continues.

While hunting further on the application, he noticed that it provided an option to add an address in the checkout flow as well. Checkout is the multi-step process where you confirm your basket, enter a delivery address and pay. What caught his attention was that the endpoint called to create an address from the checkout flow was different from the one above. The create address request from the checkout flow looked like this:

HTTP
POST /checkout/shipment/saveaddress/ HTTP/1.1

AddressForm[first_name]=Amey&AddressForm[last_name]=Test&AddressForm[cell_phone]=2418174&phone_prefix=8,9&phone_len=7&AddressForm[phone]=&AddressForm[address1]=2418174&AddressForm[address2]=&AddressForm[postcode]=241817&AddressForm[id_customer_address]=

Line by line:

  1. The path is /checkout/shipment/saveaddress/, a different route from /customer/address/create/. There is no query string this time.
  2. The body is the same kind of form data, with the same AddressForm[...] names, and again ends with AddressForm[id_customer_address]=, empty because it is a new address.

This second create endpoint takes the same AddressForm[id_customer_address] parameter but is reached through a different route, which made it worth testing separately. The lesson is that the same feature can be built twice in two places, and a check that exists in one place may be missing in the other.

Exploitation

Step 1: Manipulate the address ID on the checkout create endpoint

He immediately tried manipulating the value of the AddressForm[id_customer_address] parameter and set it to an address ID belonging to another test account he had created. In other words, he took the checkout create request and filled in the ID of the victim's address where the empty value had been. He then checked the ID of the newly created address, and the ID returned from the server matched the ID he had entered when creating the request. The server had accepted his number and echoed it back.

Step 2: Check the victim account

Feeling elated, he headed over to the other test account to check whether the address had been deleted from there. He refreshed the page, but the address with the same ID was present there as well, and the information contained in the address was unaffected. The manipulated request had caused no visible impact to the victim account's address. At this point it looked like a dead end.

Step 3: Edit the target address from the victim's session

While he was still logged into the victim's account, he attempted to edit the target address in the victim's account. To his surprise, as soon as he tried to edit it, the address disappeared from the list of addresses in the victim's account. He realised that something had happened because of his malformed request. The address disappeared from the list as soon as he tried to edit it.

Step 4: Repeat and verify with a fresh session

He used the same technique again to delete another address from the victim's account. This time, to verify the change, he logged out and logged in again to the victim's account. When he visited the Address Management page, the target address was no longer present in the victim's account. This proved that he was able to delete addresses from other users' accounts by manipulating the AddressForm[id_customer_address] parameter.

He came to the conclusion that a logout was required to see the change because the request was probably being served by a cache server, and hence the address was still visible in the victim's account after deletion. A cache server is a machine that keeps a copy of a page so it can be served faster next time. If it holds an old copy, you see old data until the copy expires or your session changes. This is true for a lot of websites: unintended changes to a user's information are reflected when a new session is created. A session is the period you stay logged in; logging out and back in starts a fresh one.

Root cause

The checkout create endpoint (/checkout/shipment/saveaddress/) accepted a client-supplied AddressForm[id_customer_address], and manipulating it led to deletion of another account's address. The account-section endpoints (/customer/address/create/, /customer/address/edit/, /customer/address/delete/) did not yield to the same manipulation attempts, but the checkout flow's separate create endpoint did.

The delete request shown in the report carries a YII_CSRF_TOKEN. In plain terms: the token proves the request came from your browser, not that the address number inside it is yours.

Impact

By manipulating the AddressForm[id_customer_address] parameter on the checkout create endpoint, an authenticated attacker could delete addresses belonging to other users' accounts. "Authenticated" means the attacker has a normal account of their own and is logged in; they do not need any special privileges. In the report the effect was confirmed against a second account the researcher controlled, and the deletion only became visible after logging out and back in, probably because a cache server was still serving the old address list. The report does not describe any other impact, such as reading or modifying the contents of another user's address.

Fix

In cloakroom terms: check the ticket against the coat, every time, on every counter.

Variants to test

  1. Look for a second implementation of the same feature on a different route, such as a checkout flow versus an account settings page, and replay the ID manipulation against each one separately. A positive result is one endpoint acting on an address ID that belongs to another account while its sibling endpoint refuses.
  2. Try both injection points on requests that carry the ID twice, in the query string and in the POST body, and vary them independently. A positive result is the server honouring the body value while the query value passes an ownership check, or the reverse.
  3. Try parameter pollution and array-style IDs (id=1&id=2, id[]=1) on each endpoint. A positive result is the server resolving to the other user's object rather than rejecting the request.
  4. After a suspected unauthorised change, log out and log in again, or use a fresh session, before concluding there was no impact. A positive result is the change appearing only in the new session, which points to a cache masking the effect.
  5. Repeat the create-with-foreign-ID test and compare the ID returned by the server with the ID you sent. A positive result is the server echoing your supplied ID, which shows it accepted the client-controlled identifier.

Glossary

  • API: the set of behind-the-scenes addresses and message formats a website's pages use to talk to its server.
  • Authenticated: logged in with a normal account of your own.
  • Bug bounty program: an arrangement where a company invites researchers to test its systems and report problems, often for a reward. A private program is open only to selected researchers.
  • Cache server: a machine that keeps copies of pages so they can be served faster; an old copy can hide a recent change.
  • Checkout flow: the multi-step process of confirming a basket, entering a delivery address and paying.
  • CSRF (Cross-Site Request Forgery): an attack where a malicious site tricks your logged-in browser into sending a request to another site.
  • CSRF token: a random value tied to your session that the server expects back on sensitive requests, so forged requests fail.
  • Endpoint: a specific path on a server that performs a specific job, such as creating an address.
  • GET: an HTTP method meaning "give me something"; it is supposed to be safe and repeatable.
  • HTTP: the language browsers and servers use to exchange requests and responses.
  • IDOR (Insecure Direct Object Reference): a bug where a site lets you name a record by its ID but does not check that the record belongs to you.
  • Injection point: a place in a request where you can put a value and observe how the server handles it.
  • Parameter pollution: sending the same parameter name more than once to see which value the server uses.
  • POST: an HTTP method meaning "I am sending data for you to store or act on".
  • Query string: the name=value pairs after the ? in a URL.
  • Request body: the part of an HTTP request after the blank line, carrying data such as form fields.
  • Root cause: the underlying reason a bug exists, as opposed to its visible symptom.
  • Session: the period you stay logged in, identified by a value your browser sends with each request.
  • URL decoding: turning encoded characters such as %20 back into readable form.
  • Yii: the web framework the site was built with; its CSRF token parameter is YII_CSRF_TOKEN.

More by Amey Anekar

View all

1 more disclosed report, best first.

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.