Suspicious Base64 String Command-line
Description
This rule identifies suspicious base64 strings in a command execution. Malware authors may attempt to evade detection and trick users into executing malicious code by encoding and obfuscating their payloads. Several payloads relate to interpreter executions, reverse shells and ELF binaries.
Query · eql
process where event.type == "start" and event.action == "exec" and
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
process.parent.executable != null and process.command_line like (
// python and python3
"*cHl0aG9uIC1jICdpbXBvcnQgc29ja2V0*", "*ZXhwb3J0IFJIT1NUPQ*", "*cHl0aG9uMyAtYyAnaW1wb3J0IHNvY2tldA*",
"*cHl0aG9uMyAtYyAnaW1wb3J0IG9zLHB0eSxzb2NrZXQ7*", "*cHl0aG9uIC1jICdpbXBvcnQgb3MscHR5LHNvY2tldDs*",
"*cHl0aG9uIC1jICdpbXBvcnQgb3MscHR5LHNvY2tldDs*",
// perl
"*cGVybCAtTUlPIC1l*", "*cGVybCAtZQ*",
// ruby -r, -e
"cnVieSAtcg*", "*cnVie*tZQ*",
// php -r & cmd shells
"*cGhwIC1y*", "*PD9waHAgaWY*", "*PD89YCRfR0VUWzBdYD8*",
// lua -e + versioning wildcard
"*bHVh*IC1l*",
// sh reverse shells
"*c2ggLWkgPiYgL2Rldi90Y3Av*", "*MDwmMTk2O2V4ZWMgMTk2PD4vZGV2L3RjcC8*", "*ZXhlYyA1PD4vZGV2L3RjcC8*",
"*c2ggLWkgNTw+IC9kZXYvdGNwLw*", "*c2ggLWkgPiYgL2Rldi91ZHAv*",
// nc
"*cm0gL3RtcC9mO21rZmlmbyAvdG1wL2Y7Y2F0IC90bXAvZnxzaCAtaSAyPiYxfG5j*", "*YnVzeWJveCBuYw*",
// bash reverse shells
"*YmFzaCAtaSA+JiAvZGV2L3RjcC8*", "*L2Jpbi9iYXNoIC1sID4gL2Rldi90Y3Av*",
// node -e
"*bm9kZSAtZQ*",
// socat
"*c29jYXQ*",
// ELF
"*f0VMRg*"
) and not (
process.parent.name in ("fzf", "nvim") or
process.command_line like~ "sh -c *data *" or
process.parent.executable like ("/home/*/.cursor-server/bin/linux-x64/*/node", "/tmp/.mount_*/usr/share/cursor/cursor")
)