How I Found a Vulnerability in Paytm and Received a Bounty
The login endpoint reflected user input from the ref_url parameter into the response, initially as plain text instead of JSON. By using a crafted payload, the author achieved HTML injection and later bypassed the WAF to trigger XSS, which could run script in a victim's browser.
Published on mufazmi.medium.com
Hello everyone, this is Umair Farooqui with a new experience about how I found a vital security issue on the Paytm platform and, in turn, became a bounty hunter with earnings of 13,000 INR and an appreciation letter from the company — step by step: My Adventure.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Paytm runs a seller registration flow for ONDC, reachable at the login endpoint of the ondc-seller-reg subdomain. The researcher, Umair Farooqui (@mufazmi), describes the target as the Paytm platform and the feature as the login page of that seller registration application. The page accepts a ref_url parameter, which is the whole subject of the report. That parameter is the whole subject of the report.
The write-up covers two related findings on the same parameter: an HTML injection that changed the API response format, and, after further testing, a working XSS that got past the firewall. Paytm paid 13,000 INR (the platform record lists 150.00 USD) and sent an appreciation letter.
Setup
The report does not describe any accounts, roles or credentials. The tools used were:
- Subfinder and Assetfinder for subdomain enumeration.
- Burp Suite, specifically the Intruder function, to spray payloads.
- The PortSwigger XSS Cheat Sheet as the payload source.
- A browser user agent string of Chrome 121 on Windows, as seen in the captured request.
- A personal proof-of-concept host,
poc.umairfarooqui.com, to serve the payload page and the image referenced by the injected HTML.
No versions of Subfinder, Assetfinder or Burp are given.
Finding it
Enumeration came first. Running Subfinder and Assetfinder against the in-scope Paytm domains surfaced:
https://ondc-seller-reg.paytm.com/login
While probing that login endpoint, the researcher noticed that API responses were returned in JSON. Placing unwanted special characters and some byte codes into the ref_url parameter changed the response: instead of JSON, the value came back reflected in plain text. A parameter that is echoed back into the response, and that can flip the response from JSON to text, is a classic reflection point, so it was worth pushing further.
Exploitation
Step 1: collect payloads and spray them
The researcher took the payloads listed on the PortSwigger XSS Cheat Sheet, copied all of them, and loaded them into Burp Suite's Intruder, setting the injection point on the ref_url parameter. Launching the attack produced some responses in HTML format. Many payloads did not get through the firewall, and the first rounds failed to bypass it.
Step 2: settle on a request that worked
The request the researcher eventually settled on was this one:
POST /login HTTP/2Host: ondc-seller-reg.paytm.comReferer: https://ondc-seller-reg.paytm.com/Content-Type: application/x-www-form-urlencodedAccept: application/json, text/javascript, */*; q=0.01X-Requested-With: XMLHttpRequestContent-Length: 222Accept-Encoding: gzip,deflate,brUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36ref_url=1<h1>A new offer from paytm make a payment of $200 to 100%25 win brand new car <a href=https://poc.umarifarooqui.com>Make%20Payment</a></h1><img src=https://poc.umairfarooqui.com/hacker.jpg><!--
The important parts:
- The endpoint is
POST /loginonondc-seller-reg.paytm.com, sent over HTTP/2 withContent-Type: application/x-www-form-urlencoded. X-Requested-With: XMLHttpRequestand theAcceptheader mark it as an AJAX call, which is why the application normally answers in JSON.- The
ref_urlvalue starts with1and then contains an<h1>element with a Paytm offer, a link tohttps://poc.umarifarooqui.comlabelledMake Payment, and an<img>pointing athttps://poc.umairfarooqui.com/hacker.jpg. - The
%25inside the text is a URL-encoded percent sign, and%20is an encoded space inside the link text. - The payload ends with
<!--, an HTML comment opener, which comments out whatever the application appends after the reflected value.
The response came back with the payload reflected as HTML rather than as JSON, which is the HTML injection the researcher was after.
Step 3: build a proof of concept
The proof of concept is a page hosted at:
https://poc.umairfarooqui.com/paytm.html
On a visit to that URL, it raises a request to Paytm carrying the payload and pops up the HTML-injected message. The researcher notes that the issue was patched, so the page no longer shows the message. A video walkthrough was also published:
https://www.youtube.com/watch?v=VT5I0mYipJ8&ab_channel=mufazmi
Step 4: report, wait, and keep testing
The researcher suspected the finding was a duplicate because it had been quick to find, but reported it anyway. Paytm acknowledged the report by email and stated that, with so many reports coming in, duplicates and out-of-scope reports would be closed automatically without notice.
After the usual seven-day waiting period with no response, the researcher assumed the issue was ignored or marked duplicate and moved on. About a week later, Paytm emailed to accept that the reported issue was genuine and said they were working on a fix.
Encouraged, the researcher went back to the same target and threw several WAF bypass XSS payloads at the firewall. One of them worked and triggered the XSS. The report does not give the text of that payload. The ticket was updated with the new details.
Step 5: reward
After reviewing the updated details, Paytm awarded 13,000 INR and sent an appreciation letter for responsible disclosure.


