forked from elastic/detection-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
automator_workflows.py
41 lines (31 loc) · 1.27 KB
/
automator_workflows.py
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
41
# 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="6294e8bd-a82e-4d60-9de7-cceb639e91d9",
platforms=["macos"],
endpoint=[
{"rule_name": "Suspicious Automator Workflows Execution", "rule_id": "e390d36d-c739-43ee-9e3d-5a76fa853bd5"}
],
siem=[{"rule_name": "Suspicious Automator Workflows Execution", "rule_id": "5d9f8cfc-0d03-443e-a167-2b0597ce0965"}],
techniques=["T1059"],
)
@common.requires_os(*metadata.platforms)
def main():
# create masquerades
masquerade = "/tmp/automator"
masquerade2 = "/tmp/com.apple.automator.runner"
common.create_macos_masquerade(masquerade)
common.copy_file("/usr/bin/curl", masquerade2)
# Execute command
common.log("Launching fake commands to launch Automator workflows")
common.execute([masquerade], timeout=10, kill=True)
common.execute([masquerade2, "portquiz.net"], timeout=10, kill=True)
# cleanup
common.remove_file(masquerade)
common.remove_file(masquerade2)
if __name__ == "__main__":
exit(main())