Escape Function To Perform Remote Code Execution In Php Compiler
A PHP compiler service blocked dangerous functions by name, but the author bypassed the blacklist by building the function name from concatenated strings and calling it dynamically. This allowed arbitrary command execution on the server, including listing files and uploading a file.
Published on infosecwriteups.com
So the Host is provide php compiler for users can execute php code from the server , but once i put code with contains a dangerous / malicious function to execute the server such as shellexec , exec system etc. it's blank alias nothing so i escape the character the function to gain RCE .
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 service relied on a name-based blacklist of dangerous PHP functions instead of disabling them in configuration or sandboxing execution.
Impact
An attacker could run system commands on the server and modify, delete or add files.
What the attacker needed
Access to the PHP compiler page; none
The fix
Dangerous functions should be disabled in PHP configuration and code should run in an isolated virtual server rather than on the host.
How it was found
- Submit code calling a dangerous function such as exec and observe blank output.
- Build the function name from concatenated strings in a variable.
- Call the variable as a function to run a command such as ls.
- Run pwd to reveal the server directory path.
- Upload a text file to the server as proof of write access.
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 site let people type PHP code and ran it on its own server. It tried to block dangerous commands by checking for their names, but the author split the name into pieces so the check missed it. The server then ran the command, letting the author read and write files on the machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.