The second certificate, as captioned in the write-up, was for reporting a full account takeover via CSRF.
Root cause
The ref_url parameter is reflected into the response, and the payload came back as HTML rather than JSON. The <!-- at the end of the payload shows that the application appends something after the reflected value, and that the payload can comment it out. The X-Requested-With: XMLHttpRequest header and the JSON Accept header suggest the endpoint is designed for AJAX callers, but the server still honoured a form-encoded POST and returned HTML when the input contained markup. The firewall in front of the application blocked many cheat-sheet payloads but not the one that was eventually used.
Impact
With the HTML injection, the Paytm page rendered attacker-controlled markup, including a payment offer and a link to an attacker-controlled domain. The researcher's proof of concept shows the injected message popping up on a visit to the crafted page. The later WAF bypass payload triggered the XSS. The separate CSRF account takeover mentioned in the second certificate is not described in the report.
Fix
The report says the issue was patched and that Paytm was working on a fix after accepting the report. The appropriate fix, given the behaviour shown, is to encode ref_url for the context it is written into, and to keep the response content type consistent with the data actually returned, so that a reflected value cannot become markup.
Variants to test
- Spray the same cheat-sheet payload set at any parameter that is reflected into a JSON response, watching for the response flipping to HTML or text. A positive result is the payload appearing unencoded in the body with a content type the browser will render.
- Try the
<!--comment terminator on reflected parameters where the application appends a suffix. A positive result is the suffix disappearing from the rendered output. - Send form-encoded POSTs to endpoints that expect AJAX JSON, with
X-Requested-With: XMLHttpRequestand a JSONAcceptheader. A positive result is the server processing the form body and reflecting it. - Test
ref_url-style redirect parameters on other login and registration pages for both reflection and open redirect behaviour. A positive result is the value appearing in the response body or being used as the post-login destination. - Run the same payloads through the WAF with encoding variations until one passes, as the researcher did. A positive result is a payload that executes in the browser on the target origin.
What happened, in plain words
A security researcher named Umair Farooqui (@mufazmi) was looking at Paytm, a large Indian payments company. Paytm runs a website where sellers can register to sell through ONDC, an Indian government-backed system for open e-commerce. That registration site lives on a web address that starts with ondc-seller-reg.paytm.com. The researcher found a weakness on its login page, reported it, and was paid 13,000 INR (the platform record lists 150.00 USD) plus an appreciation letter.
The weakness was in a parameter called ref_url. A parameter is a named value that a web page or app sends to a server, a bit like a field on a paper form. ref_url is a parameter on the login page. The site put the value from that field back into its reply. If the value contained HTML, the language web pages are written in, the browser would treat it as part of the page rather than as harmless text. That is called HTML injection. Later, the researcher managed to get JavaScript, the programming language browsers run, to execute too. That is called XSS, short for cross-site scripting.
The write-up walks through finding the site, spotting the reflection, trying many attack strings, getting one through the site's firewall, reporting it, waiting, and finally being rewarded. This article follows the same steps and explains each idea from scratch.
The target and the feature
Paytm's seller registration flow is reachable at the login endpoint of the ondc-seller-reg subdomain. A subdomain is a smaller address under a company's main domain: if paytm.com is the main building, ondc-seller-reg.paytm.com is a named office inside it. The researcher describes the target as the Paytm platform and the feature as the login page of that seller registration application.
The page accepts a ref_url parameter. Think of it as the "return address" field on a form: after you sign in, the site reads it to decide where to send you next. That one parameter is the whole subject of the report.
The write-up covers two related findings on the same parameter:
- An HTML injection that changed the format of the API response.
- After further testing, a working XSS that got past the firewall.
An API is the part of a website that answers requests with data rather than with a finished page, like a waiter who takes your order to the kitchen and brings back a plate rather than letting you walk into the kitchen yourself. The login page talks to such an API behind the scenes.
Setting up
Before touching the target, the researcher needed tools. The report does not describe any accounts, roles or credentials, so nothing here depends on having a Paytm login. The tools were:
- Subfinder and Assetfinder: programs that look up which subdomains exist for a company. They work like trying every possible extension on a phone number to see who picks up.
- Burp Suite, specifically the Intruder function: a tool that sits between your browser and a website, lets you capture a request, and can resend it many times with different values filled in automatically. Intruder is the part that sprays a list of values at one spot.
- The PortSwigger XSS Cheat Sheet: a public list of known attack strings for XSS, maintained by the people behind the Web Security Academy.
- A browser user agent string of Chrome 121 on Windows, as seen in the captured request. A user agent is a line the browser sends to say which browser and operating system it is, like a name badge at a conference.
- A personal proof-of-concept host,
poc.umairfarooqui.com, to serve the payload page and the image referenced by the injected HTML. A proof of concept is a small demonstration that shows a weakness is real without doing harm.
No versions of Subfinder, Assetfinder or Burp are given.
Finding it
Enumeration came first. Enumeration means listing everything that belongs to the target before testing anything, the way a burglar (or a building inspector) first walks around the outside and notes every door. Running Subfinder and Assetfinder against the in-scope Paytm domains surfaced:
https://ondc-seller-reg.paytm.com/login
This is a full web address. https means the connection is encrypted. ondc-seller-reg.paytm.com is the server. /login is the specific page on that server.
While probing that login endpoint, the researcher noticed that API responses were returned in JSON. JSON is a text format for structured data, made of names and values in curly braces, and it is what most APIs use to talk to browsers. It is data, not a web page, so a browser will not run anything in it.
Then the researcher placed unwanted special characters and some byte codes into the ref_url parameter. The response changed: instead of JSON, the value came back reflected in plain text. Reflected means the server copied the input straight into its reply. A parameter that is echoed back, and that can flip the response from JSON to text, is a classic reflection point, so it was worth pushing further. If a shop assistant reads your note back to you word for word, you have found someone who will repeat anything you write, and that is exactly the behaviour an attacker looks for.
Exploitation
Step 1: collect payloads and spray them
The researcher took the payloads listed on the PortSwigger XSS Cheat Sheet, copied all of them, and loaded them into Burp Suite's Intruder, setting the injection point on the ref_url parameter. A payload here is simply a piece of text designed to test whether the site mishandles input. Launching the attack produced some responses in HTML format. Many payloads did not get through the firewall, and the first rounds failed to bypass it.
A firewall, in this context a web application firewall or WAF, is a filter that sits in front of a website and blocks requests that look like known attacks. It is like a bouncer with a list of known troublemakers: useful, but only as good as the list. The researcher's job at this stage was to find a request the bouncer did not recognise.
Step 2: settle on a request that worked
The request the researcher eventually settled on was this one:
POST /login HTTP/2Host: ondc-seller-reg.paytm.comReferer: https://ondc-seller-reg.paytm.com/Content-Type: application/x-www-form-urlencodedAccept: application/json, text/javascript, */*; q=0.01X-Requested-With: XMLHttpRequestContent-Length: 222Accept-Encoding: gzip,deflate,brUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36ref_url=1<h1>A new offer from paytm make a payment of $200 to 100%25 win brand new car <a href=https://poc.umarifarooqui.com>Make%20Payment</a></h1><img src=https://poc.umairfarooqui.com/hacker.jpg><!--
This block is one HTTP request, the message a browser sends to a server. In the report it is shown as a single run of text, so the lines run together. Read it piece by piece:
POST /login HTTP/2: the method is POST, which means "here is some data for you", and it goes to the/loginpath using HTTP/2, a version of the web's request protocol.Host: ondc-seller-reg.paytm.com: the server being addressed.Referer: https://ondc-seller-reg.paytm.com/: tells the server which page the request came from.Content-Type: application/x-www-form-urlencoded: says the body is formatted like a form submission, withname=valuepairs.Accept: application/json, text/javascript, */*; q=0.01: says the caller prefers JSON back, then JavaScript text, then anything.X-Requested-With: XMLHttpRequest: a header that marks the request as coming from JavaScript running in a page rather than from typing a URL in the address bar. This is why the application normally answers in JSON.Content-Length: 222: the size of the body in bytes.Accept-Encoding: gzip,deflate,br: the compression formats the caller can handle.User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36: the browser identification string.ref_url=1<h1>A new offer from paytm make a payment of $200 to 100%25 win brand new car <a href=https://poc.umarifarooqui.com>Make%20Payment</a></h1><img src=https://poc.umairfarooqui.com/hacker.jpg><!--: the body, a single form field namedref_urlwhose value is the attack string.
Inside that value:
- The value starts with
1, then contains an<h1>element.<h1>is a top-level heading in HTML, so the text inside it would appear large and bold. - The heading text is a Paytm offer: a payment of $200 for a chance to win a brand new car.
<a href=https://poc.umarifarooqui.com>Make%20Payment</a>is a link.<a>is the HTML tag for a link,hrefis where it points, and the visible text isMake Payment.%20is an encoded space, so the link text reads "Make Payment".<img src=https://poc.umairfarooqui.com/hacker.jpg>is an image tag pointing at a picture on the researcher's own server.%25inside the text is a URL-encoded percent sign, so the page would show100%.- The payload ends with
<!--, which opens an HTML comment. Everything after it is ignored by the browser until a closing-->. This comments out whatever the application appends after the reflected value, so leftover code from the site does not break the injected markup.
The response came back with the payload reflected as HTML rather than as JSON, which is the HTML injection the researcher was after. In other words, the server repeated the researcher's markup in a form the browser would render.
Step 3: build a proof of concept
The proof of concept is a page hosted at:
https://poc.umairfarooqui.com/paytm.html
This is a page on the researcher's own server. On a visit to that URL, it raises a request to Paytm carrying the payload and pops up the HTML-injected message. The researcher notes that the issue was patched, so the page no longer shows the message. A video walkthrough was also published:
https://www.youtube.com/watch?v=VT5I0mYipJ8&ab_channel=mufazmi
A proof of concept matters because a report that says "I think this is broken" is easy to dismiss. A page that shows the broken behaviour, plus a recording of it, is much harder to argue with.
Step 4: report, wait, and keep testing
The researcher suspected the finding was a duplicate because it had been quick to find, but reported it anyway. A duplicate is a report of a bug someone else already reported; bug bounty programmes often close duplicates without a reward. Paytm acknowledged the report by email and stated that, with so many reports coming in, duplicates and out-of-scope reports would be closed automatically without notice. Out of scope means outside the list of systems a programme allows you to test.
After the usual seven-day waiting period with no response, the researcher assumed the issue was ignored or marked duplicate and moved on. About a week later, Paytm emailed to accept that the reported issue was genuine and said they were working on a fix.
Encouraged, the researcher went back to the same target and threw several WAF bypass XSS payloads at the firewall. A WAF bypass payload is a version of an attack string written to slip past the filter, for example by encoding characters differently or splitting them up. One of them worked and triggered the XSS. The report does not give the text of that payload. The ticket was updated with the new details.
XSS, cross-site scripting, means getting your own JavaScript to run inside someone else's page. JavaScript is the language browsers execute, so code running in a Paytm page can act with Paytm's authority in that browser tab: read what the page shows, change it, or send requests as the logged-in user. That is why XSS is treated as serious even when the first symptom looks like a cosmetic message.
Step 5: reward
After reviewing the updated details, Paytm awarded 13,000 INR and sent an appreciation letter for responsible disclosure. Responsible disclosure means telling the company privately and giving them time to fix the issue before saying anything publicly.


