Skip to content
XSS Disclosed report Beginner CVE-2013-0256

XSS exploit of RDoc documentation generated by rdoc

RDoc did not escape file names when generating HTML documentation, so a file with a crafted name containing HTML and JavaScript was written unescaped into the generated index page. An attacker who can add such a file to a project could run script in the browser of anyone viewing the generated documentation.

sighook Follow

Originally disclosed on HackerOne

  • Disclosed after 23 months

When creating an RDoc html documentation, there is a possibility to inject malicious code through file name.

PoC

Bash
~ $ touch \"\>\<object\ src\=1\ onerror\=\"javascript\:alert\(1\)\;\"\>Controlling\ what\ is\ documented\ here
~ $ ls
"><object src=1 onerror="javascript:alert(1);">Controlling what is documented here
~ $ rdoc --all

Now, the generated index file has injected javascript code:

HTML
...
<li><a href="./"><object src=1 onerror="javascript:alert(1);">Controlling what is documented here.html">&quot;&gt;&lt;object src=1 onerror=&quot;javascript:alert(1);&quot;&gt;Controlling what is documented here</a>
...

I set to the vulnerability the same severity as CVE-2013-0256 has, since rdoc is widely used on dev/production systems online documentation, etc. An attacker can hide a bad-named-file deep in the project structure to be stealthy. Also, the file can be very tricky-named in documentation list, can contain the real documentation code, and so as not to arouse suspicion for some time.

Impact

The injected code can exfiltrate data or install malware on the (user|developer)’s machine, etc.

Attachments

21-08-21-15_32_35.png
21-08-21-15_32_35.png From the original on HackerOne

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 HTML generator inserted file names into the index page without HTML-encoding them.

Impact

The injected code could exfiltrate data or install malware on the machine of a user or developer viewing the documentation.

What the attacker needed

Attacker can add a file to the project; victim views generated docs

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 is a tool that turns source code comments into a browsable website. It took the name of a file and put it straight into the web page without cleaning it, so a file named with HTML tags and a script handler became live code in the page. Anyone opening that documentation page would run the attacker's script in their browser.

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.