forked from elastic/detection-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec_cscript_suspicious_powershell.py
More file actions
40 lines (31 loc) · 1.25 KB
/
exec_cscript_suspicious_powershell.py
File metadata and controls
40 lines (31 loc) · 1.25 KB
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
35
36
37
38
39
40
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.
from . import common
from . import RtaMetadata
metadata = RtaMetadata(
uuid="c562a05e-0ac8-46f9-91a2-5e99c8a1117c",
platforms=["windows"],
endpoint=[
{"rule_name": "Execution from Unusual Directory", "rule_id": "16c84e67-e5e7-44ff-aefa-4d771bcafc0c"},
{"rule_name": "Binary Masquerading via Untrusted Path", "rule_id": "35dedf0c-8db6-4d70-b2dc-a133b808211f"},
{
"rule_name": "Suspicious PowerShell Execution via Windows Scripts",
"rule_id": "3899dd3b-f31a-4634-8467-55326cd87597",
},
],
siem=[],
techniques=["T1218", "T1036", "T1059"],
)
EXE_FILE = common.get_path("bin", "renamed_posh.exe")
@common.requires_os(metadata.platforms)
def main():
cscript = "C:\\Users\\Public\\cscript.exe"
common.copy_file(EXE_FILE, cscript)
cmd = "powershell -c echo https://raw.githubusercontent.com/"
# Execute command
common.execute([cscript, "/c", cmd], timeout=10)
common.remove_file(cscript)
if __name__ == "__main__":
exit(main())