-
Notifications
You must be signed in to change notification settings - Fork 557
/
Copy pathdefense_evasion_self_deleting_python_script.toml
34 lines (34 loc) · 1.6 KB
/
defense_evasion_self_deleting_python_script.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[hunt]
author = "Elastic"
name = "Self-Deleting Python Script"
uuid = "6461f45e-b03f-4756-94d2-34a210caeb78"
description = """
Detects when a Python script is executed and then deletes itself within a short time window. This behavior is often observed in malware used by DPRK threat actors to remove traces post-execution and avoid detection.
"""
integration = ["endpoint"]
language = ["EQL"]
license = "Elastic License v2"
mitre = ["T1059.006", "T1070.004"]
notes = [
"Self-deletion of Python scripts is commonly used to evade detection and forensic recovery.",
"This hunt is effective at uncovering ephemeral post-exploitation scripts or loaders.",
"You may pivot on `file.path`, `process.args`, and `process.executable` to understand intent and targets."
]
query = [
'''
sequence by process.entity_id with maxspan=10s
[process where event.type == "start" and event.action == "exec" and
process.name like~ "python*" and process.args_count == 2 and
process.args like ("/Users/Shared/*.py", "/tmp/*.py", "/private/tmp/*.py", "/Users/*/Public/*.py")]
[file where event.action == "deletion" and
file.extension in ("py", "pyc") and
file.path like ("/Users/Shared/*", "/tmp/*", "/private/tmp/*", "/Users/*/Public/*")]
'''
]
references = [
"https://www.elastic.co/security-labs/dprk-code-of-conduct",
"https://unit42.paloaltonetworks.com/slow-pisces-new-custom-malware/",
"https://slowmist.medium.com/cryptocurrency-apt-intelligence-unveiling-lazarus-groups-intrusion-techniques-a1a6efda7d34",
"https://x.com/safe/status/1897663514975649938",
"https://www.sygnia.co/blog/sygnia-investigation-bybit-hack/"
]