Home  /  Blog  /  Wazuh Active Response: Automated Remediation

● SOC

Wazuh Active Response: Automated Remediation

Wazuh can do more than alert. Active Response lets a detection trigger an action: drop an attacker IP at the firewall, disable a compromised account, kill a malicious process. Powerful, and dangerous if misconfigured. Here is how to build automation that helps rather than harms.

Published 26 June 2026 12 min read Codesecure SOC Engineering Team SOC

Key Takeaways

  • Active Response runs an action when a rule fires: block an IP, disable an account, kill a process or invoke a custom script, locally on the agent or centrally from the manager.
  • Built-in commands cover the common cases: firewall-drop blocks an IP via the host firewall; disable-account and host-deny handle accounts and hosts.
  • Timeouts let you act safely: a timed response (block for N seconds, then auto-revert) limits the blast radius of a false positive while still disrupting an attacker.
  • Custom scripts extend it anywhere: any executable that reads the Wazuh alert JSON can become an active response, from isolating a host to calling a cloud API.
  • Safety is the whole game: scope tightly, allowlist critical IPs and accounts, prefer human-in-the-loop for disruptive actions, and test in a lab before production.

What Active Response Is

Most SIEM value is detection: an event matches a rule, an alert is raised, an analyst responds. Active Response adds an automated step in between. When a rule of sufficient severity fires, Wazuh can immediately execute a defined action, with no human in the loop, to contain or remediate the threat at machine speed.

The canonical examples are blocking the source IP of a brute-force attack at the firewall, disabling a user account showing impossible-travel logins, denying a host that is scanning your network, and killing a process flagged as malicious. The response happens in seconds, far faster than any analyst could react, which matters when an attacker is actively working.

Active Response is configured in ossec.conf as a pairing of a <command> (what to run) and an <active-response> block (when to run it, where, and for how long). The action can execute on the agent where the event occurred, on a specific agent, or on the manager, depending on what the response needs to touch.

It is worth being precise about why speed is the point. The window between an attacker gaining a foothold and achieving their objective is often very short, sometimes minutes, and human response simply cannot keep pace during off-hours or when the SOC is busy. Active Response closes that gap for the narrow set of situations where the right action is unambiguous and reversible. The aim is never to replace analysts but to buy them time: contain the obvious so the humans can concentrate on the judgement calls that automation should never make.

The Workhorse: firewall-drop

The most widely used built-in response is firewall-drop. When triggered, it inserts a rule into the host's local firewall (iptables or nftables on Linux, the Windows firewall on Windows) to drop traffic from the offending source IP, which Wazuh extracts from the alert's srcip field.

A typical configuration pairs firewall-drop with a rule that detects repeated authentication failures from a single source. The first time an attacker crosses the threshold, their IP is dropped at the network edge of that host, stopping the brute force cold. Because it runs on the agent, the block is applied exactly where the attack is landing.

The critical safety control here is the timeout. Setting <timeout> means the block auto-reverts after the configured period (say 600 seconds). This limits the damage if the trigger was a false positive, while still imposing real cost on a genuine attacker, who must wait out each block. A permanent block with no timeout is far riskier and should be reserved for high-confidence, allowlisted scenarios.

Need a Managed SOC Running Wazuh?

Codesecure operates Managed SOC for SMBs and enterprises across India, Singapore, UAE and Malaysia using Wazuh, TheHive, n8n, Cortex and MISP. 24x7 named analysts, fixed monthly retainer, no licensing fees. ISO/IEC 27001:2022 certified delivery.

See SOC for SMBs →

Disabling Accounts and Denying Hosts

Beyond IP blocking, Wazuh ships responses that act on accounts and hosts. disable-account locks a user account, useful when a rule detects clear account compromise such as logins from impossible-travel locations or a burst of privilege-escalation attempts. host-deny adds an entry to /etc/hosts.deny to refuse connections from a host at the TCP-wrapper layer.

Account-affecting responses carry higher risk than IP blocks, because locking the wrong account directly disrupts a real person's work and can cascade if it is a service account. This is precisely the category where most teams choose human-in-the-loop: the detection raises a high-severity alert and a SOAR playbook proposes the disable, but a human confirms before the account is locked.

The decision of which responses to fully automate versus gate behind human approval is the heart of designing Active Response. Clear-cut, low-collateral actions (drop a known-bad scanning IP) are good automation candidates. High-collateral actions (disable an account, isolate a production host) usually belong in a supervised workflow. Getting this split right is what makes automation an asset rather than a liability.

Custom Active Response Scripts

The built-in commands cover common cases, but the real power is that any executable can be an active response. Wazuh passes the triggering alert to the script as JSON on standard input, so your script has the full context (source IP, user, rule, agent, decoded fields) to decide exactly what to do.

This opens unlimited possibilities: call a cloud provider API to isolate an instance's security group, quarantine a file, push a containment action to an EDR, post an enriched alert to a chat channel, or open a case in TheHive. Custom scripts live in /var/ossec/active-response/bin/, are declared as a <command>, and follow a simple contract: read the alert, perform the action, and (for revertible actions) handle the delete phase when the timeout expires.

In a mature open source SOC, custom Active Response is the glue to the SOAR layer. Rather than Wazuh making every containment decision alone, a custom response forwards the alert to an orchestration tool (such as n8n via TheHive) that runs a richer playbook with enrichment, approval gates and multi-system actions. This keeps Wazuh focused on detection and fast local containment while orchestration handles the complex, cross-system responses.

