Detecting Security Control and Logging Evasion

Hunt for commands that disable antivirus, event logging, audit services, SELinux, firewalls, or security telemetry following system exploitation.

Detecting Security Control and Logging Evasion
Detection queriesDefense Evasion Nov 22, 2023#Defense Evasion#Windows Defender#Auditd#Logging#Firewall

Attackers who gain execution on a system may attempt to reduce visibility before continuing their activity. Disabling endpoint protection, stopping audit services, clearing logs, or blocking security telemetry are all important behaviors for a SOC to monitor.

The source defines a cross-platform hunt that combines Windows process telemetry with Linux log indicators.

Windows Defense-Evasion Indicators

The Windows portion of the query looks for command lines containing actions such as:

  • Set-MpPreference;

  • DisableRealtimeMonitoring;

  • stopping Windows Defender;

  • clearing event logs with wevtutil;

  • clearing audit policy;

  • disabling firewall controls.

Linux Defense-Evasion Indicators

The Linux side searches full logs for actions such as:

  • setenforce 0;

  • stopping auditd;

  • modifying iptables;

  • blocking ports 514 or 6514 used for log transport.

Detection Query

(data.win.system.eventID:1 and data.win.eventdata.commandLine:(*Set-MpPreference* or *DisableRealtimeMonitoring* or *sc*stop*WinDefend* or *wevtutil*cl* or *auditpol*clear* or *netsh*firewall*disable*)) or full_log:("setenforce 0" or "systemctl stop auditd" or "service auditd stop" or "iptables -A OUTPUT" or "dport 514 -j DROP" or "dport 6514 -j DROP")

The source recorded 13,751 matching events during the previous 30 days.

Why the Volume Needs Analysis

Administrative tools and maintenance scripts can legitimately change security settings. A raw query for these commands may therefore include expected activity.

The most useful next step is to identify:

  • which commands generate the most matches;

  • which hosts execute them;

  • which accounts are involved;

  • whether they occur during approved maintenance;

  • whether they coincide with other suspicious events.

The same command can have very different meaning depending on context.

Investigation Priorities

Events should receive higher priority when security controls are modified:

  • immediately after suspicious process execution;

  • by an unexpected user;

  • on production servers;

  • shortly before persistence or credential access;

  • together with outbound tunneling or ransomware commands.

Analysts should determine whether the security setting was later restored and whether logging gaps were created.

Tuning Strategy

Do not simply exclude all use of a command such as Set-MpPreference. Instead, document approved automation and constrain exclusions by host, account, command line, and expected schedule.

This preserves visibility into the same command when it appears elsewhere.

Correlation Value

Defense evasion is especially important as part of an attack sequence.

For example:

web application RCE → PowerShell → Defender disabled → persistence created

is much more meaningful than any single event.

Operational Value

Security controls exist to create visibility. Attempts to disable those controls should therefore remain a core part of threat hunting.

Even in environments with legitimate administrative use, baselining and correlation can transform a noisy command hunt into a valuable post-exploitation detection.

Cloud image

30 Days of Enterprise-Grade Cyber Defense

Step into the future of cybersecurity with full access to a unified, intelligent platform — free for 30 days. Empower your security team with:

  • Advanced SIEM for real-time visibility, smart alerting, and deep forensics across cloud, on-prem, and hybrid environments

  • Continuous Vulnerability Management to identify, prioritize, and remediate risk across all assets

  • Live Cyber Threat Intelligence integrated directly into your workflows, with global insights and attacker profiling

  • AI-Powered Threat Detection that learns from your environment, explains alerts in plain language, and suggests next steps

  • Built-in Compliance Readiness for NIS2, GDPR, ISO 27001, and more, with automated reporting and audit tools

Whether you're managing a lean SOC or a full-scale enterprise security team, this platform gives you the tools to detect faster, respond smarter, and stay ahead of evolving threats — all without the complexity.

Experience enterprise-grade protection, streamlined workflows, and total control.

Your 30-day head start begins now.

Unlock Your 30 Days Free Trial