forked from elastic/detection-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
execution_node_child_process.py
48 lines (38 loc) · 1.23 KB
/
execution_node_child_process.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
41
42
43
44
45
46
47
48
# 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="20631e46-d3c4-45c0-bfa8-37f6b287db36",
platforms=["macos"],
endpoint=[
{
"rule_name": "Execution via Electron Child Process Node.js Module",
"rule_id": "1d43f87d-2466-4714-8fef-d52816cc25fb",
}
],
siem=[
{
"rule_name": "Execution via Electron Child Process Node.js Module",
"rule_id": "35330ba2-c859-4c98-8b7f-c19159ea0e58",
}
],
techniques=["T1548", "T1059"],
)
@common.requires_os(metadata.platforms)
def main():
masquerade = "/tmp/node"
common.create_macos_masquerade(masquerade)
# Execute command
common.log("Spawning fake node commands to mimic Electon child process.")
common.execute(
[masquerade, "-e", "const { fork } = require('child_process');"],
timeout=10,
kill=True,
)
# cleanup
common.remove_file(masquerade)
if __name__ == "__main__":
exit(main())