Skip to content
XSS Disclosed report Beginner

HTML in Diffusion not escaped in certain circumstances

Diffusion's source code viewer failed to escape HTML when syntax highlighting was automatically disabled for large files, so HTML and JavaScript in the file were parsed by the browser. An attacker could place script in a file and have it execute when a victim viewed the file in Diffusion.

danny_b Follow

Originally disclosed on HackerOne

  • Fixed in under an hour
  • Paid in under an hour
  • Disclosed after 30 days

HTML in Diffusion source code listing is not escaped

Steps to reproduce:

  • have the syntax hilight turned on
  • the file is bigger than 256kB, thus syntax hilight is claimed in header to be turned off automatically, however, plaintext file doesn't display like with regular (manual) syntax highlight off, but the content is being parsed

File should contain HTML constructions, but could be of any type (extension). Having javascript constructions there with alert() within the HTML causes such dialogues to pop up on given page obviously.

The original report as published on HackerOne, by danny_b. 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 automatic syntax-highlighting-off path for files over 256kB rendered the file content without HTML escaping, unlike the manual highlight-off path.

Impact

An attacker could run JavaScript in the browser of anyone who viewed a crafted file in Diffusion, such as showing alert dialogues.

What the attacker needed

Ability to upload or create a file in Diffusion; victim views the file; file larger than 256kB; syntax highlighting enabled

How it was found

  1. Turn on syntax highlighting.
  2. Use a file larger than 256kB so highlighting is automatically disabled.
  3. Include HTML with JavaScript such as alert() in the file.
  4. View the file in Diffusion and observe the script executing.

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.

When a website shows you a file's contents, it should treat the text as plain text, not as a web page. Here, a large file made the site turn off its usual code colouring, but it still let the browser read the file as HTML, so any script inside ran. That means someone could upload a file that runs code in another user's browser when they open it.

What is XSS?

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

More from Phabricator

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.