-
Notifications
You must be signed in to change notification settings - Fork 517
/
disable_security_controls.py
40 lines (32 loc) · 1.15 KB
/
disable_security_controls.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
# 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.
import sys
from . import RtaMetadata, common
metadata = RtaMetadata(
uuid="4eceac28-10c3-425f-a007-c03a9b57956f",
platforms=["linux"],
endpoint=[
{
"rule_id": "b63df89d-ac6f-44d7-80fa-ddf038295e42",
"rule_name": "Attempt to Disable Linux Security and Logging Controls",
},
],
siem=[],
techniques=["T1562", "T1562.001"],
)
@common.requires_os(*metadata.platforms)
def main() -> None:
masquerade = "/tmp/systemctl"
source = common.get_path("bin", "linux.ditto_and_spawn")
common.copy_file(source, masquerade)
# Execute command
common.log("Launching fake builtin commands for disabling security controls")
command = "stop"
command1 = "apparmor"
common.execute([masquerade, command, command1], timeout=10, kill=True, shell=True) # noqa: S604
# cleanup
common.remove_file(masquerade)
if __name__ == "__main__":
sys.exit(main())