P-ivo File Integrity Monitor

By pluginivo

0+ active installationsVersion 1.0.1

Monitors core, plugin, and theme files and sends an email alert when something changes without going through a WP admin update.

Description

P-ivo File Integrity Monitor monitors the integrity of WordPress core, plugin, theme, mu-plugin, and wp-content drop-in (advanced-cache.php, object-cache.php, db.php…) files, and sends an email alert after the next scan detects that one of them has been changed, added, or deleted WITHOUT the change going through an official WP update mechanism. This is often the earliest sign that a site has been compromised (malware injection, backdoor, defacement).

It reports file changes. It does not scan file contents for malware signatures, and it does not clean or repair anything.

How it works

  • On activation, the plugin builds a “baseline” — a SHA-256 hash of every tracked file, stored in its own database tables (not wp_options, because of the large number of files).
  • A recurring scan compares the current state of files against the baseline and reports differences as events: added, modified, deleted. You choose how often it runs in Settings > Scan interval: every 15 minutes, every 30 minutes, hourly, twice daily, or once daily. The default is once a day at 03:00 (site time). You can also start a scan yourself at any time with “Scan now” — there is no limit on how often.
  • Scanning runs in batches (configurable, 500 files per pass by default) so it doesn’t time out even on sites with lots of files. “Scan now” runs the batches back to back until the whole pass is finished, with a progress indicator while it works. The automatic scan does the same in the background: a large site is scanned in several consecutive steps, which depends on WP-Cron.
  • When you update a plugin, theme, or WordPress core through WP admin (or WP-CLI, including automatic background updates), the plugin recognizes this and automatically refreshes the baseline for those files — you won’t get false alerts for legitimate updates. This covers plugins that live in their own folder; single-file plugins (such as hello.php) are not covered by the update tracker and will show up as changes after an update.
  • Every other change is listed as New. Once an alert email has been sent for it, its status becomes Notified (it still needs your review). You then review it in the dashboard: “Accept as correct” updates the baseline (status becomes Accepted), while “Mark as reviewed” (status becomes Acknowledged) leaves the baseline unchanged — the file stays listed under Acknowledged and no new alert is sent for it unless its contents change again. Apart from the initial baseline build and an explicit “Accept as correct”, the baseline is NEVER changed except through a recognized WP update — this is a deliberate security choice, not an oversight.
  • Email alerts are sent after a scan finds changes, in batches (all unresolved changes in a single email, which lists up to 200 of them in detail and gives the number of the rest), with a cooldown period (configurable in minutes, 15 by default) so you’re not flooded with dozens of emails if a lot of files change at once. The default recipient is the site admin email set at activation; add as many recipients as you like, one per line. Leave the Email recipients field empty to turn email notifications off completely; changes are then only visible in the dashboard and stay New.
  • Excluded paths: enter as many patterns as you need (one per line) to skip files or folders; a few common ones are filled in by default.

The dashboard

  • “Trusted Files” shows how many files are currently confirmed as normal — from the initial setup, or after you reviewed and accepted them. Newly detected files stay separate until you review them.
  • One tab per status — New, Notified, Acknowledged, Accepted — plus All, each with a count.
  • Search by file path, and bulk actions on ticked rows: “Mark as reviewed”, “Accept as correct”, and “Delete accepted events”. When a search is active on the New or Notified tab, “Select all N items matching this search” applies the action to every match across all pages. “Delete accepted events” only ever removes events whose status is Accepted, and asks for confirmation first.
  • “Next scan” shows when the next automatic scan will run. “Scan now” has two visible states. Ready: the button is enabled and can be used at any time. Scan running: the button is disabled and a progress bar shows “Scanning n / total files…” (the same page shows “A scan is currently running…” if the scan was started from another browser tab or by the automatic schedule), and your browser asks for confirmation if you try to leave the page.
  • While changes are waiting for review, administrators see one notice on the WordPress Dashboard and Plugins screens. It can be dismissed; the dismissal is remembered for your user only, and the notice comes back only when a newer change is detected.

External services

P-ivo File Integrity Monitor does not connect to any external service, load remote assets, or send data outside your site. Email alerts are sent through your site’s own mail configuration (wp_mail).

Credits

