Unintended HTML inclusion as a result of https://hackerone.com/reports/110578
The markdown editor's handling of link titles allowed an attacker to inject arbitrary HTML attributes into the generated anchor tag. This could enable cross-site scripting if the injected attributes are interpreted by the browser.
- Triaged in 3 hours
- Fixed in 28 days
- Paid in 28 days
- Disclosed after 28 days
Hi, I was just reading https://hackerone.com/reports/110578 and testing out the changes. I had previously noticed that the editor would take something like:
[test](http://www.torontowebsitedeveloper.com "test ismap="yes"')
and turn it into :
<a title="test ismap="yes"' href="http://www.torontowebsitedeveloper.com">test</a>
In other words, the code would recursively look at what should be the title string and use the first single or double quote, matching it to the last single or double quote, including all others within it as the actual " or ' as was noted in the report (I was actually looking at the git repo to try and see if there was any vulnerability in the recursive flow from an overflow perspective but couldn't find one...).
Anyways, I noticed after the report, with your change, I can get some arbitrary html included in anchor tags now. Admittedly, I'm just starting out with all of this so I don't know yet how/if this could be exploited but now when I add the above
[test](http://www.torontowebsitedeveloper.com "test ismap="alert xss" yyy="test"")
It gets turned into:
<a title="'test" ismap="alert xss" yyy="test" ' href="http://www.torontowebsitedeveloper.com">test</a>
Two things to I would flag:
- the single quote at the beginning of what should be title="test" and
- I was able to add ismap= and yyy= as html attributes
This reminded me of the yahoo mail xss injection recently disclosed so I thought I'd make you aware. If you don't agree it's a vulnerability, please let me close the issue.
Thanks!
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 parser's title handling did not properly escape or validate quotes and attributes after a previous fix, allowing attribute injection.
Impact
An attacker could inject arbitrary HTML attributes into anchor tags, potentially leading to cross-site scripting if the attributes are interpreted by the browser, though the report does not demonstrate actual script execution.
What the attacker needed
Ability to submit markdown content
How it was found
- Enter a markdown link with a crafted title containing extra quotes and attributes.
- Observe the generated HTML anchor tag includes the injected attributes.
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.
A markdown editor converts text like [text](url "title") into HTML links. The researcher found that by crafting the title part, they could add extra attributes to the link tag, such as 'ismap' or 'yyy'. If an attacker can control the title, they might inject malicious attributes that execute scripts, though the report does not confirm exploitability.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.