Arbitrary File Read Via Symbolic Links
The ZIP upload service extracted archives without checking for symbolic links, allowing an attacker to include a symlink pointing to a sensitive file on the server. The attacker could then download that file through the separate file-serving service.
Hey, I am W1C3, and today I will explain how you can read files via Symbolic Links. This challenge was developed for the Nullcon CTF 2023.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the ZIP extraction process did not reject symbolic links, allowing them to be extracted and later served.
Impact
An attacker could read arbitrary files on the server, including sensitive files like the flag.
What the attacker needed
Ability to upload a ZIP file; Knowledge of the target file path
The fix
The ZIP extraction should be configured to reject or skip symbolic links, or the extracted files should be validated to ensure they are regular files.
How it was found
- Create a symbolic link pointing to the target file.
- Create a ZIP archive containing the symbolic link.
- Upload the ZIP file to the service.
- Receive a URL where the extracted files are accessible.
- Download the symbolic link file to read the target file's contents.
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 write-up has not been written yet. The Original tab links to the source.
A symbolic link is like a shortcut that points to another file. The upload service unzipped files without checking if any were shortcuts, so an attacker could make a shortcut to a secret file and then download it.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.