Skip to content
XSS Disclosed report Beginner

XSS via modified Zomato widget (res_search_widget.php)

The language_id parameter of a Zomato widget endpoint was not filtered, allowing an attacker to inject JavaScript that executes in the zomato.com origin when a victim loads a page containing the widget in an iframe. The attacker could then perform actions as the victim, such as inviting friends or posting reviews, though the session cookie may not be stolen due to HTTPOnly.

pr0tagon1st Follow

Originally disclosed on HackerOne

  • Fixed in 36 hours
  • Disclosed after 32 days

Table of Contents:

  1. Short Description of Security Issue
  2. Proof of Concept

1. Short Description of Security Issue

The widget API endpoint at https://www.zomato.com/widgets/res_search_widget.php is vulnerable to XSS in the language_id parameter.

An attacker can create a web page that includes a Zomato widget inside an iframe with a specially crafted URL parameter that contains javascript. If a Zomato user opens this page, the iframe will load and execute the malicious javascript in the zomato.com origin using the user's active session.

This javascript can then steal a CSRF token from the zomato.com homepage and perform actions as the user - actions such as inviting/removing friends, posting reviews, posting ratings and others. This can potentially be used to message other users with the malicious web page and get them to execute the malicious code, creating a sort of javascript worm or embed external malicious documents (flash, pdf, other) to continue the attack on a user's machine. On the good side, the injected javascript may not steal the user's session cookie thanks to the HTTPOnly cookie parameter.

The language_id parameter should be filtered so that non-essential characters are removed before being output to users.

2. Proof of Concept

I use a piece of javascript code that creates an alert box with the document.domain, which shows the SOP is bypassed: "}');alert(document.domain);console.log('. This code is urlencoded and inserted into the language_id parameter of the request like so:

https://www.zomato.com/widgets/res_search_widget.php?city_id=276&language_id=%22%7D%27)%3Balert(1)%3Bconsole.log(%27&theme=blue&hideCitySearch=on&hideResSearch=on&sort=popularity

This URL is used to create an iframe as described in Zomato's widget documentation: https://developers.zomato.com/widgets and the final code looks like this:

<html>
    <body>
        <iframe src="https://www.zomato.com/widgets/res_search_widget.php?city_id=273&language_id=%22%7D%27)%3Balert(document.domain)%3Bconsole.log(%27&theme=blue&hideCitySearch=on&hideResSearch=on&sort=popularity" style="position:relative;width:100%;height:100%;" border="0" frameborder="0"></iframe>
    </body>
</html>

Opening this html document, even locally, will run the javascript in the context of zomato.com as shown in the attached screenshot.

Let me know if you have any questions.

Best, Matt

Attachments

zomato_poc.jpg
zomato_poc.jpg From the original on HackerOne

The original report as published on HackerOne, by pr0tagon1st. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the language_id parameter was reflected into the widget's HTML output without proper encoding or filtering.

Impact

An attacker could execute JavaScript in the zomato.com origin to perform actions as the victim, such as inviting or removing friends, posting reviews, and posting ratings, though the session cookie may not be stolen due to HTTPOnly.

What the attacker needed

Victim opens a malicious page; victim has an active Zomato session

How it was found

  1. Craft a URL to the widget endpoint with a malicious payload in the language_id parameter.
  2. Create an HTML page that embeds the crafted URL in an iframe.
  3. Open the HTML page to trigger the JavaScript execution in the zomato.com origin.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A website had a part that builds a widget and put user input into the page without cleaning it. An attacker could craft a link that, when opened, runs their own code in the victim's browser as if it came from the website. This could let the attacker do things like post reviews or send messages as the victim.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by pr0tagon1st

View all

2 more disclosed reports, best first.

More from Eternal

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.