Skip to content
XSS Write-up Beginner

403 Forbidden? No Problem, Here’s a POST XSS

A reflected cross-site scripting vulnerability existed in the email address field of a form at /mail.asp, while similar forms on other paths blocked the payload. An attacker could execute arbitrary JavaScript in a victim's browser by submitting a crafted email address.

Remmy Follow

Published on medium.com

Greetings to all the brilliant minds in the hacking community! I go by the name Remmy, and I’d like to share my experience with a successful POST XSS exploitation, which came after encountering a 403 Forbidden error on the application’s main web-page.

Remmy, on medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

This is a write-up of a cross-site scripting finding on a subdomain of a target whose scope accepted any subdomain. The researcher calls the target redacted.com, and the scope was:

Text
*.redacted.com

The feature involved is a set of email submission forms. The main page of the affected subdomain returned a 403 Forbidden, but a directory found through fuzzing, /archive, contained a form where a visitor could submit an email address. Two further paths under that directory, /download.asp and /mail.asp, also presented email address forms. The report does not describe the server stack.

Setup

The report does not describe any accounts, roles or authentication. The work was reconnaissance and fuzzing against a public web application, using the following tools:

  • Subfinder, Amass and crt.sh for subdomain enumeration
  • DNS brute force
  • HTTPX to filter live hosts
  • ffuf with the raft-large wordlist for content discovery

The only precondition was that the subdomain was in scope, which it was under the wildcard scope above.

Finding it

Subdomain enumeration with Subfinder, Amass and crt.sh, plus DNS brute force, produced nearly 40,000 subdomains. Running HTTPX over them left approximately 2,500 live and active hosts. After several days of work on the target, one subdomain stood out:

Text
rplicense.redacted.com

Opening it returned a 403 Forbidden with the message "Access is denied." Rather than move on, the researcher tested whether the 403 applied to the whole host or only to the main page by requesting a dummy path:

Text
rplicense.redacted.com/dummy

The response changed from 403 to 404 Not Found. That told the researcher the 403 was specific to the main page and not a blanket restriction on every path, so there was still surface to enumerate.

Exploitation

Step 1: fuzz the host

With the 403 confirmed as page-specific, the researcher fuzzed the application with ffuf and the raft-large wordlist:

Bash
ffuf -u "rplicense.redacted.com/FUZZ" -w /path/to/word-list -H "User-Agent: Mozilla/5.0 (Galaxy S22; Android 6) AppleWebKit/537.48 (KHTML, like Gecko) Chrome/111.0.5628.105 Mobile Safari/537.48" -rate 20

The FUZZ keyword is the position ffuf substitutes wordlist entries into. The custom User-Agent header presents the requests as coming from a mobile browser, and -rate 20 caps the request rate at 20 per second. After roughly 30 to 40 minutes, the run surfaced a path named /archive.

Step 2: try the first form

The /archive directory contained a form where a visitor could submit an email address. The researcher put an XSS payload into the email address field:

HTML
<script>alert(origin)</script>

The application rejected it with the error:

Text
The email address contains malicious charachter, please try again

So this form had some filtering in place. The researcher went back to fuzzing, this time against the /archive directory itself.

Step 3: find more forms

Fuzzing under /archive uncovered two more paths, /download.asp and /mail.asp. Both presented forms for entering an email address. The same payload was submitted on /download.asp and produced the same "malicious charachter" error, so that endpoint appeared to share the filtering.

Step 4: exploit /mail.asp

The /mail.asp page had a form structure identical to /download.asp. The researcher submitted the same payload there, and this time the JavaScript executed. The vulnerable parameter was:

Text
email_address

The forms looked identical, but the same payload was rejected on /download.asp and executed on /mail.asp.

Step 5: host the payload and report

After the successful execution on /mail.asp, the researcher asked a friend, Ayrix, to host the payload on his server, because the researcher did not have access to Nginx or Apache at the time. The report was then written and submitted to the program. Bugcrowd triaged it within two to three days, and the researcher received a three-digit bounty from the application.

From the original on medium.com

Root cause

What the behaviour shows is that the payload submitted in the email_address parameter on /mail.asp executed as script in the browser. Whether the difference was a separate code path, a missing include, or a filter that only ran on some endpoints is not described.

Impact

