From 141316ffd0cce9f716f6432f4da70e44dffc9a5d Mon Sep 17 00:00:00 2001 From: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:47:07 +0200 Subject: [PATCH] [New Rule] Upgrade of Non-interactive Shell (#3113) * [New Rule] Upgrade of Non-interactive Shell * Changed numbers to int * Changed severity * [New Rule] Pot. Rev Shell via Background Process * Revert "[New Rule] Pot. Rev Shell via Background Process" This reverts commit bbb36eae26561dbef4bf57f6c1388cebe7a8b88d. * Update rules/linux/execution_interpreter_tty_upgrade.toml (cherry picked from commit 9f41c9f35cd568c397c1f81bafc997e92bbf2df0) --- .../execution_interpreter_tty_upgrade.toml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 rules/linux/execution_interpreter_tty_upgrade.toml diff --git a/rules/linux/execution_interpreter_tty_upgrade.toml b/rules/linux/execution_interpreter_tty_upgrade.toml new file mode 100644 index 000000000..bcee93b37 --- /dev/null +++ b/rules/linux/execution_interpreter_tty_upgrade.toml @@ -0,0 +1,57 @@ +[metadata] +creation_date = "2023/09/20" +integration = ["endpoint"] +maturity = "production" +updated_date = "2023/09/20" +min_stack_comments = "New fields added: required_fields, related_integrations, setup" +min_stack_version = "8.3.0" + +[rule] +author = ["Elastic"] +description = """ +Identifies when a non-interactive terminal (tty) is being upgraded to a fully interactive shell. Attackers may upgrade +a simple reverse shell to a fully interactive tty after obtaining initial access to a host, in order to obtain a more +stable connection. +""" +from = "now-9m" +index = ["logs-endpoint.events.*", "endgame-*"] +language = "eql" +license = "Elastic License v2" +name = "Potential Upgrade of Non-interactive Shell" +risk_score = 47 +rule_id = "84d1f8db-207f-45ab-a578-921d91c23eb2" +severity = "medium" +timestamp_override = "event.ingested" +tags = ["Domain: Endpoint", + "OS: Linux", + "Use Case: Threat Detection", + "Tactic: Execution", + "Data Source: Elastic Endgame", + "Data Source: Elastic Defend" + ] +type = "eql" +query = ''' +process where host.os.type == "linux" and event.action in ("exec", "exec_event") and event.type == "start" and ( + (process.name == "stty" and process.args == "raw" and process.args == "-echo" and process.args_count >= 3) or + (process.name == "script" and process.args in ("-qc", "-c") and process.args == "/dev/null" and + process.args_count == 4) +) +''' + +[[rule.threat]] +framework = "MITRE ATT&CK" + +[[rule.threat.technique]] +id = "T1059" +name = "Command and Scripting Interpreter" +reference = "https://attack.mitre.org/techniques/T1059/" + +[[rule.threat.technique.subtechnique]] +id = "T1059.004" +name = "Unix Shell" +reference = "https://attack.mitre.org/techniques/T1059/004/" + +[rule.threat.tactic] +id = "TA0002" +name = "Execution" +reference = "https://attack.mitre.org/tactics/TA0002/"