Reflected XSS on https://www.zomato.com
The state parameter on the Google OAuth callback page was reflected into a script context without proper escaping of a backslash character, allowing an attacker to break out of a string and inject JavaScript. An attacker could execute arbitrary script in an authenticated user's browser to steal information or redirect them to malicious sites.
- Triaged in 31 days
- Fixed in 33 days
- Paid in 34 days
- Disclosed after 2 months
Hello,
I found an XSS issue due to the incorrect handling of the \ character in a <script> context, the following link works as a PoC that alerts the location of the document:
https://www.zomato.com/googleOAuth2Callback?)}(alert)(location);{%3C!--&state=\
The issue exists because, given that the \ character supplied as the state parameter value is not well escaped and reflected into the page, we are able to use it to escape the " and then inject our own JS code to execute it on the page.
Note: This only works when the page is opened by an authenticated user
Impact
This allows an attacker to inject custom Javascript codes that can be used to steal information from Zomato's user base and lure them to malicious websites on the internet on behalf of Zomato's website.
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 application reflected the state parameter into a JavaScript string context without correctly escaping backslash characters, allowing a quote to be escaped and code injected.
Impact
An attacker could run arbitrary JavaScript in an authenticated user's session to steal information or lure them to malicious sites, though the exploit only works for logged-in users.
What the attacker needed
Victim is authenticated; victim opens a crafted link
How it was found
- Open the crafted Google OAuth callback URL containing the malicious state parameter while logged in.
- The page reflects the state value into a script context, and the backslash escapes the closing quote.
- The injected JavaScript executes and shows an alert with the document location.
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.
When a website puts user input directly into a page without cleaning it, an attacker can sneak in their own code. Here, a special character (a backslash) let the attacker break out of a quoted string inside a script and run their own JavaScript. This only worked if the victim was already logged in.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.