File integrity monitoring
File Integrity Monitoring Tools: What to Look For
Logchase Security Team9 min read
File integrity monitoring (FIM) is a security control that detects changes to critical files, directories and configurations by comparing them against a known-good baseline. FIM tools record what changed, when and by whom, and alert when a change is unexpected, such as an edited SSH configuration or a new script in a web directory.
What is file integrity monitoring?
File integrity monitoring watches selected files and directories and reports when they are created, modified, deleted or renamed, or when their permissions change. It does this by recording a baseline, usually including a cryptographic hash of each file, and comparing the current state against it.
Attackers and malware almost always change files: they drop web shells, add SSH keys, edit startup scripts, install services or replace binaries. Administrators change files too, which is why FIM is as much about context as about detection. A good FIM tool tells you not only that /etc/sudoers changed, but who changed it, through which process and what the difference is, so you can tell a planned change from an intrusion.
Because FIM compares against a baseline, the baseline itself has to be trustworthy. Create it from a known-good state, for example right after a build or a reviewed deployment, and protect it from tampering.
Where FIM is required
PCI DSS v4.0 requirement 11.5.2 calls for a change-detection mechanism, such as file integrity monitoring, that alerts personnel to unauthorized modification of critical files and performs critical file comparisons at least once a week. Requirement 10.3.4 applies the same idea to audit logs, so that existing log data cannot be changed without generating an alert.
Other frameworks are less prescriptive but point the same way. ISO/IEC 27001 includes controls for configuration management, change management and monitoring, and FIM records are a straightforward way to show that changes to critical systems are detected and reviewed.
What capabilities must a FIM tool have?
A FIM tool should detect every type of change on the paths you care about, prove what changed with hashes and diffs, attribute each change to a user and process, and alert with a priority that reflects how critical the file is. Coverage of both Linux and Windows and integration with your SIEM come close behind.
| Capability | Why it matters |
|---|---|
| Create, modify, delete and rename events | Attackers add, replace and remove files; missing one change type leaves a gap |
| Permission and ownership changes | A world-writable script or a new owner can be the change that matters |
| Cryptographic hashing (SHA-256) | Detects content changes even when file size and timestamps are preserved |
| Content diffs for text files | Shows exactly which line of a configuration changed |
| User and process context | Separates an admin's planned change from a compromised web server process |
| Path, pattern and exclusion rules | Focus on critical paths and ignore noisy ones such as caches and temp files |
| Severity-based alerting | A change to /etc/sudoers should not have the same priority as a log file update |
| Change history | Lets you review a file's changes over time during an investigation |
| Central management and reporting | Consistent rules across hosts, and evidence for auditors |
Pay close attention to noise. A FIM tool that alerts on every log rotation or package cache update will be muted within a week. Look for exclusions, ways to acknowledge or suppress expected changes, and a way to tie changes to approved change windows.
Also ask how detection works. Some tools react to file system events as they happen; others scan on a schedule and compare against the baseline. Event-based monitoring gives faster alerts, while scheduled scans also catch changes made while monitoring was not running. Many tools combine the two.
How does FIM work on Linux?
On Linux, FIM tools typically combine kernel file event interfaces such as inotify or fanotify, the Linux audit subsystem for user and process attribution, and periodic hashing to verify file content against the baseline. The tool keeps a stored baseline of hashes, permissions and ownership for every monitored file.
Each mechanism has trade-offs. inotify reports file events efficiently, but it is not recursive, so every subdirectory needs its own watch, and it provides no information about the user or process that caused an event. The newer fanotify interface reports the ID of the process behind each event and can watch whole mounts or file systems, which is why some security tools prefer it. The Linux audit system records the user and process behind a write through watch rules like the ones below, at the cost of more log volume.
# /etc/audit/rules.d/fim.rules (w = write, a = attribute change)
-w /etc/sudoers -p wa -k sudoers_change
-w /etc/ssh/sshd_config -p wa -k sshd_config_changePaths most worth monitoring on Linux servers include:
/etc/passwd,/etc/shadow,/etc/groupand/etc/sudoers(accounts and privileges)./etc/ssh/sshd_configand users'~/.ssh/authorized_keysfiles (T1098.004)./etc/crontab,/etc/cron.d/and systemd unit directories, common persistence locations (T1053.003)./etc/ld.so.preloadand system binary directories such as/usr/binand/usr/sbin.- Web roots such as
/var/www/html/and application configuration under/etcor/opt.
Avoid monitoring high-churn paths such as /var/log, /tmp or package caches for content changes. Either exclude them or watch only specific files inside them, for example to detect log files being deleted or truncated.
How does FIM work on Windows?
On Windows, FIM tools use file system change notifications or a file system filter driver for change events, Windows object access auditing to attribute changes to accounts and processes, and hashing to verify content. Many also monitor the registry, because much Windows persistence lives there rather than in files.
Native Windows auditing can attribute file changes, but only where you configure it. With the Audit File System policy enabled and a system access control list (SACL) on the folder, Windows writes event 4663 ("An attempt was made to access an object") with the account name, process name and access rights used. Sysmon adds file events such as FileCreate (event ID 11) and file deletion (IDs 23 and 26). These are useful inputs for a SIEM, while a dedicated FIM agent adds baselines, hashes and diffs. Sysmon's registry events (IDs 12 to 14) help close the gap that file-only monitoring leaves for registry-based persistence.
Locations worth monitoring on Windows hosts include:
- The
hostsfile inC:\Windows\System32\drivers\etc, a target for name resolution tampering. - Startup folders and the Run registry keys (T1547.001).
- Binaries and DLLs under
C:\Windows\System32andC:\Program Files. - Scheduled task definitions under
C:\Windows\System32\Tasks. - IIS web roots such as
C:\inetpub\wwwrootand application configuration files.
As on Linux, exclude temp folders, browser caches and update staging areas, or limit monitoring there to the creation of executable and script files.
How does FIM help detect web shells and ransomware?
FIM catches web shells by alerting on new or modified script files in web directories, and it flags ransomware by detecting abnormal numbers of modifications, renames and deletions in a short time. In both cases, the file change itself is one of the earliest reliable signals on the host.
Web shells
A web shell is a script placed on a web server that gives an attacker remote access. It has to reach the disk, usually as a .php, .jsp, .aspx or similar file inside the web root, or as code injected into an existing file. Monitoring web roots for new script files, changes to existing ones and writes by the web server's own account (such as www-data or an IIS application pool identity) catches the typical cases. Legitimate deployments should come from a known deployment user or process, which makes the difference easy to see. Web shells can be very small and hidden inside legitimate files, so comparing hashes of existing files matters as much as alerting on new ones.
Ransomware
Ransomware encrypts data to extort payment (T1486), which shows up as a burst of file modifications, renames to unfamiliar extensions and deletions across many directories, often from a single process. Alerting on change rates rather than single events, and watching a few canary files in shared folders, gives early warning. Attackers often delete backups and shadow copies first (T1490), so pair FIM with process and command-line logging.
Why use FIM and SIEM together?
FIM tells you that a file changed; a SIEM tells you what else happened around it. Sending FIM events to the SIEM lets you correlate a configuration change with the login, process and network activity that led to it, and keeps all the evidence in one place.
How a FIM event becomes a SIEM investigation
- 1
Change detected
The FIM agent sees
/etc/ssh/sshd_configmodified on a web server. - 2
Context added
Hashes before and after, the diff, user, process and severity.
- 3
Correlated
The SIEM links it to a VPN login from a new country minutes earlier.
- 4
Alert
One prioritized alert instead of several unrelated events.
- 5
Investigate
The analyst reviews the timeline, then reverts and contains.
Correlation turns ambiguous changes into clear decisions. An edited sshd_config during a change window, made by a known administrator, is routine. The same change made minutes after a run of failed logins and a successful one from an unusual location is an incident. Neither the FIM tool nor the authentication log can tell those apart alone. Read more about correlation in What is SIEM?.
Logchase file integrity monitoring is built this way: Linux and Windows agents report file creation, modification, deletion and renames, permission and ownership changes, SHA-256 hash comparisons, diffs, and user and process context, with path and filename pattern rules and severity-based alerts.
Keep FIM evidence as long as your other security logs. A change is often investigated long after it happened, when an incident is finally discovered; our log retention guide covers how to set retention periods.
Sources
- PCI Security Standards Council: PCI DSS
- MITRE ATT&CK T1505.003: Server Software Component: Web Shell
- MITRE ATT&CK T1486: Data Encrypted for Impact
- MITRE ATT&CK T1490: Inhibit System Recovery
- MITRE ATT&CK T1098.004: Account Manipulation: SSH Authorized Keys
- MITRE ATT&CK T1053.003: Scheduled Task/Job: Cron
- MITRE ATT&CK T1547.001: Registry Run Keys / Startup Folder
- inotify(7), Linux manual page
- auditctl(8), Linux manual page
- Microsoft: Event 4663, An attempt was made to access an object
- Microsoft Sysinternals: Sysmon
Written by
Logchase Security Team
The engineers who build Logchase, working on log management, SIEM, threat detection and file integrity monitoring.
FAQ
Frequently asked questions
What is the difference between FIM and antivirus?
Antivirus and EDR tools look for malicious code and behavior. FIM looks for change: it alerts when monitored files differ from their baseline, whether the change is malicious or not. That lets it catch tampering with no malware involved, such as an edited configuration file.
Which files should FIM monitor?
Start with files that rarely change but matter when they do: account and privilege files, SSH and remote access configuration, startup and scheduled task locations, system binaries, web roots and application configuration. Exclude logs, caches and temp directories.
How often should FIM check files?
Event-based monitoring reports changes as they happen, and scheduled scans add a safety net for changes made while monitoring was off. PCI DSS requires critical file comparisons at least weekly, but for security detection most teams want much faster alerts on critical paths.
Does FIM create a lot of noise?
It can if it monitors the wrong paths. Scope rules to critical files, exclude high-churn directories, set severity by path and match changes against approved change windows to keep alerts manageable. Review the noisiest rules after the first weeks of operation and adjust them.
Is FIM required for PCI DSS?
PCI DSS v4.0 requires a change-detection mechanism, for example file integrity monitoring, for critical files (requirement 11.5.2) and for audit logs (requirement 10.3.4). Confirm the exact scope for your environment with your assessor and the current version of the standard.
Can FIM work without a SIEM?
Yes, most FIM tools can alert on their own. Sending FIM events to a SIEM adds correlation with login, process and network activity, longer retention and a single place to investigate.
Related articles
SIEM
What Is SIEM? How It Works and How to Choose One
What is SIEM? How security information and event management works, how it differs from log management, common use cases and how to choose one.
SIEM
SIEM Tools: How to Evaluate a SIEM Platform
How to evaluate SIEM tools: log source coverage, correlation and detection, scale, cloud vs self-hosted deployment, pricing models and questions for vendors.
Threat Intelligence
Threat Intelligence Platforms: How Enrichment Speeds Up Investigations
What a threat intelligence platform does, which indicators matter, and how enriching logs with threat data and risk scores speeds up threat detection.