Story about my first bug bounty
Two DOM-based cross-site scripting vulnerabilities were found in the title parameter of classify.html pages on a subdomain. An attacker could execute arbitrary JavaScript in a victim's browser by crafting a malicious link.
Published on medium.com
#### Sudhanshu Rajbhar
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
This is the story of two DOM-based XSS bugs found in Alibaba's bug bounty programme, both on the subdomain samsung.ucweb.com. The researcher picked ucweb.com out of a list of in-scope domains that also included alipay.com, after reading Alibaba's policy and scope and watching public proof-of-concept videos of previously found XSS bugs on Alibaba sites to get an idea of the target.
The affected feature is a classification page, classify.html, which takes a dataKey and a title parameter. The title value was reflected into the page, and the researcher found no filter on it.
Setup
No accounts or special roles were needed. The work was done from the outside against the public subdomain. The tools used were:
- VirusTotal (
https://virustotal.com) to enumerate subdomains. - Google dorking to find indexed, reachable endpoints on the subdomain.
- A browser to test reflection and payloads.
- Dirbuster and gobuster, which both failed on this subdomain with errors.
- Dirsearch, which worked and produced the second endpoint.
The researcher notes that this was the first week of August and that a maths exam was two days away, which sets the timeframe but has no bearing on the technique.
Finding it
Recon started with subdomain enumeration on VirusTotal. Nothing interesting turned up at first, so the researcher narrowed to ucweb.com subdomains and found samsung.ucweb.com. Opening it produced a page that most people would ignore.

Rather than moving on, the researcher recalled an article advising that when you hit a page like this, you should search for the site on Google, because an indexed endpoint may still be reachable. The dork used was:
site:samsung.ucweb.com
The results surprised the researcher.

Exploitation
Step 1: test the first endpoint for reflection
The indexed URL was:
http://samsung.ucweb.com/webstore/classify.html?dataKey=LifeStyle&title=LifeStyle
Testing the parameters showed that title reflected the input back into the page. To check whether any filtering was in place, the researcher submitted:
The markup was accepted, so there was no filter on the parameter.

Step 2: get script execution
The first payload tried was:
<script>alert(1)</script>
This did not work. The next payload was:
<img src=x onerror=alert('XSS')>
This executed and produced the XSS popup. The src=x points at a resource that does not exist, the load fails, and the onerror handler runs the JavaScript. Because the title value is written into the page as markup, the injected element is created and its handler fires.

The report was submitted at https://security.alibaba.com and the response was fast. The researcher was rewarded with $50 for this first bug. The report also mentions a $100 reward on HackerOne on vhx.
Step 3: find a second endpoint after the fix
The first endpoint was removed as a fix, and opening it now returns a 404 not found. To find a replacement, the researcher tried directory brute forcing on the same subdomain. Dirbuster and gobuster both errored out on this host, so they were abandoned. Some days later the researcher learned about dirsearch, which ran without problems and returned one more endpoint:
/test/
Step 4: exploit the second endpoint
Opening http://samsung.ucweb.com/test/ led to a page with the same structure as before:
http://samsung.ucweb.com/test/classify.html?dataKey=New&title=
The same payload was used and the XSS popup appeared again.

This second bug also earned a $50 bounty from Alibaba. The researcher's closing advice is to run directory brute-force tools against subdomains of the target, because you might get lucky the same way.
Root cause
The title parameter is reflected into the page and interpreted as HTML, so an attacker-controlled value becomes live markup and script. The researcher confirmed there was no filter by submitting <b></b> and seeing it accepted. Why <script>alert(1)</script> failed while the img/onerror payload succeeded is not explained in the report; likely the injection point sits in a context where a script element does not execute, while an element with an event handler does. The first endpoint was removed as a fix, and the same pattern was later found under /test/.
Impact
An attacker who can get a victim to open a crafted URL on samsung.ucweb.com can run JavaScript in the context of that origin. The report does not describe any further actions taken from the injected script, so the demonstrated impact is script execution in the victim's browser on that subdomain. Exploitation depends on the victim following the crafted link.
Fix
What was actually changed for the first bug was removal of the /webstore/classify.html endpoint, which now returns 404. The second endpoint under /test/ was found afterwards. The report does not describe a code-level fix. The appropriate fix is to stop writing the title value into the page as markup, for example by HTML-encoding it or by assigning it through a property such as textContent rather than through HTML parsing, and to apply that fix to every copy of the page rather than deleting one path.
Variants to test
- Run a dork such as
site:target.exampleagainst a subdomain that looks dead or empty. A positive result is an indexed URL whose path is not linked from the landing page and which still responds. - Send
<b></b>in each reflected parameter. A positive result is the markup appearing unencoded in the response. - When
<script>alert(1)</script>fails, try an element with an event handler such as<img src=x onerror=alert('XSS')>. A positive result is the handler firing. - Run dirsearch against the subdomain after dirbuster and gobuster fail. A positive result is a directory such as
/test/that serves a page with the same parameter pattern as the original. - Re-test the same parameter names (
dataKey,title) on any newly discovered copy of the page. A positive result is the same reflection and execution as on the original endpoint.
What happened, in plain words
A security researcher found two bugs of the same kind on one website owned by Alibaba, and was paid for both. The bugs were on a subdomain called samsung.ucweb.com. The kind of bug is called cross-site scripting, or XSS. In plain terms, the website put a piece of text from the address bar into the page without cleaning it first. Because of that, a person could put a small piece of JavaScript (the language web pages use to make things happen) into the address, and the browser would run it as if the website itself had written it.
He found the first bug by looking at a page that seemed empty or broken, then searching Google for other pages on the same site. Google had indexed a page that still worked. He tested it, found that one of its inputs was pasted into the page without any filtering, and got a popup box to appear in his browser. He reported it and was paid $50.
The website owners fixed it by deleting that page. Later he used a tool that guesses folder names on a website, found a new folder called /test/, and the same kind of page was sitting there, still vulnerable. He used the same trick, got the popup again, and was paid another $50.
That is the whole story. The rest of this article walks through it step by step, explaining each idea as it comes up.
Some words you will meet
Before we start, a few ideas that come back again and again.
- A domain is the main name of a website, like
ucweb.com. A subdomain is a name placed in front of it, likesamsung.ucweb.com. Think of the domain as a building and the subdomain as a named office inside it. They can be run by different teams and have different code. - A bug bounty programme is a deal a company offers: if you find a security problem in our systems and tell us privately, we pay you a reward (called a bounty) instead of calling lawyers. Alibaba runs one.
- The scope is the list of websites and systems the programme covers. If you find a bug outside the scope, you usually get nothing.
- A parameter is a named value you see in a web address after a question mark. In
page.html?colour=red, the parameter iscolourand its value isred. Parameters are how a page receives instructions from the address bar. - Reflection means the page takes a value from the address and writes it back into the page it sends you. If you type
helloand the page showshelloback, that value is reflected. - HTML is the language that describes what is on a page: headings, images, links. When a browser receives a page, it reads the HTML and builds the page from it. Anything that looks like HTML gets treated as HTML, not as plain text.
- JavaScript is the programming language that runs inside your browser. It can read things, change the page, and show popups. If an attacker can get their own JavaScript to run on a website's page, that is the bug called XSS.
- DOM-based XSS is a specific flavour. The letters DOM stand for Document Object Model, which is the browser's in-memory model of the page. In DOM-based XSS, the server does not do anything wrong; the page's own JavaScript reads something from the address bar and inserts it into the page. The damage happens entirely inside your browser.
- A payload is the piece of text an attacker sends to try to trigger a bug. It is like a test key cut to fit a lock.
- Filtering means the website checks the input and removes or blocks dangerous characters. If there is no filtering, whatever you send goes straight through.
- Directory brute forcing means using a program to try a long list of common folder and file names against a website, hoping one exists. It is like trying every key on a keyring on a door.
- A dork is a search query written in a special way to make Google show particular results. Security researchers use dorks to find pages that are publicly indexed but not linked from anywhere obvious.
- 404 not found is the standard reply a web server gives when the page you asked for does not exist.
The setup
No account was needed. The researcher worked entirely from the outside, using only public information and a browser. The tools he mentions are:
- VirusTotal (
https://virustotal.com), a website that, among other things, keeps records of domain names and subdomains people have seen. Researchers use it to discover subdomains that are not advertised anywhere. - Google, used with a dork to find pages on the subdomain that Google had already indexed.
- A normal browser, to open pages and try inputs.
- Dirbuster and gobuster, two programs that guess folder and file names on a website. Both failed on this subdomain with errors.
- Dirsearch, a similar program, which worked and found the second endpoint.
An endpoint is simply a specific address on a website that does something, as opposed to the front page. If a website is a building, an endpoint is a particular door with a particular room behind it.
The researcher mentions that it was the first week of August and that his maths exam was two days away. That tells you when this happened and how distracted he was, but it has nothing to do with the technique.
Finding the first bug
Step 1: look for subdomains
He started by looking for subdomains of the target. He went to VirusTotal and went through the list one by one. Nothing interesting at first, so he narrowed his search to subdomains of ucweb.com and found samsung.ucweb.com. The name suggests a Samsung-branded section of the site, so he opened it.

The image shows the page he got, the kind of page most people would ignore.
Step 2: search Google for the same site
Here is the key idea. A page can look dead and still have working pages underneath it. The front door is locked, but a side door is open and nobody has told Google to forget about it.
The researcher remembered an article that said: when you hit a page like this, search Google for the site, because an indexed endpoint may still be reachable. So he ran this search:
site:samsung.ucweb.com
Line by line: site: is a Google operator that means "only show results from this website". samsung.ucweb.com is the site he wanted. The whole query asks Google to list every page it knows about on that subdomain.
The results surprised him.

Step 3: test the first endpoint for reflection
The indexed URL he opened was:
http://samsung.ucweb.com/webstore/classify.html?dataKey=LifeStyle&title=LifeStyle
Line by line: http:// is the protocol, the way the browser talks to the server. samsung.ucweb.com is the subdomain. /webstore/classify.html is the path to a specific page, a classification page inside a folder called webstore. After the ? come the parameters: dataKey=LifeStyle and title=LifeStyle. The & separates them. So the page is being told: the data key is LifeStyle and the title is LifeStyle.
He started testing the parameters. The title parameter was reflected: whatever he put there came back in the page. To check whether any filtering was in place, he submitted:
Line by line: <b> is the HTML tag for bold text, and </b> closes it. There is nothing between them, so it would not visibly change anything. That is the point: he was not trying to make text bold, he was checking whether the page would accept HTML tags at all. If the page had been filtering, it would have shown the literal characters <b></b> on screen. Instead, the markup was accepted, which means there was no filter on the parameter.

Step 4: get JavaScript to run
The first payload he tried was:
<script>alert(1)</script>
Line by line: <script> tells the browser that what follows is JavaScript. alert(1) is a JavaScript instruction that opens a popup box showing the number 1. </script> closes the script block. If this had worked, a popup would have appeared.
It did not work. The report does not explain why, but the likely reason is that the place where the value lands in the page is a context where a <script> tag does not execute. Browsers are fussy about when a script tag runs: if it is inserted into the page after the page has already been parsed, it often does nothing.
So he tried a different payload:
<img src=x onerror=alert('XSS')>
Line by line: <img> is the HTML tag for an image. src=x tells the browser to load the image from a location called x, which does not exist. onerror= is an attribute that says: if loading the image fails, run the JavaScript that follows. alert('XSS') is that JavaScript: a popup showing the text XSS. The closing > ends the tag.
The trick is that the image is guaranteed to fail to load, because x is not a real address. When it fails, the browser runs the onerror code. Because the title value is written into the page as markup, the browser builds the image element and its handler fires.
This time it worked, and the popup appeared.

He submitted the report at https://security.alibaba.com and the response was fast. He was rewarded $50 for this first bug. The report also mentions a $100 reward on HackerOne on vhx.
Finding the second bug
Step 5: the fix removed the page
The first endpoint was removed as a fix. Opening it now returns a 404 not found. The first endpoint was removed as a fix, and opening it now returns a 404 not found.
Step 6: guess folder names
To find a replacement, the researcher tried directory brute forcing on the same subdomain. The idea is simple: a website has folders and files with names, and many of those names are predictable (admin, test, backup, images). A program can try thousands of names quickly and tell you which ones exist.
Dirbuster and gobuster both errored out on this host, so he abandoned them. Some days later he learned about dirsearch, which ran without problems and returned one more endpoint:
/test/
Line by line: this is a folder path on the subdomain. The leading and trailing slashes mean it is a directory, not a file.
Step 7: exploit the second endpoint
Opening http://samsung.ucweb.com/test/ led to a page with the same structure as before:
http://samsung.ucweb.com/test/classify.html?dataKey=New&title=
Line by line: same subdomain, same file name classify.html, but now inside /test/ instead of /webstore/. The parameters are dataKey=New and title=, with the title left empty so the payload can be placed there. It is the same kind of URL as before, inside /test/ instead of /webstore/.
The same payload was used and the XSS popup appeared again.

This second bug also earned a $50 bounty from Alibaba. The researcher's closing advice is to run directory brute-force tools against subdomains of the target, because you might get lucky the same way.
Why the bug happens
The title parameter is reflected into the page and interpreted as HTML, so an attacker-controlled value becomes live markup and script. The researcher confirmed there was no filter by submitting <b></b> and seeing it accepted. Why <script>alert(1)</script> failed while the img/onerror payload succeeded is not explained in the report; likely the injection point sits in a context where a script element does not execute, while an element with an event handler does. The first endpoint was removed as a fix, and the same pattern was later found under /test/.
What an attacker could do
An attacker who can get a victim to open a crafted URL on samsung.ucweb.com can run JavaScript in the context of that origin. The report does not describe any further actions taken from the injected script, so the demonstrated impact is script execution in the victim's browser on that subdomain. Exploitation depends on the victim following the crafted link.
How it should be fixed
What was actually changed for the first bug was removal of the /webstore/classify.html endpoint, which now returns 404. The second endpoint under /test/ was found afterwards. The appropriate fix is to stop writing the title value into the page as markup, for example by HTML-encoding it or by assigning it through a property such as textContent rather than through HTML parsing, and to apply that fix to every copy of the page rather than deleting one path.
Things to try on your own targets
- Run a dork such as
site:target.exampleagainst a subdomain that looks dead or empty. A positive result is an indexed URL whose path is not linked from the landing page and which still responds. - Send
<b></b>in each reflected parameter. A positive result is the markup appearing unencoded in the response. - When
<script>alert(1)</script>fails, try an element with an event handler such as<img src=x onerror=alert('XSS')>. A positive result is the handler firing. - Run dirsearch against the subdomain after dirbuster and gobuster fail. A positive result is a directory such as
/test/that serves a page with the same parameter pattern as the original. - Re-test the same parameter names (
dataKey,title) on any newly discovered copy of the page. A positive result is the same reflection and execution as on the original endpoint.
Glossary
- Bounty: the money a company pays a researcher for reporting a security bug privately.
- Bug bounty programme: a company's formal offer to pay for security reports within a defined scope.
- Cross-site scripting (XSS): a bug where an attacker's JavaScript runs inside a victim's browser on a website's page.
- DOM-based XSS: XSS where the page's own JavaScript reads attacker-controlled input from the address bar and inserts it into the page, without the server being involved.
- DOM (Document Object Model): the browser's in-memory model of the page, which JavaScript can read and change.
- Domain: the main name of a website, such as
ucweb.com. - Subdomain: a name placed in front of a domain, such as
samsung.ucweb.com. - Endpoint: a specific address on a website that does something, as opposed to the front page.
- Parameter: a named value in a web address after the question mark, such as
title=LifeStyle. - Reflection: when a page takes a value from the address and writes it back into the page.
- HTML: the language that describes the structure of a web page.
- JavaScript: the programming language that runs inside a browser and can change the page.
- Payload: the piece of text an attacker sends to try to trigger a bug.
- Filtering: checking input and removing or blocking dangerous characters.
- Dork: a specially written search query used to find particular pages.
- Directory brute forcing: using a program to try a long list of common folder and file names against a website.
- 404 not found: the standard reply a web server gives when the requested page does not exist.
- VirusTotal: a website that keeps records of domains and subdomains people have seen, among other things.
- Dirbuster, gobuster, dirsearch: programs that guess folder and file names on a website.
- HackerOne: a platform where companies run bug bounty programmes and researchers submit reports.