False positives for closed plugins

What SecuPress reports

The Detect Bad Plugins module queries the official wordpress.org directory. When a plugin is marked closed there, a red notice appears under its row on the Plugins screen.

That notice is right in most cases. Two situations make it a false positive:

  • the plugin is reported as closed when it is not, or when it should not be treated as closed on this site;
  • the plugin left the free directory, became premium, and kept the same identifier (the slug). Its version number went up. wordpress.org still answers “closed” for that identifier.

The second case is the common one. The directory closes the free release. The premium release installed in its place uses the same folder and a higher version. SecuPress still sees the closed listing.

The filter

Since 2.7.4, the secupress.background.bad_plugins.pre filter ignores a plugin. It receives the exception list and the plugin file currently being checked. Return the list.

The accepted identifier is the plugin file (my-plugin/my-plugin.php) or the folder (my-plugin).

  • Name only. The plugin is always ignored, whatever its version.
  • Name and version. The plugin is ignored only when the installed version is strictly higher than the one given. The filter version is the last closed release, not the one that is installed. Equal versions keep the notice.

The version may be a string, or a plugin-info array with a Version key.

This filter does not hide a vulnerability. Only the “closed” and “no longer updated” notices are affected.

Examples

Ignore one plugin in every case, and treat order-delivery-date as a premium false positive. On wordpress.org that plugin has been closed since 23 January 2024 (author request). The installed copy at version 1.3 keeps the same slug. The filter gives 1.2, the last closed version: 1.3 is above it, so the notice goes away.

add_filter( 'secupress.background.bad_plugins.pre', function( $plugins ) {
$plugins[] = 'ignored-plugin/ignored-plugin.php';
$plugins['order-delivery-date'] = '1.2';
return $plugins;
} );

The same exception with plugin info:

add_filter( 'secupress.background.bad_plugins.pre', function( $plugins ) {
$plugins['order-delivery-date'] = [
'Version' => '1.2',
];
return $plugins;
} );

If the plugin header still says Version: 1.2, the comparison fails. Either raise the installed version above 1.2, or put a lower number in the filter, for example 1.1.

When the notice disappears

The filter is read again when the Plugins screen is rendered. After the code is saved, refreshing that screen removes the notice, without waiting for cron.

The background check also removes the plugin from the stored “closed” and “old” lists the next time the queue runs. Activating a plugin puts that plugin on the queue immediately.

The module has to be active. While it is off, the filter is not loaded and this notice is not produced.