The report does not analyse impact beyond the successful execution of the payload. In general terms, reflected XSS in a form field lets an attacker craft a link that runs script in the victim's browser in the context of the affected subdomain, which can be used to act as the victim or to manipulate what the page shows.

Fix

The appropriate fix is to ensure the email_address value cannot execute as script on /mail.asp, and to apply the same handling that rejected the payload on /archive and /download.asp. Encoding is the more reliable of the two, since blocklists of "malicious characters" are easy to bypass.

Variants to test

  1. Compare sibling endpoints that share a form design. Submit the same payload to each and look for a difference in response: one endpoint rejecting it while another reflects it is the pattern seen here.
  2. Test the same parameter with alternative payloads when a filter rejects the obvious one, for example different tag and event combinations, and check whether the response reflects the value encoded or raw.
  3. When a host returns 403 on the root, request a dummy path to see whether the block is page-specific, then fuzz from there. A 404 instead of 403 is the signal to keep going.
  4. Fuzz inside a discovered directory rather than only at the host root, since the additional endpoints here were found under /archive.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

A security researcher found a bug in a website that let him run his own small program (JavaScript) inside other people's browsers when they visited a particular page. This kind of bug is called cross-site scripting, or XSS for short. The interesting part of the story is that the front door of the website was locked: the main page refused to load at all. Most people would have walked away. Instead, the researcher checked whether the lock was on the whole building or just the front door, found a side entrance, and kept looking until he found a form that accepted his code without complaint.

This article walks through the same steps he took, in the same order, and explains every tool and term along the way. You only need to know how to use a browser and a computer to follow it.

The target and the scope

The researcher was testing a company's website. In bug bounty programmes, a company invites outside people to look for security problems and pays them for reporting what they find. The company publishes a scope: the list of systems that are fair game. Anything outside the scope must not be touched, because testing it would be unauthorised.

Here the scope was a wildcard:

Text
*.redacted.com

A wildcard is a stand-in for "anything". The * means every possible subdomain of redacted.com. A subdomain is a name that sits in front of the main domain, like shop.example.com or mail.example.com for example.com. Companies often run dozens or hundreds of them, and each one is a separate website that may be built and maintained differently. The researcher replaced the real company name with redacted.com so he could publish the story without pointing at the live target.

The feature involved

The thing that turned out to be broken was a set of forms where a visitor types an email address and submits it. You have used forms like this: a newsletter signup, a "send me the file" box, a "email me a copy" field. The website takes what you typed and does something with it, usually sending a message or starting a download.

The main page of the affected subdomain returned a 403 Forbidden, which is the web server's way of saying "I understood your request and I refuse to serve it". But a folder found later, /archive, contained one of these email forms. Two more pages under that folder, /download.asp and /mail.asp, also showed email forms. The report does not describe the server behind these pages.

The tools used

The researcher did not have any special access. He had no account, no password, no insider role. Everything below was done against a public website. The report lists these tools:

  • Subfinder, Amass and crt.sh to find subdomains
  • DNS brute force, a technique for guessing subdomain names
  • HTTPX to check which of the found hosts are actually alive
  • ffuf with a wordlist called raft-large to discover pages and folders

A wordlist is simply a long text file with one guess per line: common folder names like admin, backup, images, archive. A tool reads the file and tries each line as part of a URL. ffuf is one such tool. It is fast, it can send many requests, and it reports which guesses produced a response that looks different from the rest.

Finding it

Step 1: collect subdomains

The researcher ran Subfinder, Amass and crt.sh, and also did DNS brute force. Together these produced nearly 40,000 subdomains. That is a lot of names, and most of them will not be live. Running HTTPX over the list left approximately 2,500 hosts that actually answered. HTTPX is a checker: you give it a list of names, it knocks on each one and tells you which doors open.

After several days of work on the target, one subdomain stood out:

Text
rplicense.redacted.com

Opening it in a browser returned a 403 Forbidden with the message "Access is denied." That is the digital equivalent of a locked front door with a sign saying "no entry".

Step 2: check whether the lock is on the whole building

This is the key decision in the whole story. A 403 on the main page can mean two very different things:

  1. The whole host is blocked, and there is nothing to find.
  2. Only the main page is blocked, and other pages on the same host may still work.

To tell them apart, the researcher requested a made-up path:

Text
rplicense.redacted.com/dummy

