Skip to content
XSS Disclosed report Beginner

Improper filtering of classes used in codeblocks in Markdown

Redcarpet uses the language name from a Markdown code block as the CSS class of the rendered element without filtering. If the site relies on those class names, an attacker can inject a code block whose language matches a sensitive class, breaking the page layout or triggering a popup.

markijbema Follow

Originally disclosed on HackerOne

  • Triaged in 26 hours
  • Fixed in 8 days
  • Disclosed after 47 days

Redcarpet just uses the name of the language as the classname of the element. So if the classnames are of significance to the site, one can break the site using this. For instance, this report disables the topbar, and can trigger the user into opening a popup. Proof of concept:

JS-TOPBAR
i eat the topbar
JS-SHARE-LINK
i open a popup

The original report as published on HackerOne, by markijbema. 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 Markdown renderer does not sanitise or restrict the language identifier before using it as a CSS class name, allowing attacker-controlled class names to match site-specific classes.

Impact

An attacker could break the layout of a page (for example, hide the topbar) or trigger a popup, potentially misleading or annoying users.

What the attacker needed

Ability to post Markdown content; site uses class names for behaviour

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.

Markdown lets you write code blocks and label them with a language, like 'js'. The tool that converts Markdown to HTML, Redcarpet, puts that label directly into the page as a CSS class name. If the website uses those class names to control how parts of the page look or behave, a user can choose a label that matches a sensitive class and disrupt the page.

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 HackerOne

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.