ESXi Shell Command Obfuscation
Description
Detects ESXi shell commands that rebuild a command with encoding instead of writing it in clear text, including
octal and hex printf, Python chr(), awk %c sequences, reversed strings, and invisible Unicode. The shell
log then hides the administrative command. The decoded action can still change syslog, the firewall, or other
host settings.
Query · kuery
data_stream.dataset: "vsphere.log" and (
message: (
"chr(101)" or
"%c%c%c%c%c%c" or
"ilcxse" or
"0xe2,0x80,0x8b" or
"0xf3,0xb0,0x80,0x80" or
"\\x65\\x73\\x78" or
"\\145\\163\\170"
)
)
Investigation fields
Pivot points the source recommends for triage.
@timestampmessageevent.originalhost.hostnamelog.file.path
Implementation guide
This rule requires ESXi host logs collected by the Elastic vSphere integration: https://www.elastic.co/docs/reference/integrations/vsphere
Known false positives
- Rare troubleshooting one-liners can use `printf` or `awk` to generate text. A line that also decodes to a syslog, firewall, or VM command should still be investigated.
Analyst notes
Investigating ESXi Shell Command Obfuscation
ESXi shell.log stores the command text. Encoding the letters of esxcli is an attempt to keep a destructive command out of simple string searches. The decoded action is often a syslog reset or a VM listing.
Possible investigation steps
- Copy message and decode it. Octal 145 163 170, hex 65 73 78, chr(101), and repeated percent-c sequences all spell esx.
- If the decoded command resets syslog, changes the firewall, or kills a VM, follow that detection as well.
- Compare the account and source with normal ESXi administration. Operators rarely need these encodings.
False positive analysis
A lab or training host may replay published obfuscation samples. On a production host, treat the encoded command as hostile until the decoded text is explained.
Response and remediation
- Decode and record the command, then check esxcli system syslog config get and the firewall state in case the payload already ran.
- End the shell session and disable SSH if it was not required.
- Preserve shell.log before rotation. The encoded line is the evidence.