Remove malicious code with WordPress CLI verify checksums

WP CLI comes with a verify-checksums sub-command that you can run with core and plugin commands.

This makes it easier to check the integrity of core and plugin files.

output of wp core verify-checksums command on WP CLI
output of wp core verify-checksums command on WP CLI

Recently I repaired a hacked website with the help of this command. I got the list of malicious files that are not part of WordPress and should be removed.

The above screenshot is a simple demonstration of the core verify-checksums command.

If you get the following message, Error: WordPress installation doesn't verify against checksums then the core files need to be reinstalled again.

use this command wp core download --force This is a quicker way to clean malicious files than deleting them one by one.

You can also verify checksums in plugins. Note that this check is applicable to the plugins that are hosted in the official WordPress repository.

If you notice any plugin got checksums mismatch, then reinstall or download the plugin again.

Further reading:
wp core verify-checksums
wp plugin verify-checksums
Our Guide to WP-CLI Command Structure

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *