Check whether your server was attacked through php2shell
Patching doesn't remove a backdoor planted before the fix. How to look for web shells, unknown users and other traces from 17 October onwards.
- You need
- FTP
- Updated
A security patch closes the hole, but it doesn't remove anything an attacker left behind. Amazon saw the first attempt to exploit php2shell on 17 October 2026, four days before PHP shipped the fix. If your server was attacked before PHP was patched, a backdoor may still be sitting there and working. The checks below look for the traces, and they're worth doing even if PHP is now up to date. For updating PHP itself, see how to patch PHP for php2shell.
Save the logs first
The access and error logs show what happened on the server, but many hosting providers delete them after a few days. Download them before you do anything else, including before you deploy or restart the server. On shared hosting you'll find them in the control panel, often under Logs or Statistics. On your own server they're usually in /var/log/apache2/ or /var/log/nginx/.
Access logs don't record what was in each request, so you won't see the attack itself there. What you can see is what came after, such as requests to PHP files that aren't part of your site.
In the error log, look for fatal errors from 17 October onwards, especially "Allowed memory size … exhausted" and "Maximum execution time exceeded". Both attacks use errors like these to interrupt PHP. A clean log doesn't prove the server is safe, though, because PHP can be interrupted before it writes the message.
When Datadog reproduced the attack, the memory error ended in "Unknown on line 0". That means PHP stopped while it was still reading the request, before any of your site's code ran. Failed attempts can also leave "Segmentation fault" lines in Apache's error log.
In the access log, Wiz points to repeated HTTP 500 responses after POST requests carrying file uploads. If your firewall stores request bodies, Amazon suggests searching for POST requests containing PHP_SESSION_UPLOAD_PROGRESS.
Look for PHP files that don't belong
A web shell is usually a small PHP file that accepts commands. Attackers tend to put it somewhere it won't draw attention.
- Open
wp-content/uploads. It should only hold images and documents, and a.phpfile in there is almost always malicious. - Sort the files in the root folder and in
wp-contentby date modified, and look for anything changed after 17 October. Watch for names that mimic WordPress files, such aswp-confg.php. - Open
.htaccessand.user.iniin the root folder. A line withauto_prepend_fileorauto_append_filemakes PHP run a given file on every request, which is a common hiding place for a backdoor. - Check
wp-content/mu-plugins. Plugins in there load automatically and don't appear in the normal plugin list.
File modification dates can be faked, so an old date doesn't make a file safe. A PHP file in the uploads folder is always suspicious, whatever its date.
Look for new users, scheduled tasks and keys
- Admin users: Under Users in WordPress, look for admins you don't recognise.
- Scheduled tasks: On shared hosting, cron jobs are listed in the control panel. On your own server,
crontab -l -u www-dataand the files in/etc/cron.d/show what runs. - SSH keys: Look for new lines in
authorized_keysfor the user PHP runs as, often/var/www/.ssh/authorized_keys, and for root. - Processes and binaries: Arctic Wolf has seen attacks that use
wgetto pull known malware onto the server. On your own server,ps -ef --forestshows whethersh,bash,wgetorcurlis running underapache2orphp-fpm. Check/tmp,/var/tmpand/dev/shmfor executables as well. - Resource use: A server that suddenly burns CPU or sends a lot of outbound traffic may be mining cryptocurrency or attacking others.
Rotate passwords and keys even if you find nothing
The attack can also read PHP's memory without running any code. That leaves no files or users to find, but the attacker may have walked away with passwords and keys. If the server ran a vulnerable PHP version after 17 October, change the database password, your API keys and the security keys in wp-config.php, whatever the checks above turn up. New security keys log out everyone who's signed in.
If you find signs of a compromise
If the attacker planted a web shell, they've been able to run commands with the same permissions as PHP. Deleting the file isn't enough.
- Copy the files, database and logs as they are now.
- Change every password and key stored on the server: the database password in
wp-config.php, the security keys (salts), API keys for payments, email and other services, and the passwords for the control panel, FTP and SSH. - Restore a backup from before 17 October, or clean the site properly by reinstalling WordPress, your plugins and theme from clean copies.
- On your own server, the safest route is a new server running patched PHP, with the site moved across. The attacker may have changed things outside the website.
- If the site stores personal data, the intrusion may be a breach you have to report to your data protection authority, which in Norway is Datatilsynet. The deadline under GDPR is 72 hours after you became aware of it.
For other symptoms, such as spam in Google and redirects, see signs that a WordPress site has been hacked.