File integrity monitoring
The Wazuh File Integrity Monitoring (FIM) module monitors an endpoint filesystem to detect file changes in specified files and directories. It triggers findings on file creation, modification, or deletion from the monitored paths. The FIM module compares the cryptographic checksum and other attributes of the monitored files and folders when a change occurs.
The Wazuh File Integrity Monitoring module assists you in meeting the following NIST 800-53 controls:
CM-6 Configuration settings: "Configuration settings are the parameters that can be changed in the hardware, software, or firmware components of the system that affect the security and privacy posture or functionality of the system. Information technology products for which configuration settings can be defined include mainframe computers, servers, workstations, operating systems, mobile devices, input/output devices, protocols, and applications. Parameters that impact the security posture of systems include registry settings; account, file, or directory permission settings; and settings for functions, protocols, ports, services, and remote connections."
SI-4 System monitoring: "System monitoring includes external and internal monitoring. External monitoring includes the observation of events occurring at external interfaces to the system. Internal monitoring includes the observation of events occurring within the system. Organizations monitor systems by observing audit activities in real-time or by observing other system aspects such as access patterns, characteristics of access, and other actions. The monitoring objectives guide and inform the determination of the events. System monitoring capabilities are achieved through a variety of tools and techniques, including intrusion detection and prevention systems, malicious code protection software, scanning tools, audit record monitoring software, and network monitoring software."
These NIST 800-53 controls require you to maintain secure configuration settings and monitor system changes in your infrastructure. The Wazuh FIM module helps you monitor the creation, modification, and deletion of files, directories, and Windows registry keys. This helps you meet the NIST 800-53 controls that require monitoring changes to files and folders.
Use cases
Detect SSH configuration changes
Wazuh helps meet the CM-6 Configuration settings requirement by providing file integrity monitoring on specified files and paths.
In this scenario, the Wazuh FIM module monitors the /etc/ssh directory, which contains the SSH configuration file /etc/ssh/sshd_config, on an Ubuntu 24.04 endpoint to detect changes in the SSH configuration. Monitor the directory for changes using the steps below:
Switch to the root user and install the OpenSSH server:
$ sudo su # apt install openssh-server
Add the following configuration to the
<syscheck>block of the Wazuh agent configuration file/var/ossec/etc/ossec.conf.This monitors all files in the
/etc/sshdirectory, including/etc/ssh/sshd_config, for changes:<directories report_changes="yes" realtime="yes">/etc/ssh</directories>
Restart the Wazuh agent to apply the changes:
# systemctl restart wazuh-agent
Enable the
PasswordAuthenticationoption in the/etc/ssh/sshd_configfile to create a change in the SSH configuration:# sed -i.`date -I` 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
Click the upper-left menu icon (☰) and go to Endpoint security > File Integrity Monitoring.
The finding details show that
/etc/ssh/sshd_configchanged, including the differences in the file checksum, the modification made, the modification time, and other information. The first change after the Wazuh agent restarts can showUnable to calculate diff due to no previous data stored for this file.in thefile.difffield. Later changes show the modified lines. Thesedcommand also saves a copy of the original file as/etc/ssh/sshd_config.<YYYY-MM-DD>. Because the Wazuh FIM module monitors the whole/etc/sshdirectory, you also see a finding for this new backup file.
Detect change actors to UFW rules using who-data
Wazuh helps meet SI-4 System monitoring by detecting system configuration changes and providing additional audit data on triggered events.
In this scenario, the Wazuh FIM monitors the Uncomplicated Firewall (UFW) rule files in the /etc/ufw/ directory on an Ubuntu 24.04 endpoint. Using who-data, you can get more information like the user, program, or process that made changes to a monitored file or folder. Perform the steps below to monitor and detect changes to the UFW rule files:
Switch to the root user, install the audit daemon, and restart it. On Ubuntu 24.04, the
auditdpackage already includes theaf_unixplugin that who-data monitoring uses, so you don't needaudispd-plugins:$ sudo su # apt-get install auditd # systemctl restart auditd
Add the following configuration to the
<syscheck>block of the Wazuh agent configuration file/var/ossec/etc/ossec.conf.This monitors all UFW rule files for changes:
<directories report_changes="yes" whodata="yes">/etc/ufw/</directories>
UFW stores its rule files in the
/etc/ufw/directory, and all rule files have the extension.rules. The configuration above monitors the modification, addition, and deletion of any files in the/etc/ufw/directory.Restart the Wazuh agent to apply the changes:
# systemctl restart wazuh-agent
Modify the permissions for an existing rule file,
user.rules, in the/etc/ufwdirectory to create a change to the UFW rule files:# chmod 777 /etc/ufw/user.rules
Click the upper-left menu icon (☰) and go to Endpoint security > File Integrity Monitoring.
Check the FIM finding regarding the
/etc/ufw/user.rulesfile which shows permissions for the/etc/ufw/user.rulesfile have changed.Expand the finding. The
user.nameandprocess.namefields show the user and the process that changed the file, and theevent.originalfield shows an overview of the event.
After you review the finding, restore the original permissions of the rule file with chmod 640 /etc/ufw/user.rules. Otherwise, later ufw commands warn that /etc/ufw/user.rules is world writable.