Skip to content
XSS Disclosed report Intermediate

Stored XSS in RDoc hyperlinks through javascript scheme

The XSS filtering added to RDoc to fix an earlier report could be bypassed, so a crafted hyperlink using the javascript scheme survived into the generated HTML. An attacker who gets such a link into documentation could have script run when a reader clicks it.

sighook Follow

Originally disclosed on HackerOne

Medium 5.4 View original
  • Disclosed after 2 months

Hello,

I found that it is possible to bypass the XSS filtering made in a series of patches to solve #1187156 report. The #1187156 wasn't sent by me, I found the 'hyperlinks' fixes from investigating the git log.

PoC

Create the file with the following link:

x[javascript:alert(1)]

The output html file will contain:

HTML
<a href="javascript:alert(1)">x</a>

Impact

A cross-site scripting (XSS) vulnerability allows attackers to execute arbitrary web scripts or HTML via a crafted payload.

The original report as published on HackerOne, by sighook. 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 sanitiser only blocked some forms of the javascript scheme, so a link written in RDoc's own link syntax still produced a javascript href in the output.

Impact

Script placed in a generated documentation page could run in a reader's browser when the link is clicked, though the text does not show any case beyond an alert.

What the attacker needed

Attacker can add a link to docs; victim opens generated HTML; victim clicks the link

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.

RDoc turns documentation text into web pages. It is meant to strip dangerous links, but a specially written link slipped through and ended up in the page as a clickable link that runs code. If a reader clicks it, that code runs in their browser as if the site itself had sent 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 by sighook

View all

10 more disclosed reports, best first.

More from Ruby

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.