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.
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:
i eat the topbar
i open a popup
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.