Skip to content
Info disclosure Disclosed report Beginner

Arbitrary file injection via symlink attack in rdoc generator

The rdoc documentation generator follows symbolic links placed in the source directory, so a link pointing at a sensitive file causes that file's contents to be copied into the generated HTML and search index. An attacker who can place such a link could read files they otherwise lack permission to access, ranging from credentials to system configuration.

sighook Follow

Originally disclosed on HackerOne

Informational View original
  • Disclosed after 21 months

There is a vulnerability that can allow an attacker to spoof the symbolic link and traverse the file system to unintended locations or access arbitrary files. The symbolic link can permit an attacker to read a file that they originally did not have permissions to access and to inject its content to the placed-on-the-web documentation.

PoC

Shell
$ mkdir test
$ cd test
$ ln -s /etc/passwd test
$ rdoc

See doc/test.html and doc/js/search_index.js, they contain the data of /etc/passwd.

The spoofed link can refer to files in ~/.ssh, ~/.gnupg, /etc, /proc/, /sys, thus, the nature of the disclosed data varies from secrets/credentials to system configurations, hardware info, firewall rules, and so on.

Impact

An attacker could gain access to sensitive data or system resources. This could allow access to protected files or directories including configuration files and files containing sensitive information.

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 generator resolves and reads files through symbolic links without checking that the link target stays inside the project directory.

Impact

An attacker could read protected files such as credentials and configuration, and the leaked content ends up in the published documentation.

What the attacker needed

Ability to place a symlink in the source tree; rdoc run over that directory; generated docs are published

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 symbolic link is a shortcut file that points at another file elsewhere on the disk. When rdoc builds documentation it reads files in the project folder, and it also followed these shortcuts, so a shortcut aimed at a private system file made rdoc copy that file into the published docs. Anyone who could add such a shortcut to a project could then read files they were not allowed to see.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.