Skip to content
Path traversal Write-up Intermediate

How Hackers Hack Into Websites On Shared Hosts - Part 2

The article describes how a symlink bypass on a shared host can let an attacker access directories outside their permitted area, including the root home directory, and then locate and read a site's configuration file to obtain database credentials. The author claims this works even if the admin has renamed or moved the configuration file.

Farhan Azam Follow

Published on rafaybaloch.com

The original lives on rafaybaloch.com

We do not hold its text, 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 server allows a hosted user to create a symlink to the filesystem root and then follow it through the web server, so directory permissions that should block access are bypassed.

Impact

An attacker with a hosting account could read other users' configuration files and obtain database access, even if the admin renamed or moved the configuration file.

What the attacker needed

A hosting account on the shared server; ability to upload files and run shell commands; web server follows symlinks

How it was found

  1. Create a directory and upload a script and an .htaccess file into it, then set permissions on the script.
  2. Open the uploaded script in the browser.
  3. Use the script to create a new directory.
  4. Enter the new directory and create a symlink pointing to the filesystem root.
  5. Upload an .htaccess file that enables directory listing and maps a text extension to PHP.
  6. Browse to the symlinked root, open a home directory, and read the configuration file or the password file to get usernames and database access.

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.

On a shared web host, many websites live on the same server and are supposed to be kept apart. A symlink is like a shortcut that points to another file or folder. The article says a flaw lets one user create a shortcut to the server's top-level folder and then browse other people's files, including a configuration file that holds database passwords.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by Farhan Azam

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.