Skip to content
XSS Write-up Intermediate

Self-XSS via filename + CSRF on contact us ‘multipart/data’ form

A contact form's file-upload error message reflected the uploaded filename without proper encoding, allowing HTML and script injection. Because the upload used a multipart POST, the author built a custom CSRF page that auto-submits a file to turn the self-XSS into a reflected XSS triggered on a victim.

mchklt Follow

Published on mchklt.medium.com

السلا� عليك� و رح� ة الله قبل كل شيئ ارجو � نك� الدعاء لإخواننا في غزة, الله� أنصره� نصرا قريبا � ؤزرا

ABDELKARIM MOUCHQUELITA, on mchklt.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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the filename from the multipart upload was inserted into the error message without HTML encoding, and the endpoint accepted cross-site multipart POSTs without CSRF protection.

Impact

An attacker could run script in a victim's browser via a crafted page that auto-submits the upload, though the report does not detail what actions the script could take.

What the attacker needed

Victim visits attacker page; victim's browser submits multipart form

How it was found

  1. Submit a random string in the contact form and observe it is reflected.
  2. Upload a file with an unusual extension and see the filename reflected in an error message.
  3. Inject HTML into the filename and confirm it renders.
  4. Use a dot-free JavaScript call to bypass the extension check.
  5. Build a custom CSRF page that auto-submits a multipart file upload.
  6. Confirm the resulting reflected XSS is exploitable.

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 write-up has not been written yet. The Original tab links to the source.

A website showed back the name of a file you uploaded inside an error message. Normally only you would see this, which is called self-XSS and is not very useful. The author made a page that quietly uploads a file for the victim, so the victim's own browser runs the injected script.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by mchklt

View all

3 more disclosed reports, best first.

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.