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.
- Disclosed after 23 months
When creating an RDoc html documentation, there is a possibility to inject malicious code through file name.
PoC
~ $ 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:
...
<li><a href="./"><object src=1 onerror="javascript:alert(1);">Controlling what is documented here.html">"><object src=1 onerror="javascript:alert(1);">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

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.