Skip to content

Commit a6ed2a8

Browse files
authored
Merge branch 'main' into rule-tuning-windows-process-termination-followed-by-deletion
2 parents c8d9328 + 1278c27 commit a6ed2a8

File tree

237 files changed

+3746
-1281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+3746
-1281
lines changed

detection_rules/etc/version.lock.json

Lines changed: 1547 additions & 494 deletions
Large diffs are not rendered by default.

detection_rules/schemas/definitions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,11 @@ def validator(value):
247247
'geo_point', 'geo_shape', 'point', 'shape',
248248
'percolator'
249249
]
250+
251+
# definitions for the integration to index mapping unit test case
252+
IGNORE_IDS = ["eb079c62-4481-4d6e-9643-3ca499df7aaa", "699e9fdb-b77c-4c01-995c-1c15019b9c43",
253+
"0c9a14d9-d65d-486f-9b5b-91e4e6b22bd0", "a198fbbd-9413-45ec-a269-47ae4ccf59ce",
254+
"0c41e478-5263-4c69-8f9e-7dfd2c22da64", "aab184d3-72b3-4639-b242-6597c99d8bca",
255+
"a61809f3-fb5b-465c-8bff-23a8a068ac60", "f3e22c8b-ea47-45d1-b502-b57b6de950b3"]
256+
IGNORE_INDICES = ['.alerts-security.*', 'logs-*', 'metrics-*', 'traces-*', 'endgame-*',
257+
'filebeat-*', 'packetbeat-*', 'auditbeat-*', 'winlogbeat-*']
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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="8c634401-fd71-475e-b449-41b776b2b8c9",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "Network Connection by Foomatic-rip Child",
16+
"rule_id": "93d7b72d-3914-44fb-92bf-63675769ef12",
17+
},
18+
],
19+
techniques=["T1203"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
# Path for the fake motd executable
26+
masquerade = "/tmp/foomatic-rip"
27+
source = common.get_path("bin", "netcon_exec_chain.elf")
28+
29+
common.log("Creating a fake motd executable..")
30+
common.copy_file(source, masquerade)
31+
common.log("Granting execute permissions...")
32+
common.execute(["chmod", "+x", masquerade])
33+
34+
# Execute the fake motd executable
35+
common.log("Executing the fake motd executable..")
36+
commands = [masquerade, "chain", "-h", "8.8.8.8", "-p", "53", "-c", "/tmp/foomatic-rip netcon -h 8.8.8.8 -p 53"]
37+
common.execute([*commands], timeout=5, kill=True)
38+
39+
# Cleanup
40+
common.remove_file(masquerade)
41+
42+
43+
if __name__ == "__main__":
44+
sys.exit(main())
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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="b3c8c616-15a5-45fd-970a-c44c18e59578",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "File Downloaded via Curl or Wget to Hidden Directory",
16+
"rule_id": "dc1cee03-4923-4c6b-b00b-8a5c323bb753",
17+
},
18+
],
19+
techniques=["T1564"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
common.log("Creating a fake executable..")
26+
masquerade = "/tmp/curl"
27+
28+
source = common.get_path("bin", "linux.ditto_and_spawn")
29+
common.copy_file(source, masquerade)
30+
common.log("Granting execute permissions...")
31+
common.execute(["chmod", "+x", masquerade])
32+
33+
commands = [masquerade, "--output", "/dev/shm/evil"]
34+
common.execute([*commands], timeout=5, kill=True)
35+
common.log("Cleaning...")
36+
common.remove_file(masquerade)
37+
common.log("Simulation successfull!")
38+
39+
40+
if __name__ == "__main__":
41+
sys.exit(main())

rta/linux_command_and_control_ip_address_arg_from_hidden_executable.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ def main() -> None:
3131

3232
commands = [masquerade, "netcon", "-h", "8.8.8.8", "-p", "53"]
3333
common.execute([*commands], timeout=5, kill=True)
34+
3435
common.log("Cleaning...")
36+
3537
common.remove_file(masquerade)
38+
3639
common.log("Simulation successfull!")
3740

3841

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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="1843a19e-1016-4784-a175-e9fdf26f4b8f",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "Shared Object Load via LoLBin",
16+
"rule_id": "42c2e98b-b757-423f-ac25-8183d8c76b97",
17+
},
18+
],
19+
techniques=["T1218", "T1574", "T1059"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
common.log("Creating a fake executable..")
26+
masquerade = "/tmp/gdb"
27+
28+
source = common.get_path("bin", "linux.ditto_and_spawn")
29+
common.copy_file(source, masquerade)
30+
common.log("Granting execute permissions...")
31+
common.execute(["chmod", "+x", masquerade])
32+
33+
commands = [masquerade, "cdll.LoadLibrary.so"]
34+
common.execute([*commands], timeout=5, kill=True)
35+
common.log("Cleaning...")
36+
common.remove_file(masquerade)
37+
common.log("Simulation successfull!")
38+
39+
40+
if __name__ == "__main__":
41+
sys.exit(main())
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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="4e6ded7e-23cb-460c-8a5b-21c5e5e8d6e8",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "Potential Process Masquerading via Exec",
16+
"rule_id": "e6669bc3-cb75-4fb3-91e0-ddaa06dd59b2",
17+
},
18+
],
19+
techniques=["T1564", "T1059"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
common.log("Creating a fake executable..")
26+
masquerade = "[foo]"
27+
masquerade2 = "/tmp/sh"
28+
29+
source = common.get_path("bin", "linux.ditto_and_spawn")
30+
common.copy_file(source, masquerade)
31+
common.log("Granting execute permissions...")
32+
common.execute(["chmod", "+x", masquerade])
33+
34+
source = common.get_path("bin", "linux.ditto_and_spawn")
35+
common.copy_file(source, masquerade2)
36+
common.log("Granting execute permissions...")
37+
common.execute(["chmod", "+x", masquerade2])
38+
39+
commands = [masquerade2, masquerade]
40+
common.execute([*commands], timeout=5, kill=True)
41+
common.log("Cleaning...")
42+
common.remove_file(masquerade)
43+
common.remove_file(masquerade2)
44+
common.log("Simulation successfull!")
45+
46+
47+
if __name__ == "__main__":
48+
sys.exit(main())
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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="fa40fdc4-23bf-491c-bc55-6a6848c5b6da",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "Potential Proxy Execution via Crash",
16+
"rule_id": "995c8bdb-5ebb-4c5b-9a03-4d39b52c0ff3",
17+
},
18+
],
19+
techniques=["T1218", "T1059"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
common.log("Creating a fake executable..")
26+
masquerade = "/tmp/crash"
27+
masquerade2 = "/tmp/sh"
28+
29+
source = common.get_path("bin", "linux.ditto_and_spawn")
30+
common.copy_file(source, masquerade)
31+
common.log("Granting execute permissions...")
32+
common.execute(["chmod", "+x", masquerade])
33+
34+
source = common.get_path("bin", "linux.ditto_and_spawn")
35+
common.copy_file(source, masquerade2)
36+
common.log("Granting execute permissions...")
37+
common.execute(["chmod", "+x", masquerade2])
38+
39+
commands = [masquerade, "-h", masquerade, "-c", "whoami"]
40+
common.execute([*commands], timeout=5, kill=True)
41+
common.log("Cleaning...")
42+
common.remove_file(masquerade)
43+
common.remove_file(masquerade2)
44+
common.log("Simulation successfull!")
45+
46+
47+
if __name__ == "__main__":
48+
sys.exit(main())
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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="e2a136e5-bda1-41c4-8143-514c0b0784c4",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "System Binary Proxy Execution via ld.so",
16+
"rule_id": "10cb6563-35a9-45b7-a394-e7bca6fd5bed",
17+
},
18+
],
19+
techniques=["T1218", "T1059"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
common.log("Creating a fake executable..")
26+
masquerade = "/lib/ld-linux-foo.so"
27+
masquerade2 = "/tmp/sh"
28+
29+
source = common.get_path("bin", "linux.ditto_and_spawn")
30+
common.copy_file(source, masquerade)
31+
common.log("Granting execute permissions...")
32+
common.execute(["chmod", "+x", masquerade])
33+
34+
source = common.get_path("bin", "linux.ditto_and_spawn")
35+
common.copy_file(source, masquerade2)
36+
common.log("Granting execute permissions...")
37+
common.execute(["chmod", "+x", masquerade2])
38+
39+
commands = [masquerade, masquerade, "-c", "whoami"]
40+
common.execute([*commands], timeout=5, kill=True)
41+
common.log("Cleaning...")
42+
common.remove_file(masquerade)
43+
common.remove_file(masquerade2)
44+
common.log("Simulation successfull!")
45+
46+
47+
if __name__ == "__main__":
48+
sys.exit(main())
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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="4b186cd2-eebf-4a93-b85d-ba3b3746bf50",
12+
platforms=["linux"],
13+
endpoint=[
14+
{
15+
"rule_name": "Potential Proxy Execution via PHP",
16+
"rule_id": "dd914805-e99b-4ff6-b445-775c53d44e10",
17+
},
18+
],
19+
techniques=["T1218", "T1059"],
20+
)
21+
22+
23+
@common.requires_os(*metadata.platforms)
24+
def main() -> None:
25+
common.log("Creating a fake executable..")
26+
masquerade = "/tmp/php"
27+
masquerade2 = "/tmp/sh"
28+
29+
source = common.get_path("bin", "linux.ditto_and_spawn")
30+
common.copy_file(source, masquerade)
31+
common.log("Granting execute permissions...")
32+
common.execute(["chmod", "+x", masquerade])
33+
34+
source = common.get_path("bin", "linux.ditto_and_spawn")
35+
common.copy_file(source, masquerade2)
36+
common.log("Granting execute permissions...")
37+
common.execute(["chmod", "+x", masquerade2])
38+
39+
commands = [masquerade, "-r", masquerade2, "-c", "whoami"]
40+
common.execute([*commands], timeout=5, kill=True)
41+
common.log("Cleaning...")
42+
common.remove_file(masquerade)
43+
common.remove_file(masquerade2)
44+
common.log("Simulation successfull!")
45+
46+
47+
if __name__ == "__main__":
48+
sys.exit(main())

0 commit comments

Comments
 (0)