Files
sigma-rules/rta/exec_cmd_set_mppreference.py
T
Jonhnathan f41c5288cc [RTA] New RTAs for Windows Rules (#2426)
* Part 1

* Part 2

* Part3

* Part4

* Final Part

* Dedup RTA where Office app loads wmiutils

* Add techniques

* Remove helper

* Update exec_cmd_set_mppreference.py
2023-03-20 07:56:51 -03:00

39 lines
1.2 KiB
Python

# 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="2730b84c-9e39-4647-ba96-0b438aca9575",
platforms=["windows"],
endpoint=[],
siem=[
{
'rule_id': 'c8cccb06-faf2-4cd5-886e-2c9636cfcb87',
'rule_name': 'Disabling Windows Defender Security Settings via PowerShell'
},
{
'rule_id': '2c17e5d7-08b9-43b2-b58a-0270d65ac85b',
'rule_name': 'Windows Defender Exclusions Added via PowerShell'
}
],
techniques=['T1562', 'T1562.001', 'T1562.006', 'T1059', 'T1059.001'],
)
@common.requires_os(metadata.platforms)
def main():
powershell = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
# Execute command
common.execute([powershell, "/c", "Set-MpPreference", "-ExclusionPath", f"{powershell}"], timeout=10)
common.execute([powershell, "/c", f"Remove-MpPreference -ExclusionPath {powershell}"], timeout=10)
if __name__ == "__main__":
exit(main())