Summary
Wazuh's ip-customblock active response script contains a path traversal vulnerability that can allow arbitrary file creation or deletion when attacker-controlled alert data is used to construct filesystem paths.
An attacker who can trigger a matching alert with a crafted source-address value may cause the root-running response script to access paths outside its intended directory.
Affected context
The vulnerability occurs in Wazuh deployments that use the ip-customblock active response script to block and unblock source addresses. The script appends the alert JSON srcip value directly to the /ipblock/ directory without confirming that it is a valid IP address, allowing path components to escape the intended directory. Risk is greater when untrusted or externally influenced log events can trigger alert-matching active responses.
Exploit preconditions
- Attack surface: Wazuh alert processing and the ip-customblock active response script
- Required access: Ability to cause or influence log data that produces a matching alert with attacker-controlled
srcipcontent - Trigger point: The block or unblock action that constructs a filesystem path from the alert field
- Why exploitation is possible: The raw value is concatenated into a path without IP-format validation or traversal checks, and the active response daemon runs with root privileges
Why this happens
The script treats a field extracted from alert JSON as a trusted filesystem path component. It does not apply the IP validation used by related response scripts, such as validation through an IP-version check, before constructing the path. This insecure concatenation permits path traversal sequences to escape the fixed directory, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Potential impact
- An attacker could create empty files at arbitrary filesystem locations
- An attacker could delete arbitrary files accessible to the root-running process
- Sensitive credentials or Wazuh configuration could be damaged or removed
- Wazuh monitoring and active response functions could be disrupted
- Host compromise or broader operational impact could result from tampering with security controls
General mitigation guidance
Mitigation generally focuses on treating alert-derived values as untrusted data and preventing them from becoming unrestricted filesystem paths.
Common defensive patterns include:
- Validate source-address values using a strict IP parser before any filesystem operation
- Reject malformed values, directory separators, traversal components, and unexpected encodings
- Prefer an opaque, controlled identifier or a fixed mapping rather than user-derived path components
- Constrain file operations to an approved directory and verify the resolved path remains within it
- Separate block and unblock permissions and run active response components with the least privilege necessary
- Use allowlisted file operations and avoid root execution where operationally feasible
- Protect alert ingestion and log sources against injection of fields that influence active responses
How teams detect issues like this
Detection approaches can include:
- Static analysis rules for string concatenation or interpolation of external fields into filesystem paths
- Code review checks for missing canonicalization, containment checks, and input validation before file operations
- Tests using malformed address values and traversal-like path components to verify rejection
- Runtime monitoring for unexpected file creation or deletion by Wazuh active response processes
- Policy enforcement requiring strict parsers and allowlisted directories for security automation
- Automated code review tools that flag path construction from alert, log, or request data