The admin screens use the IBM Plex fonts (Plex Sans, Plex Serif and Plex Mono), Copyright © 2017 IBM Corp. with Reserved Font Name “Plex”, bundled with the plugin (nothing is loaded from a remote server) and licensed under the SIL Open Font License, Version 1.1. The license text is included in the plugin at admin/assets/fonts/OFL.txt.

A separate version

A separate version, distributed outside WordPress.org, adds an independent check of core files.

Installation

  1. Upload the p-ivo-file-integrity-monitor folder to /wp-content/plugins/ (or install through Plugins > Add New > Upload Plugin if you have a .zip).
  2. Activate the plugin through the Plugins menu in the WordPress admin.
  3. The initial baseline is built in the background, batch by batch via WP-Cron, and doesn’t block activation. How long it takes depends on the number of files on your site and on how often WP-Cron runs (on low-traffic sites it only runs when someone visits): from under a minute on small sites to considerably longer on large ones.
  4. Open File Integrity > Settings and configure the scan interval, email recipients, excluded paths, and other options as needed.
  5. Watch the File Integrity > Log page, or wait for an email alert if something changes.

Recommendation for production sites

WP-Cron by default only runs when someone visits the site (pseudo-cron), which can cause delays on low-traffic sites — the scan interval you choose is a minimum, not an exact schedule. For more reliable, precisely scheduled scanning, especially with the short 15 and 30 minute intervals, it’s recommended to disable WP-Cron (define('DISABLE_WP_CRON', true); in wp-config.php) and schedule a real system cron job that calls wp-cron.php at regular intervals.

FAQ

How often does it scan?

As often as you choose in Settings > Scan interval: every 15 minutes, every 30 minutes, hourly, twice daily, or once daily. The default is once a day at 03:00 (site time). Automatic scans run through WP-Cron (see the recommendation above). You can also start a scan yourself at any time with “Scan now”; there is no limit on how often.

What happens if I close the page in the middle of “Scan now”?

A manual scan is driven by the open dashboard page, one batch at a time. If you close or leave the page before it finishes, the scan stops where it was; nothing is lost. For about a minute and a half afterwards “Scan now” stays disabled while the plugin waits to see whether a scan is still running. After that you can click “Scan now” again to continue from where it stopped, or let the next automatic scan continue it. Your browser asks for confirmation before leaving a page while a scan is running. For the quickest result, keep the page open until the scan finishes and the page reloads (“Scan complete.”).

Will the plugin notify me for every legitimate change I make through WP admin?

No. Updates to plugins, themes, and core made through WP admin (or WP-CLI, or automatic background updates) are recognized via WordPress’s own upgrader hook, and the baseline is automatically refreshed for those files. You’ll only get an alert for changes that did NOT go through that mechanism. The exception is single-file plugins (a lone .php file directly in the plugins folder, such as hello.php), which the update tracker doesn’t cover; an update to one of those will show up as a change.

Why don’t I get an email right away when something changes?

Alerts are sent after a scan detects the change, so an alert can arrive up to one scan interval after the change (with the default of one scan a day, up to a day; start “Scan now” to check sooner). On top of that there is the cooldown period (configurable in settings, in minutes, 15 by default) that prevents dozens of changes at once from triggering dozens of separate emails. All unresolved changes from that period are sent in a single batched email. Setting the cooldown below your scan interval means you may get an email after every scan; setting it above groups changes from multiple scans into fewer emails, at the cost of a delayed alert.

Can I notify multiple people by email?

Yes. Add as many recipients as you like in Settings > Email recipients, one address per line.

Can I turn email notifications off?

Yes. Leave the Email recipients field empty and save. No emails are sent; changes appear only in the dashboard (File Integrity > Log) and stay in the New status.

What do the statuses mean?

New: detected and not yet reviewed. Notified: an alert email has been sent, still not reviewed. Acknowledged: you chose “Mark as reviewed” — the file remains different from the baseline and stays listed here, but no new alert is sent unless its contents change again. Accepted: you chose “Accept as correct” — the baseline now matches the file. Accepted events can later be removed with “Delete accepted events”.

Why do I see a notice on the Dashboard?

It appears on the WordPress Dashboard and Plugins screens, for administrators, while changes are waiting for review. Click the X to dismiss it; that is remembered for your user only, and the notice returns only when a newer change is detected.

What happens if I deactivate the plugin?

Cron scheduling is removed, but all tables and data (baseline, change history, settings) remain intact. Reactivating picks up right where it left off.

