Skip to content
CSRF Write-up Intermediate

Stored CSRF via Uploaded HTML File in User Account Document Section

An uploaded HTML file was stored in a user's document section and executed when an admin opened it, letting the file submit a logout request as the admin. The attacker could force the admin's session to end, and the same stored-file trick could target other actions.

jxycybersec Follow

Published on jxycybersec.medium.com

During my internship, I was assigned the task of finding vulnerabilities in a CRM system. My approach involved testing each functionality methodically.

Digvijay Gholase, on jxycybersec.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 application stored user-uploaded HTML and served or opened it in a way that let its scripts run in the admin's browser session, instead of forcing a download or serving it as inert content.

Impact

The admin's session could be terminated, and the same stored-file technique could potentially be used to trigger other actions on the admin's behalf.

What the attacker needed

A low-privileged account; admin opens the uploaded file; file upload feature enabled

The fix

The application should not execute uploaded HTML in a privileged user's browser; uploads should be served as inert downloads with a safe content type and a content security policy.

How it was found

  1. Log in as admin, create a new user account and grant it permission to modify its own data.
  2. Log in as the new user and open the linked files page in the card section.
  3. Upload a crafted HTML file that auto-submits a logout request.
  4. Log back in as admin and open the user list to see the upload notification.
  5. Click the uploaded file, which downloads automatically, then open it.
  6. The file runs and the admin account is logged out.

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 let a normal user upload an HTML file, which is a web page rather than a plain document. When an admin later opened that file, the browser ran the page's code and sent a request to the site as the admin, so the admin was logged out. This is called cross-site request forgery: making a logged-in person's browser perform an action they did not intend.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.