Course contentsShow
← Security
Lesson 969 of 3,05220. Web Security - File Upload and ProcessingFree lesson

Symbolic Link Attacks

Explore symlink exploitation in uploads to read arbitrary files or create unintended file references.

Symbolic Link Attacks

What you'll learn: You'll discover how attackers exploit symbolic links (symlinks) during file uploads to read arbitrary files or hijack server resources.


What Is a Symbolic Link Attack?

A symbolic link is a special file that acts as a pointer or shortcut to another file or directory. Think of it like a bookmark that redirects you to a different location. In file upload contexts, attackers create or upload malicious symlinks that point to sensitive files (like /etc/passwd or database configuration files), tricking the server into exposing content it shouldn't.

When an application processes an uploaded archive (like a ZIP file) containing symlinks, or allows symlink creation directly, an attacker can:

  1. Read arbitrary files — Upload a symlink pointing to /etc/shadow, then request the uploaded "file" through the web interface to read protected system files.
  2. Create unintended references — Point to internal application files, configuration data, or even other users' uploaded content.

How It Works

Imagine you upload a ZIP file containing:

malicious.txt -> /etc/passwd

When the server extracts this archive without validating symlink targets, malicious.txt becomes a live link to the password file. If the application later serves uploaded files via HTTP, requesting malicious.txt might expose /etc/passwd contents.

This attack often combines with ZIP Slip vulnerabilities (which you've learned about), where extraction happens outside safe directories, making symlink exploitation even more dangerous.

Prevention

  • Never blindly extract archives — Validate and sanitize all paths before extraction
  • Detect symlinks during processing — Check if uploaded files are symlinks and reject them
  • Use chroot jails or sandboxing — Limit what files the extraction process can access
  • Serve uploaded files from isolated storage — Prevent direct file system access through URLs

Key Takeaway: Symbolic link attacks turn file uploads into arbitrary file read vulnerabilities by exploiting how servers follow symlink references during extraction or processing — always validate file types and reject symlinks in uploads.