Most firewalls are configured to block incoming connections but are often more lenient with outgoing traffic.
You flip the script. Instead of the attacker waiting for a connection, you make the server reach out to you . That's the essence of a reverse shell.
Some Egress (outbound) firewalls block all traffic except for ports 80 and 443. In this case, try setting your listener to port 443.
fclose($sock); ?>
The technician sets up a listener on their own machine (often using a tool like ) to wait for a connection on a specific port. The Payload: