FirstBlood-#1396 — Stored XSS on doctors.php
This issue was discovered on FirstBlood v3
On 2022-12-09, 0xblackbird Level 5 reported:
I hope you're doing great today!
I found a stored XSS vulnerability on
/doctors.phppassed on from
/drpanel/drapi/edit-dr.php. The doctor's name parameter is reflected in the source code without being filtered or escaped correctly on
The developers may have underestimated how XSS payloads can be formed and I suspect that it went wrong here with the regex. I checked if a value starts with a
<and ends with
>. If it matched, it encodes it.
Steps to reproduce:
1) Go to
/drpanel/edit-doctor.php?id=1and submit the following payload as the doctor's name:
2) Next, visit
3) A popup should be displayed with the document's domain:
We can elevate our privileges by easily taking over the doctor's account as cookies are not set to be HTTPOnly. To do so, we could put the following payload in the phone parameter to steal and send the cookies back to us:
Next, visit the endpoint again:
Upon visiting the URL (as the victim), we can see a hit with the cookies on our server:
I highly recommend encoding any user input and validating it before reflecting it in the response.
FirstBlood ID: 55
Vulnerability Type: Stored XSS
It is possible to achieve stored XSS on the /doctors.php endpoint via a malicious doctors name