dummy is not a real page. It is a nonsense word used as a probe. If the whole host were blocked, this request would also get a 403. Instead, the answer changed to 404 Not Found, which means "I looked and there is no such page". That is a completely different message: the server was willing to talk, it just had nothing at that address. So the 403 was specific to the main page, and the rest of the host was still open for exploration.

Why does this matter? Because a 403 on the root is exactly the kind of thing that makes people give up. A single extra request, with a path that cannot exist, tells you whether giving up is correct.

Step 3: fuzz the host

With the 403 confirmed as page-specific, the researcher ran ffuf against the host using the raft-large wordlist:

Bash
ffuf -u "rplicense.redacted.com/FUZZ" -w /path/to/word-list -H "User-Agent: Mozilla/5.0 (Galaxy S22; Android 6) AppleWebKit/537.48 (KHTML, like Gecko) Chrome/111.0.5628.105 Mobile Safari/537.48" -rate 20

Line by line:

  • ffuf is the program being run.
  • -u "rplicense.redacted.com/FUZZ" is the address to test. The word FUZZ is a placeholder: ffuf replaces it with each line from the wordlist, one at a time. So the first request might be rplicense.redacted.com/admin, the next rplicense.redacted.com/backup, and so on.
  • -w /path/to/word-list points at the wordlist file. The path is written as a placeholder here because the real location on the researcher's machine is not part of the story.
  • -H "User-Agent: ..." adds a header to every request. A header is a small piece of extra information sent alongside a web request, like the note you write on an envelope. The User-Agent header tells the server what browser and device is asking. Here it claims to be a mobile Chrome browser on a Galaxy S22 phone. Servers sometimes behave differently for mobile visitors, so presenting as one can reveal pages that a desktop browser would not see.
  • -rate 20 limits the tool to 20 requests per second. This is politeness and safety: it keeps the traffic low enough not to overload the server or trip alarms.

After roughly 30 to 40 minutes, the run surfaced a path named /archive. That is a folder on the website, and inside it was a form where a visitor could submit an email address.

Step 4: try the first form

An XSS payload is a small piece of HTML or JavaScript that, if a website echoes it back without cleaning it, will run in the browser of whoever views the page. The simplest test payload is a script tag that pops up a box:

HTML
<script>alert(origin)</script>

Line by line:

  • <script> tells the browser "everything until the closing tag is JavaScript, please run it".
  • alert(origin) opens a pop-up box showing the value of origin. origin is a built-in browser value that contains the address of the page, for example https://rplicense.redacted.com. Showing it proves two things at once: that code ran, and which site it ran on.
  • </script> closes the script block.

The researcher typed this into the email address field on the /archive form and submitted it. The application refused, with this error:

Text
The email address contains malicious charachter, please try again

(The spelling mistake is in the original message.) So this form had a filter: a check that looks at what you typed and rejects anything that looks like code. The error message shows the form rejected the input. That is like a bouncer with a list of banned faces: effective against the faces on the list, useless against anyone not on it.

Step 5: fuzz inside the folder

Rather than give up, the researcher went back to fuzzing, this time pointing ffuf at the /archive folder itself instead of the host root. The reasoning is simple: if one folder exists, it may contain more pages that were not linked from anywhere. Fuzzing inside a discovered folder is like finding one door in a wall and checking whether there are more doors along the same corridor.

This uncovered two more paths: /download.asp and /mail.asp. Both showed forms for entering an email address.

Step 6: test the second form

The same payload was submitted on /download.asp. It produced the same "malicious charachter" error. So that page appeared to share the same filter as /archive.

Step 7: exploit /mail.asp

The /mail.asp page had a form that looked identical to the one on /download.asp. Same fields, same layout, same purpose. The researcher submitted the same payload there, and this time the JavaScript executed. The pop-up appeared.

The vulnerable parameter was:

Text
email_address

A parameter is a named value that a form sends to the server. When you fill in a field and press submit, the browser packages your input under a name, here email_address, and sends it along. The server then reads that name to know which field the value belongs to. The report names this parameter because it is the exact spot where the input was mishandled.

The forms looked the same on screen, but the same payload was rejected on /download.asp and executed on /mail.asp. Two doors that look the same from the street, with different locks behind them.

Step 8: host the payload and report

