Skip to content
XSS Disclosed report Intermediate

In markdown, parsing things like @danlec and #46072 after links is unsafe

Markdown parsing adds links for user mentions and submission references after the initial markdown is processed, so these links can be injected inside the attribute values of existing links. This produces malformed HTML with unexpected attributes, though the author has not worked out an actual exploit.

danlec Follow

Originally disclosed on HackerOne

  • Triaged in 26 hours
  • Fixed in 6 days
  • Disclosed after 5 months

(Let me preface this by saying that I haven't worked out an actual exploit for this, and there may not be one, but when #46072 is disclosed, folks will probably be taking a closer look at HackerOne's markdown parsing and may find a way to turn this bug into something)

It looks like the links for things like @danlec and #46072 are being added to the HTML after the initial markdown is processed; this leads to situations where links end up malformed because link markup is being added in an unexpected place (inside the attribute values of existing links)

For example:

[text](http://danlec.com " @danlec ")

renders as

text

i.e.

<p><a title=" <a href=" danlec"="">@danlec</a> " href="http://danlec.com"&gt;text</p>

As you can see, there's an unexpected danlec" attribute on the link tag.

The same kind of issue exists for references to other submissions, e.g.

[text](http://danlec.com " #46072 ")

renders as

text

<p><a title=" <a href=" reports="" 46072"="">#46072</a> " href="http://danlec.com"&gt;text</p>

… with an unexpected reports and 46072" attribute

The original report as published on HackerOne, by danlec. 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 mention and reference linkification runs as a post-processing step on already-rendered HTML rather than during markdown parsing, so it inserts markup inside existing attribute values.

Impact

The output HTML is malformed with unexpected attributes, and the author suggests it may be possible to turn this into something more serious, but no exploit is demonstrated.

What the attacker needed

Ability to post markdown content

How it was found

  1. Write markdown containing a link whose title contains a mention or submission reference.
  2. Render the markdown on the site.
  3. Observe the resulting HTML has unexpected attributes inside the link tag.

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 text written by users, it converts a simple formatting language called markdown into HTML, the code browsers display. Here the site adds links for mentions and issue numbers after that conversion, so the new link code can land inside an existing link's settings and break the page structure. The author suspects this could be abused but has not shown how.

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 danlec

View all

6 more disclosed reports, best first.

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.