-
Notifications
You must be signed in to change notification settings - Fork 505
/
defensive_evasion_safari_modification.py
44 lines (34 loc) · 1.2 KB
/
defensive_evasion_safari_modification.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="9d02871f-6338-47aa-84c4-7d622692319f",
platforms=["macos"],
endpoint=[
{
"rule_name": "Modification of Safari Settings via Defaults Command",
"rule_id": "396e1138-243c-4215-a8ed-be303204710d",
}
],
siem=[
{
"rule_name": "Modification of Safari Settings via Defaults Command",
"rule_id": "6482255d-f468-45ea-a5b3-d3a7de1331ae",
}
],
techniques=["T1562"],
)
@common.requires_os(*metadata.platforms)
def main():
masquerade = "/tmp/defaults"
common.create_macos_masquerade(masquerade)
# Execute command
common.log("Launching commands to mimic defaults modifying safari configurations.")
common.execute([masquerade, "write", "com.apple.Safari", "JavaScript"], timeout=10, kill=True)
# cleanup
common.remove_file(masquerade)
if __name__ == "__main__":
exit(main())