|
| 1 | +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 2 | +# or more contributor license agreements. Licensed under the Elastic License |
| 3 | +# 2.0; you may not use this file except in compliance with the Elastic License |
| 4 | +# 2.0. |
| 5 | + |
| 6 | +import sys |
| 7 | + |
| 8 | +from . import RtaMetadata, common |
| 9 | + |
| 10 | +metadata = RtaMetadata( |
| 11 | + uuid="5abebdea-b42e-4401-8838-15f19d11401f", |
| 12 | + platforms=["linux"], |
| 13 | + endpoint=[ |
| 14 | + { |
| 15 | + "rule_name": "Potential Mining Pool Command Detection", |
| 16 | + "rule_id": "fcc42a61-4507-4918-867b-d673e5b065dc", |
| 17 | + }, |
| 18 | + ], |
| 19 | + techniques=["T1496", "T1059"], |
| 20 | +) |
| 21 | + |
| 22 | + |
| 23 | +@common.requires_os(*metadata.platforms) |
| 24 | +def main() -> None: |
| 25 | + common.log("Creating a fake executable..") |
| 26 | + masquerade = "/dev/shm/evil" |
| 27 | + |
| 28 | + source = common.get_path("bin", "netcon_exec_chain.elf") |
| 29 | + common.copy_file(source, masquerade) |
| 30 | + common.execute(["chmod", "+x", masquerade]) |
| 31 | + |
| 32 | + commands = [masquerade, "exec", "-c", "crypto-pool.info"] |
| 33 | + common.execute([*commands], timeout=5, kill=True) |
| 34 | + common.log("Cleaning...") |
| 35 | + common.remove_file(masquerade) |
| 36 | + common.log("Simulation successfull!") |
| 37 | + |
| 38 | + |
| 39 | +if __name__ == "__main__": |
| 40 | + sys.exit(main()) |
0 commit comments