Safety First: How Not to Lock Yourself Out

Active Response is the one Wazuh feature that can actively harm your own environment, so safety engineering is not optional. The foundational control is an allowlist: maintain a CDB list of IPs and accounts that must never be acted upon (your VPN ranges, monitoring systems, admin accounts, critical service accounts) and check it before any response executes. This prevents the nightmare scenario of automation blackholing your own management network.

Use timeouts on every blocking action so a mistaken trigger self-heals. Scope responses narrowly to high-confidence rules rather than wiring them to broad, noisy detections; an unreliable trigger driving an automated block is a denial-of-service waiting to happen against yourself. And always test in a lab that mirrors production before enabling a response on live systems, because the failure mode is an outage you caused.

Finally, prefer human-in-the-loop for anything with meaningful collateral. The Codesecure default in client engagements is to fully automate only clear-cut, reversible, low-collateral actions (drop a known-bad IP for ten minutes) and to gate disruptive actions (disable an account, isolate a host) behind analyst approval in a SOAR playbook. This captures the speed benefit where it is safe and keeps a human accountable where the stakes are high. ISO/IEC 27001:2022 certified delivery, designed so automation reduces risk instead of creating it.

Want Help Tuning or Deploying Wazuh?

Whether you need a fresh Wazuh deployment, a rule tuning sprint, or a full managed service, our SOC engineers are available for a 30-minute free scoping call. We deploy, tune, hand over or operate on your behalf.

Talk to a SOC Engineer →

A Sane Rollout Path

The way teams get burned by Active Response is switching it on broadly all at once. The disciplined rollout is incremental. Start in alert-only mode: let the rules that would trigger responses fire as plain alerts for a few weeks so you can confirm they are reliable and low-noise before any action is wired to them.

Next, enable the single safest, most valuable response (almost always timed firewall-drop on high-confidence brute-force detections) with a tight allowlist and a short timeout. Watch it closely. Only once that is proven do you add the next response, again gated and tested. Each addition is a deliberate, reviewed step rather than a bulk configuration change.

Pair every automated response with monitoring of the responses themselves: what was blocked, why, and whether any of it was a false positive. This feedback loop is how you build confidence and catch a misbehaving rule before it causes an outage. Codesecure deploys Active Response this way for clients, expanding automation only as each layer earns trust, so the system gets faster at containment without ever putting the client's availability at risk.

SHARE

Frequently Asked Questions

What can Wazuh Active Response actually do?

It runs a defined action when a rule fires: block a source IP at the host firewall (firewall-drop), disable a user account (disable-account), deny a host (host-deny), kill a process, or execute any custom script. Actions can run on the agent where the event occurred, on a specific agent, or on the manager, and can be timed to auto-revert.

Is it safe to automate response actions?

It can be, with discipline. The risks are real: automation can lock out legitimate users or blackhole your own traffic. Mitigate with allowlists of never-touch IPs and accounts, timeouts so blocks self-heal, narrow scoping to high-confidence rules, lab testing before production, and human-in-the-loop approval for any action with meaningful collateral.

What is the firewall-drop command and how does it work?

firewall-drop is the most-used built-in response. It inserts a rule into the host's local firewall (iptables/nftables on Linux, Windows firewall on Windows) to drop traffic from the alert's source IP. Paired with a brute-force detection rule and a timeout, it blocks an attacker in seconds and auto-reverts after the configured period to limit false-positive impact.

How do I build a custom active response?

Write any executable that reads the triggering alert as JSON on standard input, place it in /var/ossec/active-response/bin/, declare it as a , and reference it in an block. Your script has full alert context and can do anything: call a cloud API to isolate an instance, quarantine a file, or forward to a SOAR tool like n8n via TheHive.

Should I fully automate account lockouts?

Usually not. Account-affecting responses carry high collateral because locking the wrong account disrupts real users and can cascade through service accounts. The common pattern is to detect and raise a high-severity alert, then have a SOAR playbook propose the disable while a human confirms. Reserve full automation for clear-cut, low-collateral, reversible actions.

Can Codesecure set up Active Response safely for us?

Yes. Codesecure deploys Active Response incrementally: alert-only validation first, then the safest timed firewall-drop with allowlists, expanding automation only as each layer earns trust. Disruptive actions are gated behind analyst approval in a SOAR playbook. We monitor the responses themselves so a misbehaving rule is caught before it causes an outage. ISO/IEC 27001:2022 certified delivery.

CS

Codesecure SOC Engineering Team

ISO/IEC 27001:2022 Certified SOC Engineers

Codesecure Solutions is ISO/IEC 27001:2022 certified and runs Managed SOC for businesses across India, Singapore, UAE and Malaysia using the Wazuh + TheHive + n8n + Cortex + MISP open source stack. Named OSCP, CEH and CISSP holding consultants, 24x7 analyst coverage, automated reporting and no expensive vendor licensing.

✓ ISO/IEC 27001:2022 Certified

Automate Containment Without Self-Inflicted Outages

Codesecure designs and operates Wazuh Active Response for businesses across India, Singapore, UAE and Malaysia, with allowlists, timeouts, SOAR approval gates and incremental rollout. Fast containment that never risks your availability. ISO/IEC 27001:2022 certified delivery.