After the successful execution on /mail.asp, the researcher asked a friend, Ayrix, to host the payload on his server, because the researcher did not have access to Nginx or Apache at the time. Nginx and Apache are web server programs: software that runs on a computer and serves web pages to visitors. Hosting the payload means putting a file somewhere on the internet so it can be loaded by a browser, which is useful when demonstrating that an attack can pull in outside content.

The report was then written and submitted to the programme. Bugcrowd is a bug bounty platform: a company that runs the reporting and payment process on behalf of the organisations that invite researchers. Within two to three days, Bugcrowd triaged the report, meaning staff reviewed it, confirmed it was valid and passed it on. The researcher received a three-digit bounty from the application, so a payment somewhere between 100 and 999 in the programme's currency.

From the original on medium.com

Why it worked

The report does not show the server-side code, so the exact mechanism is not stated. What the behaviour shows is that the payload submitted in the email_address parameter on /mail.asp executed as script in the browser. Encoding here means converting characters that have a special meaning in HTML, such as < and >, into harmless equivalents so the browser displays them as text instead of treating them as instructions.

Whether the cause was a separate piece of code, a missing shared check, or a filter that only ran on some pages is not described.

What the impact could be

The report does not analyse impact beyond the successful execution of the payload. In general terms, this kind of bug, called reflected XSS, works like this: an attacker builds a link that contains the payload, sends it to a victim, and when the victim clicks it the script runs in the victim's browser as if it came from the real site. From there the script could act as the victim or change what the page shows.

A cookie is a small piece of data a website stores in your browser so it can recognise you on your next request, a bit like a cloakroom ticket. If a script runs on the site's own pages, it may be able to read or use that ticket, which is why XSS matters.

How to fix it

The appropriate fix is to ensure the email_address value cannot execute as script on /mail.asp, and to apply the same handling that rejected the payload on /archive and /download.asp. Encoding is the more reliable of the two, because blocklists of "malicious characters" are easy to get around.

Other things worth trying

  1. Compare pages that share a form design. Submit the same payload to each and look for a difference: one page rejecting it while another accepts it is exactly the pattern seen here.
  2. When a filter rejects the obvious payload, try other tag and event combinations, and check whether the response shows the value encoded or raw.
  3. When a host returns 403 on the root, request a made-up path to see whether the block is page-specific, then fuzz from there. A 404 instead of a 403 is the signal to keep going.
  4. Fuzz inside a folder you have already found, not only at the host root. The extra pages here were found under /archive.

Glossary

  • Subdomain: a name in front of a main domain, such as shop.example.com for example.com; each one is a separate website.
  • Scope: the list of systems a bug bounty programme allows researchers to test.
  • Wildcard: a * symbol meaning "anything", used in scope to cover every subdomain.
  • Bug bounty programme: an arrangement where a company pays outside researchers for reporting security problems.
  • 403 Forbidden: the server's answer meaning "I understood you and I refuse to serve this".
  • 404 Not Found: the server's answer meaning "there is no page at this address".
  • Subdomain enumeration: the process of discovering which subdomains exist for a domain.
  • DNS brute force: guessing subdomain names from a list and checking which ones resolve.
  • HTTPX: a tool that checks a list of hosts and reports which ones are alive.
  • ffuf: a fast tool that substitutes wordlist entries into a URL to discover pages and folders.
  • Wordlist: a text file with one guess per line, used by fuzzing tools.
  • raft-large: the name of a well-known wordlist used for content discovery.
  • Fuzzing: automatically trying many inputs to see which produce an interesting response.
  • Header: extra information sent alongside a web request, such as the browser and device name.
  • User-Agent: the header that tells a server which browser and device is asking.
  • Parameter: a named value sent from a form to a server, such as email_address.
  • XSS (cross-site scripting): a bug where a website lets an attacker's code run in another visitor's browser.
  • Payload: the small piece of code used to test or exploit a bug.
  • Reflected XSS: XSS where the payload is echoed straight back in the response to the same request.
  • Filter: a check that inspects input and rejects what it considers dangerous.
  • Blocklist: a list of things that are banned; it only stops what is on the list.
  • Encoding: converting special characters into harmless equivalents so they are shown as text, not run as code.
  • Cookie: a small piece of data a site stores in your browser to recognise you later.
  • Nginx / Apache: web server programs that serve web pages to visitors.
  • Bugcrowd: a bug bounty platform that handles reports and payments for organisations.
  • Triaged: reviewed and confirmed as valid by the programme before being passed on.

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.