Skip to content
RCE Write-up Intermediate

Apache + PHP deployment pattern turns into instant RCE

A web-accessible directory on an Apache+PHP server accepted unauthenticated file uploads and executed uploaded PHP files, allowing an attacker to run arbitrary code. The attacker could then obtain a remote shell as the web server user and enumerate the system.

24bkdoor Follow

Published on medium.com

Not everything we find is CVE worthy. This does not mean we have not found real issues which need to be addressed.

24BkDoor, on medium.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

Likely a combination of Apache accepting upload requests (e.g. via mod_dav or a custom directive), the upload directory being web-accessible, PHP execution enabled in that directory, and no validation or authentication on uploads.

Impact

An unauthenticated attacker could achieve remote code execution as the web server user, leading to full system compromise including access to sensitive files and discovery of other services.

What the attacker needed

Web-accessible upload directory; PHP execution enabled in that directory; no authentication or validation on uploads

The fix

The configuration should be fixed by disabling PHP execution in upload directories (e.g. with php_admin_flag engine off), adding authentication and file validation, and avoiding unnecessary upload capabilities.

How it was found

  1. The attacker sent unauthenticated HTTP requests to a web-accessible directory that accepted uploads.
  2. The attacker uploaded a PHP file containing their code.
  3. The server executed the uploaded PHP file immediately.
  4. The attacker obtained a remote shell as the web server user and enumerated the system.

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.

The server let anyone upload files to a folder that was reachable from the internet, and it ran any PHP file placed there as code. PHP is a programming language often used for websites; running an uploaded file means the attacker's code runs on the server. This gave the attacker control of the server without needing a password.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by 24bkdoor

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.