The second certificate, as captioned in the write-up, was for reporting a full account takeover via CSRF. Account takeover means someone else gains control of your account. CSRF, cross-site request forgery, is a trick where another website makes your browser send a request to a site you are logged in to, without you intending it.
Why it worked
The ref_url parameter is reflected into the response. Output encoding means converting characters that have special meaning in HTML, such as < and >, into harmless equivalents before putting them on the page, the way a postal clerk puts a fragile parcel in a padded box. Without it, the browser cannot tell the researcher's markup from the site's own markup.
The response came back with the payload reflected as HTML rather than as JSON. Content type is the label on the envelope saying what is inside; if the label says HTML, the browser renders it as a page.
The <!-- at the end of the payload shows that the application appends something after the reflected value, and that the payload can comment it out. The X-Requested-With: XMLHttpRequest header and the JSON Accept header suggest the endpoint is designed for AJAX callers, but the server still honoured a form-encoded POST and returned HTML when the input contained markup. AJAX is the technique a page uses to fetch data in the background without reloading.
The firewall in front of the application blocked many cheat-sheet payloads but not the one that was eventually used. Signature-based filtering matches known bad strings; it does not understand the context the value ends up in, so a slightly different string can pass.
What an attacker could do
With the HTML injection, the Paytm page rendered attacker-controlled markup, including a payment offer and a link to an attacker-controlled domain. The researcher's proof of concept shows the injected message popping up on a visit to the crafted page.
The later WAF bypass payload triggered the XSS. Origin here means the combination of scheme, host and port that the browser uses to decide which site a page belongs to; script running in Paytm's origin is treated as Paytm's own code.
The separate CSRF account takeover mentioned in the second certificate is not described in the report.
The fix
The report says the issue was patched and that Paytm was working on a fix after accepting the report. The appropriate fix, given the behaviour shown, is to encode ref_url for the context it is written into, and to keep the response content type consistent with the data actually returned, so that a reflected value cannot become markup.
Variants to test
If you want to practise the same thinking on a target you are allowed to test, these are the directions the report points to:
- Spray the same cheat-sheet payload set at any parameter that is reflected into a JSON response, watching for the response flipping to HTML or text. A positive result is the payload appearing unencoded in the body with a content type the browser will render.
- Try the
<!--comment terminator on reflected parameters where the application appends a suffix. A positive result is the suffix disappearing from the rendered output. - Send form-encoded POSTs to endpoints that expect AJAX JSON, with
X-Requested-With: XMLHttpRequestand a JSONAcceptheader. A positive result is the server processing the form body and reflecting it. - Test
ref_url-style redirect parameters on other login and registration pages for both reflection and open redirect behaviour. An open redirect is when a site will send you to any address supplied in a parameter, which attackers use for convincing phishing links. A positive result is the value appearing in the response body or being used as the post-login destination. - Run the same payloads through the WAF with encoding variations until one passes, as the researcher did. A positive result is a payload that executes in the browser on the target origin.
Glossary
- API: the part of a website that answers requests with data rather than a finished page.
- AJAX: a technique where a page fetches data in the background without reloading.
- Burp Suite: a tool that sits between your browser and a website so you can capture, inspect and resend requests.
- Content type: the label on a response saying what kind of data it contains, such as JSON or HTML.
- CSRF (cross-site request forgery): a trick where another site makes your browser send a request to a site you are logged in to, without your intent.
- Duplicate: a bug report for an issue someone else already reported.
- Enumeration: listing everything that belongs to a target, such as its subdomains, before testing.
- Firewall (WAF): a filter in front of a website that blocks requests matching known attack patterns.
- HTML: the language web pages are written in, made of tags such as
<h1>and<a>. - HTML injection: getting your own HTML into someone else's page because the site reflects input without cleaning it.
- HTTP/2: a version of the protocol browsers and servers use to exchange requests and responses.
- Intruder: the Burp Suite feature that resends one request many times with different values in a chosen spot.
- JavaScript: the programming language browsers execute to make pages interactive.
- JSON: a text format for structured data, made of names and values, used by most APIs.
- Open redirect: a weakness where a site will send you to any address supplied in a parameter.
- Origin: the combination of scheme, host and port that the browser uses to decide which site a page belongs to.
- Out of scope: outside the list of systems a bug bounty programme allows you to test.
- Output encoding: converting characters with special meaning into harmless equivalents before writing them into a page.
- Parameter: a named value sent to a server, like a field on a form.
- Payload: a piece of text crafted to test whether a site mishandles input.
- Proof of concept: a small demonstration that shows a weakness is real without doing harm.
- Reflection: when a server copies your input straight back into its response.
- Responsible disclosure: telling a company privately about a bug and giving them time to fix it before going public.
- Subdomain: a smaller address under a company's main domain, such as
ondc-seller-reg.paytm.com. - Subfinder / Assetfinder: programs that look up which subdomains exist for a company.
- User agent: the line a browser sends to identify itself and its operating system.
- XSS (cross-site scripting): getting your own JavaScript to run inside someone else's page, in that site's origin.