Signs your website has a PHP web shell, and how to clean it up

A web shell is a script an attacker uploads to a website so they can run commands, browse files or send spam through your server from a browser. Most arrive through an outdated plugin, a vulnerable upload form or stolen FTP/admin credentials.
Signs something is wrong
- Your host or Google warns about malware or spam.
- New administrator accounts you didn't create.
- Pages redirect visitors (often only mobile or search-engine visitors) to other sites.
- Outbound spam or unusual CPU from PHP processes.
- PHP files in places that should only hold images, such as
wp-content/uploads.
What the code usually looks like
Attackers hide intent with obfuscation, so look for patterns rather than names:
eval(base64_decode(...)),eval(gzinflate(...))or chained decoders.eval,assert,systemorshell_execfed directly from$_GET,$_POSTor$_COOKIE.- Very long single-line strings of base64 or
\xescapes. auto_prepend_filein.htaccessor.user.inipointing at an innocent-looking file..htaccessrules that redirect only visitors coming from search engines.
Where they hide
Upload folders, cache directories, theme and plugin folders, files named like core files (wp-tmp.php, class-wp-cache.php), and files with image extensions that are executed through an .htaccess handler.
Cleaning up properly
- Contain: take a full backup for evidence, then put the site in maintenance mode or block public access while you work.
- Find everything: scan the whole account, not only the file you noticed. Check recently modified files (
find . -mtime -14 -name '*.php'). - Replace, don't edit: reinstall the CMS core, themes and plugins from official sources rather than trying to clean infected copies.
- Remove persistence: unknown admin users, cron jobs, SSH keys, database options with injected scripts, and modified
.htaccessfiles. - Rotate every credential: CMS admins, database, FTP/SFTP, hosting panel and API keys.
- Fix the way in: update the vulnerable component, remove unused plugins, and stop PHP from running in upload folders.
- Watch for return visits for a few weeks.
How automated scanning helps
A scanner that knows these patterns can check every site on a server continuously, quarantine a malicious file the moment it appears (keeping a copy so a false alarm can be restored), and alert you while the attacker is still getting started.
TurnUpSecurity Shield scans every site's files with built-in web shell and injection signatures (plus ClamAV and YARA when installed), quarantines what it finds, and flags web-server processes that suddenly start shells, downloaders or crypto miners.