Skip to content
File upload Write-up Beginner

Ehxb File Upload Vulnerabilities I

The application allowed uploading PHP files that the server executed, and in later scenarios the server only checked the client-supplied Content-Type header or used a bypassable path traversal filter. An attacker could upload a web shell and run arbitrary commands on the server, including reading sensitive files.

ehxb Follow

Published on infosecwriteups.com

When a Simple Avatar Upload Became a Server Takeover: File Upload Vulnerabilities Explained

Ehxb, on infosecwriteups.com

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

The server failed to validate uploaded files properly, relying on client-controlled headers or flawed filters instead of checking file contents and enforcing safe storage.

Impact

An attacker could execute arbitrary commands on the server, read sensitive files, and potentially take full control of the server.

What the attacker needed

A user account; ability to upload files

The fix

The application should validate file contents, not just client-supplied headers, and store uploads outside the web root or in a non-executable directory.

How it was found

  1. Log in and go to the avatar upload form.
  2. Create a PHP file that executes a command from a URL parameter.
  3. Upload the PHP file; the server accepts it.
  4. Find the uploaded file's URL from the page source or network tab.
  5. Access the file with a command parameter to execute commands and read a secret file.

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 file upload feature lets users send files to a website. If the site does not check files properly, someone can upload a script that the server runs, giving them control. This is like letting a stranger put a program on your computer and then running it.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

More by ehxb

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.