What happens if I delete the plugin?

By default, nothing is deleted from the database — your data stays even after the plugin is deleted, in case you change your mind. If you want a full cleanup, enable the “Data deletion” option in settings BEFORE deleting the plugin.

Which files does the plugin monitor?

WordPress core (root .php files, wp-admin/, wp-includes/), all installed plugins, mu-plugins, themes, and wp-content top-level drop-in files (advanced-cache.php, object-cache.php, db.php, sunrise.php, and similar). Uploads and cache directories are not monitored (they aren’t executable code). If your site keeps its plugins, mu-plugins or themes outside the default locations (WP_PLUGIN_DIR, WPMU_PLUGIN_DIR, a custom theme root), those locations are monitored too.

Can I exclude certain files or folders from monitoring?

Yes, in settings you can enter patterns (one per line) — if a file’s path contains any of those strings, the file is skipped. There is no limit on the number of patterns; a few common ones are filled in by default.

Does it work on sites with lots of files (large number of plugins/themes)?

Yes. Scanning runs in batches (configurable number of files per pass, 500 by default) instead of trying to do everything at once.

Are there files the plugin does not monitor?

Yes. Files and folders that the web server user cannot read are skipped, and so are symbolic links that PHP is not allowed to follow (see the open_basedir setting). A folder that is a symbolic link is not entered, so the files inside a plugin or theme folder that is itself a link are not monitored. File names that contain a backslash, and paths longer than 500 characters, are not monitored. Two files whose names differ only in capitalization, accents, a trailing space, or after the 191st character of the path can be mistaken for each other: accepting one of them may leave the other listed as changed.

Does it connect to any external service?

No. P-ivo File Integrity Monitor does not connect to any external service, load remote assets, or send data outside your site. Email alerts are sent through your site’s own mail configuration (wp_mail).

Screenshots

Changelog

1.0.1

  • Fixed: a folder the web server cannot read no longer stops every scan; it is skipped, and its files are not reported as deleted or removed from the baseline.
  • Fixed: symbolic links that open_basedir does not allow (dangling, looping or pointing outside the allowed paths) no longer stop the scan.
  • Fixed: a scan that ends abnormally no longer blocks the next one for five minutes.
  • Fixed: files the server cannot read no longer raise PHP warnings.
  • Fixed: “1 suspicious file changes” in the alert email subject (and “… and 1 more changes”) now use the singular.
  • Fixed: a scan started with “Scan now” and abandoned by closing the page now continues by itself instead of waiting for the next automatic scan.
  • Added: a FAQ entry describing what the scan does not see.

1.0.0

  • Initial release.
  • Monitoring of core, plugin, theme, mu-plugin, and wp-content drop-in files via a SHA-256 baseline.
  • Batch scanning (on-demand “Scan now” with no limit, and automatic scans) with detection of added/modified/deleted files.
  • Configurable scan interval: every 15 minutes, every 30 minutes, hourly, twice daily, or once daily (the default, at 03:00 site time).
  • Automatic recognition of legitimate WP admin / WP-CLI / auto-update changes via the upgrader_process_complete hook, which refreshes the baseline for the updated files (single-file plugins are not covered).
  • Four-state review workflow (New, Notified, Acknowledged, Accepted): apart from the initial baseline build and an explicit “Accept as correct”, the baseline changes only through a recognized WP update.
  • Batched email alerts with a configurable cooldown (in minutes) to group multiple detections into fewer emails; any number of recipients, and an empty recipient list turns email notifications off. Any number of excluded paths.
  • Admin dashboard with a “Trusted Files” counter, a filterable full-width change log (status counts per tab), search by file path, bulk actions (Mark as reviewed, Accept as correct, Delete accepted events) with “Select all N items matching this search”, a “Next scan” indicator, and a settings page grouped into Scan Schedule, Notifications, and Exclusions & Data.
  • “Scan now” is disabled while a scan is running, and the browser asks for confirmation before leaving the page during a running scan.
  • A dismissible notice on the Dashboard and Plugins screens while changes await review; dismissal is remembered per user until a newer change is detected.
  • Custom “Notarized Ledger” visual design with self-hosted IBM Plex fonts (SIL Open Font License 1.1, text included).
  • Optional full data deletion on uninstall (opt-in, off by default).