forked from elastic/detection-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_quarantine_attrib.py
44 lines (34 loc) · 1.23 KB
/
delete_quarantine_attrib.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
42
43
44
# 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="d7a67c3c-eadb-4bfb-beb1-61ddd86b4b83",
platforms=["macos"],
endpoint=[
{
"rule_id": "6e47b750-72c4-4af9-ad7b-0fc846df64d3",
"rule_name": "Quarantine Attribute Deleted via Untrusted Binary",
}
],
siem=[],
techniques=["T1553", "T1553.001"],
)
@common.requires_os(*metadata.platforms)
def main():
# create masquerades
masquerade = "/tmp/bash"
masquerade2 = "/tmp/testbypass"
common.create_macos_masquerade(masquerade)
common.create_macos_masquerade(masquerade2)
# Execute commands
common.log("Launching fake delete commands to delete quarantine attribute.")
command = f"{masquerade} xattr -d com.apple.quarantine"
common.execute([masquerade2, "childprocess", command], shell=True, timeout=5, kill=True)
# cleanup
common.remove_file(masquerade)
common.remove_file(masquerade2)
if __name__ == "__main__":
exit(main())