RCE starwars
An abandoned web service on a non-standard port allowed unauthenticated PUT requests, enabling the upload of a PHP web shell and remote code execution. The attacker then used the shell to explore the internal network, find credentials in /etc/passwd, and compromise other hosts.
Continuing the non-ltr101 posts for a second here is a quick write-up of a cool bug I found recently on a bounty program. It features Remote Code Execution via an abandoned web service.
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 web server was misconfigured to allow unauthenticated PUT requests to a writable directory, and the uploaded files were executed as PHP.
Impact
The attacker gained remote code execution, accessed sensitive internal files including VPN keys and a DNS zone transfer, and compromised other internal hosts using discovered credentials.
What the attacker needed
Unauthenticated PUT method enabled; Writable directory in webroot; PHP execution enabled
The fix
The company have since patched this issue.
How it was found
- Send an OPTIONS request to the server on port 64351 to discover allowed HTTP methods.
- Use the PUT method to write a PHP web shell to a folder in the webroot called test.
- Access the uploaded shell and execute system commands via the cmd parameter.
- Use ncat to establish a reverse shell to the attacker's listener on port 443.
- Upgrade the shell to an interactive bash shell using a Python one-liner.
- Explore the file system, find sensitive files, and use discovered credentials to access other hosts.
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 accepted a less common HTTP method called PUT, which is normally used to upload files. Because it was left open without authentication, the attacker could upload a script that runs commands on the server. This gave them control of the machine and access to the internal network.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.