Skip to content

Verification checks skipped when plugin missing main PHP file #121

Closed

Description

@austinginder

Recently ran into a situation where a website had malware reinfection issues which required a bit of a deep dive to resolve. During the process I discovered that wp plugin verify-checksums --all will only check plugins which have their main plugin.php file. For example, let's install a plugin then break the main file by renaming:

wp plugin install wordfence
mv wp-content/plugins/wordfence/wordfence.php wp-content/plugins/wordfence/wordfence.php.bad

Now if we try and run wp plugin verify-checksums wordfence we'll get the following:

Warning: The 'wordfence' plugin could not be found.
Error: You need to specify either one or more plugin slugs to check or use the --all flag to check all plugins.

Also if we run wp plugin verify-checksums --all it will say success and not even attempt to run any checks on the /wordfence/ directory. This is a problem as bad actors can use this method to hide files in these shadow plugin folders. Also there is no indication that these PHP files exist from /wp-admin/plugins.php.

I think the solution should be to run checksums verifications based solely on the directory names. If a plugin directory matches a wordpress.org plugin then maybe run the verification checks?

Activity

  1. danielbachhuber commented on Jan 22, 2024

    @danielbachhuber
    Member

    Interesting report!

    I agree, this is worth putting together an enhancement for.

  2. swissspidy commented on May 27, 2026

    @swissspidy
    Member

    #143 is an attempt at this. The checksum verification requires a plugin version though, and if the main PHP file is missing, there's usually no version information. One workaround is to fetch the latest version from dotorg and use that (assuming you have the latest version installed), but that's fragile. Of course one could provide --version manually.

    Worth keeping in mind that if a main plugin file is missing or renamed, the plugin won't be active anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions