Conversation
Identifies oversized command lines used by Python, PowerShell, Node.js, or Deno that contain base64 decoding or encoded-command patterns. Adversaries may embed long inline encoded payloads in scripting interpreters to evade inspection and execute malicious content across Windows, macOS, and Linux systems.
Rule: New - GuidelinesThese guidelines serve as a reminder set of considerations when proposing a new rule. Documentation and Context
Rule Metadata Checks
New BBR Rules
Testing and Validation
|
|
⛔️ Test failed Results
|
| FROM logs-endpoint.events.process-* METADATA _id, _index, _version, _ignored | ||
| | MV_EXPAND _ignored | ||
| | WHERE _ignored == "process.command_line" | ||
| | WHERE host.os.type in ("linux", "macos", "windows") and event.category == "process" and event.type == "start" and event.action != "fork" |
There was a problem hiding this comment.
Excluding fork here will result in FNs, because of aggregated event actions for linux and macos e.g. ["exec", "fork", "end"] would be excluded.
There was a problem hiding this comment.
its not even evaluated since its an array, I will remove it.
| | WHERE _ignored == "process.command_line" | ||
| | WHERE host.os.type in ("linux", "macos", "windows") and event.category == "process" and event.type == "start" and event.action != "fork" | ||
| | EVAL command_line = TO_LOWER(process.command_line.text), pname = TO_LOWER(process.name) | ||
| | WHERE |
There was a problem hiding this comment.
Might be good to add lua, php, ruby, perl, java, openssl, and common shells with decoding args
There was a problem hiding this comment.
may add those as a tuning if no perf/timeout issues (length + ingored fiels), let's test with 3 processes.
| id = "T1059.001" | ||
| name = "PowerShell" | ||
| reference = "https://attack.mitre.org/techniques/T1059/001/" | ||
|
|
There was a problem hiding this comment.
good to add unix shell + lua here if you increase scope based on previous comment
| FROM logs-endpoint.events.process-* METADATA _id, _index, _version, _ignored | ||
| | MV_EXPAND _ignored | ||
| | WHERE _ignored == "process.command_line" | ||
| | WHERE host.os.type in ("linux", "macos", "windows") and event.category == "process" and event.type == "start" and event.action != "fork" |
There was a problem hiding this comment.
+1 to Aegrah's comment. An allowlist approach like event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") would be more consistent with the other cross-platform rules (e.g., the companion endpoint rule and the GitHub Actions runner rule in #5892 both use this pattern).
|
⛔️ Test failed Results
|
DefSecSentinel
left a comment
There was a problem hiding this comment.
Appreciate the response. Looks good.
| ) | ||
| | EVAL Esql.length_cmdline = LENGTH(command_line) | ||
| | WHERE Esql.length_cmdline >= 4000 | ||
| | KEEP |
terrancedejesus
left a comment
There was a problem hiding this comment.
Maybe a complimentary rule using https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/string-functions/from_base64 and then regex for HTTP URIs. Just a thought.
Mikaayenson
left a comment
There was a problem hiding this comment.
fwiw, I tested the 4k count based on normal command_line size and it makes sense
Identifies oversized command lines used by Python, PowerShell, Node.js, or Deno that contain base64 decoding or encoded-command patterns. Adversaries may embed long inline encoded payloads in scripting interpreters to evade inspection and execute malicious content across Windows, macOS, and Linux systems.