Files
sigma-rules/rta/system_restore_process.py
T

53 lines
1.5 KiB
Python
Raw Normal View History

2020-06-29 23:07:16 -06:00
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2021-03-03 22:12:11 -09:00
# 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.
2020-06-29 23:07:16 -06:00
# Name: Process Execution in System Restore
# RTA: system_restore_process.py
# ATT&CK: T1158
# Description: Copies mock malware into the System Volume Information directory and executes.
from pathlib import Path
2022-09-08 12:50:39 -04:00
from . import RtaMetadata, common
2022-09-08 12:50:39 -04:00
metadata = RtaMetadata(
uuid="0fcf5aeb-cebd-466d-8a2e-ddb710ec845d",
platforms=["windows"],
endpoint=[],
siem=[],
techniques=[]
)
2022-09-08 12:50:39 -04:00
2020-06-29 23:07:16 -06:00
SYSTEM_RESTORE = "c:\\System Volume Information"
2023-10-03 10:47:58 -04:00
@common.requires_os(*metadata.platforms)
2020-06-29 23:07:16 -06:00
@common.dependencies(common.PS_EXEC)
def main():
status = common.run_system()
if status is not None:
return status
common.log("System Restore Process Evasion")
program_path = common.get_path("bin", "myapp.exe")
common.log("Finding a writeable directory in %s" % SYSTEM_RESTORE)
target_directory = common.find_writeable_directory(SYSTEM_RESTORE)
if not target_directory:
common.log("No writeable directories in System Restore. Exiting...", "-")
return common.UNSUPPORTED_RTA
target_path = Path(target_directory) / "restore-process.exe"
2020-06-29 23:07:16 -06:00
common.copy_file(program_path, target_path)
common.execute(target_path)
common.log("Cleanup", log_type="-")
common.remove_file(target_path)
if __name__ == "__main__":
exit(main())