Skip to content
File upload Write-up Intermediate

The Hacker Left Comments in the Malware… So I Reverse Engineere

A PHP web shell disguised as a GIF was uploaded to a WordPress server, allowing remote command execution and full server compromise. The attacker could execute commands, manage files, and create admin users.

Shrivarshan Follow

Published on shrivarshan81.medium.com

How I found, sandboxed, and dismantled a PHP backdoor — with bonus Indonesian humor from the attacker.

Shrivarshan, on shrivarshan81.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 the upload validation only checked the file header (GIF89a) and did not properly verify or sanitise the file content, allowing PHP code to be executed.

Impact

The attacker could execute commands remotely, upload/delete/edit files, change permissions, modify timestamps, extract WordPress credentials, and create admin users, leading to full server compromise.

What the attacker needed

WordPress site with file upload; Ability to upload files

The fix

The malicious files were removed, credentials revoked, users audited, XML-RPC disabled, everything updated, and a WAF implemented.

How it was found

  1. Observed unusual log entries including requests to /xmlrpc.php and plugin scans.
  2. Found a file that appeared to be a GIF but contained PHP code.
  3. Moved the file to a sandbox VM with controlled internet access.
  4. Opened the code and identified multiple command execution functions.
  5. Noted the malware had reverse shell and backconnect capabilities.

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 web shell is a malicious script that gives an attacker remote control over a website. Here, the attacker hid a PHP script inside a fake image file to bypass upload checks, then used it to run commands on the server.

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 Shrivarshan

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.