diff --git a/rta/linux_execution_setsid_nohup_unusual_execution.py b/rta/linux_execution_setsid_nohup_unusual_execution.py new file mode 100644 index 000000000..f6308b7d7 --- /dev/null +++ b/rta/linux_execution_setsid_nohup_unusual_execution.py @@ -0,0 +1,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. + +from . import common +from . import RtaMetadata + +metadata = RtaMetadata( + uuid="66ff975c-fa48-47c4-965a-8f363425369e", + platforms=["linux"], + endpoint=[ + { + "rule_name": "Suspicious Execution via setsid and nohup", + "rule_id": "18d82674-08d0-408e-801b-468e1b06298f" + } + ], + techniques=["T1059", "T1071"], +) + + +@common.requires_os(*metadata.platforms) +def main(): + + common.log("Creating a fake nohup executable..") + masquerade = "/tmp/nohup" + source = common.get_path("bin", "netcon_exec_chain.elf") + common.copy_file(source, masquerade) + common.log("Granting execute permissions...") + common.execute(['chmod', '+x', masquerade]) + + commands = [masquerade, 'exec', '-c', '/dev/tcp'] + common.execute([*commands], timeout=5, kill=True) + common.log("Cleaning...") + common.remove_file(masquerade) + common.log("Simulation successfull!") + + +if __name__ == "__main__": + exit(main())