Command Line Obfuscation via Whitespace Padding

Last updated 2 months ago on 2025-06-30
Created 2 months ago on 2025-06-30

About

Identifies process execution events where the command line value contains a long sequence of whitespace characters or multiple occurrences of contiguous whitespace. Attackers may attempt to evade signature-based detections by padding their malicious command with unnecessary whitespace characters. These observations should be investigated for malicious behavior.
Tags
Domain: EndpointOS: WindowsOS: macOSOS: LinuxUse Case: Threat DetectionTactic: Defense EvasionTactic: ExecutionLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Defense Evasion (TA0005)(opens in a new tab or window)

Execution (TA0002)(opens in a new tab or window)

License
Elastic License v2(opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

endpoint(opens in a new tab or window)

system(opens in a new tab or window)

windows(opens in a new tab or window)

auditd_manager(opens in a new tab or window)

m365_defender(opens in a new tab or window)

crowdstrike(opens in a new tab or window)

sentinel_one_cloud_funnel(opens in a new tab or window)

Query
FROM logs-* metadata _id, _version, _index 
| where event.category == "process" and event.type == "start" and event.action != "fork"
// more than 100 spaces in process.command_line
| eval multi_spaces = LOCATE(process.command_line, space(100)) 
| where multi_spaces > 0 
| keep user.name, host.id, host.name, process.command_line, process.executable, process.parent.executable

Install detection rules in Elastic Security

Detect Command Line Obfuscation via Whitespace Padding in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).