Skip to content
XSS Disclosed report Beginner

Bad content-type in response header when getting document can lead to html injection

The server returned documents with a text/html content type regardless of the file's actual format, so an uploaded file containing HTML would be rendered as HTML when another user requested it. This could allow an attacker to inject HTML into the victim's browser.

trichimtrich_ Follow

Originally disclosed on HackerOne

Medium 6.5 View original
  • Triaged in 3 days
  • Fixed in 2 months
  • Disclosed after 3 months

Bug

When request document by genesis_id or filename, the content-type field in response header is 'text/html'. And the document content can be anything. So if we upload an odt file with html format and share with other users, it can lead to html injection when others request that file.

PoC

  • img1 via es_id
  • img2 via filename (share with others)

Attachments

img1.png
img1.png From the original on HackerOne
img2.PNG
img2.PNG

The original report as published on HackerOne, by trichimtrich_. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 application set a fixed text/html content type for all document responses instead of deriving it from the file's actual type or forcing a download.

Impact

An attacker could inject HTML into another user's browser when that user opens the shared document.

What the attacker needed

Ability to upload a document; ability to share it with a victim; victim opens the shared document

How it was found

  1. Upload an ODT file whose content is HTML.
  2. Share the file with another user.
  3. Have the other user request the document by its identifier or filename.
  4. The response is served as text/html and the HTML is injected.

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.

The label always said 'web page' even for files that were not web pages, so a file containing HTML code would be shown as a web page and its HTML would be injected.

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 trichimtrich_

View all

1 more disclosed report, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

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.