Wazuh Yara integrates YARA rules with Wazuh to improve malware detection and file integrity monitoring on Linux and macOS. For Windows, the solution leverages Windows Defender integration to provide native malware detection and log monitoring, ensuring a unified security approach across platforms.
By leveraging YARA’s rule-based detection capabilities on Linux and macOS, Wazuh Yara enables real-time, targeted malware detection and response. On Windows, the provided integration script configures Wazuh to monitor Windows Defender logs for threat events, automating response and visibility.
- File Integrity Monitoring (FIM): Monitors specified directories and files for modifications, automatically triggering YARA scans on all supported platforms.
- Malware Detection:
- Linux/macOS: Detects and classifies malware by applying YARA rules to files and directories using the
yara-server.shscanning engine. - Windows: Uses YARA-based active response via
yara.batto scan files and detect malware.
- Linux/macOS: Detects and classifies malware by applying YARA rules to files and directories using the
- Active Response:
- Linux/macOS: Automatically responds to detected threats based on YARA rule matches, logging results to active response logs.
- Windows: Provides desktop notifications via BurntToast and logs scan results to active response logs.
- Cross-Platform Support: Unified approach for Ubuntu, macOS, and Windows endpoints using consistent YARA-based detection.
- Automated Testing: Comprehensive test suite and CI workflow for installation and configuration validation (Linux/macOS).
- Checksum Verification: All scripts and rules are verified using SHA256 checksums during installation for security and integrity.
- Ubuntu (22.04+, 24.04+) - YARA integration with active response
- macOS (Monterey, Ventura, Sonoma, Sequoia) - YARA integration with active response
- Windows 10/11 - YARA integration with desktop notifications
- Wazuh Agent installed on endpoints
curl(Linux/macOS) orPowerShell(Windows)- Sufficient privileges to install system packages and modify configuration files
- Bash 4.0+ (Linux/macOS) - required for YARA scanning scripts
Desktop (non-interactive)
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/linux/install.sh | sudo env INSTALLATION_TYPE=desktop bashServer (non-interactive)
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/linux/install.sh | sudo env INSTALLATION_TYPE=server bashAlternative (flags, interactive equivalent)
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/linux/install.sh | sudo bash -s -- --type desktop
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/linux/install.sh | sudo bash -s -- --type serverNotes
- Setting
INSTALLATION_TYPEruns the installer in non-interactive mode with the selected flow. sudois recommended to ensure correct ownership and service restart.
Desktop (non-interactive)
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/macos/install.sh | sudo env INSTALLATION_TYPE=desktop bashServer (non-interactive)
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/macos/install.sh | sudo env INSTALLATION_TYPE=server bashAlternative (flags, interactive equivalent)
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/macos/install.sh | sudo bash -s -- --type desktop
curl -fsSL https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/macos/install.sh | sudo bash -s -- --type serverNotes
- macOS requires Bash 4.0+ (install via Homebrew:
brew install bash) - Full disk access may be required for YARA scanning operations
iex (iwr -UseBasicParsing "https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/windows/install.ps1")Uninstall (Windows)
iex (iwr -UseBasicParsing "https://raw.githubusercontent.com/ADORSYS-GIS/wazuh-yara/main/scripts/windows/uninstall.ps1")Notes
- Administrator privileges required
- Installs YARA binaries and configures Wazuh agent active response
- Downloads and configures YARA rules for malware detection
The integration uses a two-script architecture:
yara.sh- Client-side active response script that triggers scans when files are modifiedyara-server.sh- Server-side script that performs the actual YARA scanning
-
YARA Rules Location:
- Linux:
/var/ossec/ruleset/yara/rules/yara_rules.yar - macOS:
/Library/Ossec/ruleset/yara/rules/yara_rules.yar
- Linux:
-
File Integrity Monitoring:
- Configure the Wazuh FIM module in
/var/ossec/etc/ossec.conf(Linux) or/Library/Ossec/etc/ossec.conf(macOS) - Monitor directories by adding
<directories>tags under<syscheck> - Each file change triggers the
yara.shactive response script
- Configure the Wazuh FIM module in
-
Active Response Workflow:
- FIM detects file modification
yara.shis triggered as an active response- Script calls
yara-server.shto perform the scan - Results are logged to
/var/ossec/logs/active-responses.log(Linux) or/Library/Ossec/logs/active-responses.log(macOS)
-
Log Monitoring:
- Monitor active response logs for YARA scan results
- Wazuh rules can be configured to generate alerts based on YARA matches
The Windows integration uses:
install.ps1- Installation script that sets up YARA and configures Wazuhuninstall.ps1- Removal script to clean up YARA installationyara.bat- Active response batch script that executes YARA scans
-
Installation:
- Run
install.ps1as Administrator - Downloads YARA binaries (version 4.5.2) from official releases
- Installs to
C:\Program Files (x86)\ossec-agent\active-response\bin\yara\ - Copies YARA rules to the installation directory
- Run
-
Active Response Setup:
yara.batis configured as a Wazuh active response command- Scans files detected by FIM using YARA rules
- Logs results to
C:\Program Files (x86)\ossec-agent\active-response\active-responses.log
-
Wazuh Configuration:
- Modifies
ossec.confto monitorC:\Users\<username>\Downloads - Adds
<file_limit>withenabled=noto prevent file limit issues - Sets frequency to 21600 seconds (6 hours)
- Modifies
-
Notifications:
- Uses BurntToast PowerShell module for desktop notifications
- Notifications include malware name and file path
- Falls back to event log if notification fails
-
Uninstallation:
- Run
uninstall.ps1as Administrator - Removes YARA binaries and configuration
- Cleans up Wazuh agent modifications
- Restarts Wazuh service
- Run
- The repository includes a GitHub Actions workflow that automatically runs the test suite on every push, pull request, and release tag.
- The test suite verifies:
- User and group creation
- Configuration file presence
- YARA and notify-send installation and version
- Script and rules file permissions
- Wazuh agent service status
- See YARA Tests README for details and manual test instructions.
- See the GitHub Actions Workflow for CI details.
Contributions are welcome! Please open issues or pull requests for bug fixes, improvements, or new features. All contributions should:
- Pass the automated test suite (see CI badge above)
- Follow the code style and documentation guidelines
- Include clear commit messages and PR descriptions