Skip to content

Commit 3d9a673

Browse files
authored
Merge pull request #1008 from splunk/ZachTheSplunker-mitre-caldera
Zach the splunker mitre caldera
2 parents 80e9389 + 116bb82 commit 3d9a673

31 files changed

+440
-16
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ python attack_range.py replay --file_name attack_data/dump.log --source test --s
162162
* Preconfigured Kali Linux machine for penetration testing
163163
* ssh connection over configured ssh key
164164

165+
- [Caldera](https://github.com/mitre/caldera)
166+
* Attack Simulation with [Caldera](https://github.com/mitre/caldera)
167+
* Can be enabled, disabled and configured over [attack_range.yml](https://github.com/splunk/attack_range/blob/develop/attack_range.yml)
168+
165169

166170
## Support 📞
167171
Please use the [GitHub issue tracker](https://github.com/splunk/attack_range/issues) to submit bugs or request features.
@@ -199,4 +203,5 @@ We welcome feedback and contributions from the community! Please see our [contri
199203
* Eric McGinnis
200204
* [Micheal Haag](https://twitter.com/M_haggis)
201205
* Gowthamaraj Rajendran
202-
* [Christopher Caldwell](https://github.com/cudgel)
206+
* [Christopher Caldwell](https://github.com/cudgel)
207+
* [Zachary Christensen](https://github.com/ZachTheSplunker)

attack_range.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

configs/attack_range_default.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ windows_servers_default:
209209
# Install Bad Blood by setting this to 1 or 0.
210210
# More information in chapter Bad Blood under Attack Range Features.
211211

212+
install_caldera_agent: "0"
213+
# Install a MITRE Caldera agent that connects to the Caldera Server.
214+
212215
install_crowdstrike: "0"
213216
# Install CrowdStrike Falcon by setting this to 1.
214217

@@ -252,6 +255,9 @@ linux_servers_default:
252255
cisco_secure_endpoint_linux_agent: "amp_Server_ubuntu-20-04-amd64.deb"
253256
# Name of the Cisco Secure Endpoint Linux Agent stored in apps/ folder.
254257

258+
install_caldera_agent: "0"
259+
# Install a MITRE Caldera agent that connects to the Caldera Server.
260+
255261
kali_server:
256262
kali_server: "0"
257263
# Enable Kali Server by setting this to 1.
@@ -277,6 +283,34 @@ snort_server:
277283
snort_server: "0"
278284
# Enable Snort Server by setting this to 1.
279285

286+
caldera_server:
287+
caldera_server: "0"
288+
# Enable MITRE Caldera Server by setting this to 1.
289+
290+
hostname: "caldera"
291+
# Specify the image used for Caldera Server.
292+
293+
# ------ Changing below this line could break MITRE Caldera -------------- #
294+
295+
caldera_version: ""
296+
# MITRE Caldera Version to install (https://github.com/mitre/caldera/releases). Default: (left blank to pull latest)
297+
# caldera_version: "--branch 5.0.0"
298+
299+
go_version: "1.23.3"
300+
# GO version to install (https://go.dev/dl/).
301+
302+
nvm_version: "0.40.1"
303+
# NVM version to install (https://github.com/nvm-sh/nvm/releases).
304+
305+
node_version: "22"
306+
# Node version to install (https://nodejs.org/en/download/package-manager).
307+
308+
upx_version: "4.2.4"
309+
# UPX version to install (https://github.com/upx/upx/releases).
310+
311+
private_ip: "10.0.1.70"
312+
# internal ip for the Caldera server (used for agent communication - no need to change).
313+
280314
simulation:
281315
atomic_red_team_repo: redcanaryco
282316
# Specify the repository owner for Atomic Red Team.

modules/aws_controller.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ def show(self) -> None:
327327
+ "\n\tusername: ubuntu \n\tpassword: "
328328
+ self.config["general"]["attack_range_password"]
329329
)
330+
elif instance_name.startswith("ar-caldera"):
331+
messages.append(
332+
"\nAccess Caldera via:\n\tWeb > http://"
333+
+ instance["NetworkInterfaces"][0]["Association"]["PublicIp"]
334+
+ ":8888"
335+
+ "\n\tusername: red \n\tpassword: "
336+
+ self.config["general"]["attack_range_password"]
337+
+ "\n\tSSH > ssh -i"
338+
+ self.config["aws"]["private_key_path"]
339+
+ " admin@"
340+
+ instance["NetworkInterfaces"][0]["Association"][
341+
"PublicIp"
342+
]
343+
)
330344
else:
331345
response.append(
332346
[instance["Tags"][0]["Value"], instance["State"]["Name"]]

modules/config_handler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def read_config(self, config_path: str) -> dict:
2929
"simulation",
3030
"zeek_server",
3131
"snort_server",
32+
"caldera_server",
3233
]
3334

3435
for parent_key in parent_keys:
@@ -149,3 +150,10 @@ def validate_config(self, config: dict) -> None:
149150
"ERROR: You can not use a phantom server or bring your own phantom when you use a bring your own splunk."
150151
)
151152
sys.exit(1)
153+
154+
if (
155+
config["caldera_server"]["caldera_server"] == "1"
156+
and config["general"]["cloud_provider"] == "azure"
157+
):
158+
print("ERROR: Caldera Server not supported in Azure.")
159+
sys.exit(1)

modules/configuration.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,13 @@ def new(config):
442442
"when": lambda answers: answers["windows_server_one"]
443443
and answers["windows_server_one_dc"],
444444
},
445+
{
446+
"type": "confirm",
447+
"message": "should we install a MITRE Caldera agent on the windows server",
448+
"name": "windows_server_one_caldera_agent",
449+
"default": False,
450+
"when": lambda answers: answers["windows_server_one"],
451+
},
445452
]
446453

447454
answers = questionary.prompt(questions)
@@ -463,6 +470,8 @@ def new(config):
463470
if "windows_server_one_bad_blood" in answers:
464471
if answers["windows_server_one_bad_blood"]:
465472
configuration["windows_servers"][0]["bad_blood"] = "1"
473+
if answers["windows_server_one_caldera_agent"]:
474+
configuration["windows_servers"][0]["install_caldera_agent"] = "1"
466475

467476
questions = [
468477
{
@@ -493,6 +502,13 @@ def new(config):
493502
"default": False,
494503
"when": lambda answers: answers["windows_server_two"],
495504
},
505+
{
506+
"type": "confirm",
507+
"message": "should we install a MITRE Caldera agent on the windows server",
508+
"name": "windows_server_two_caldera_agent",
509+
"default": False,
510+
"when": lambda answers: answers["windows_server_two"],
511+
},
496512
]
497513

498514
answers = questionary.prompt(questions)
@@ -510,6 +526,8 @@ def new(config):
510526
configuration["windows_servers"][1]["join_domain"] = "1"
511527
if answers["windows_server_two_red_team_tools"]:
512528
configuration["windows_servers"][1]["install_red_team_tools"] = "1"
529+
if answers["windows_server_two_caldera_agent"]:
530+
configuration["windows_servers"][1]["install_caldera_agent"] = "1"
513531

514532
questions = [
515533
{
@@ -518,6 +536,13 @@ def new(config):
518536
"name": "linux_server",
519537
"default": False,
520538
},
539+
{
540+
"type": "confirm",
541+
"message": "should we install a MITRE Caldera agent on the linux server",
542+
"name": "linux_server_caldera_agent",
543+
"default": False,
544+
"when": lambda answers: answers["linux_server"],
545+
},
521546
{
522547
"type": "confirm",
523548
"message": "shall we build a kali linux machine",
@@ -558,6 +583,13 @@ def new(config):
558583
"name": "phantom_installer",
559584
"when": lambda answers: answers["phantom"],
560585
},
586+
{
587+
"type": "confirm",
588+
"message": "shall we build a MITRE Caldera server for attack simulation",
589+
"name": "caldera_server",
590+
"default": False,
591+
"when": lambda answers: configuration["general"]["cloud_provider"] == "aws",
592+
},
561593
]
562594

563595
answers = questionary.prompt(questions)
@@ -569,6 +601,9 @@ def new(config):
569601
"hostname": "ar-linux",
570602
}
571603
)
604+
if "linux_server_caldera_agent" in answers:
605+
if answers["linux_server_caldera_agent"]:
606+
configuration["linux_servers"][0]["install_caldera_agent"] = "1"
572607

573608
if configuration["general"]["cloud_provider"] == "aws":
574609
if answers["kali_machine"]:
@@ -586,6 +621,10 @@ def new(config):
586621
if answers["snort_server"]:
587622
configuration["snort_server"] = dict()
588623
configuration["snort_server"]["snort_server"] = "1"
624+
625+
if answers["caldera_server"]:
626+
configuration["caldera_server"] = dict()
627+
configuration["caldera_server"]["caldera_server"] = "1"
589628

590629
if answers["phantom"]:
591630
configuration["phantom_server"] = dict()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- hosts: all
2+
gather_facts: false
3+
become: false
4+
vars:
5+
caldera_server_action: "install"
6+
roles:
7+
- caldera_server
8+

terraform/ansible/linux_server.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
- splunk_byo_linux
1515
- contentctl
1616
- crowdstrike_falcon_agent_linux
17-
- cisco_secure_endpoint_linux
17+
- cisco_secure_endpoint_linux
18+
- role: caldera_agent
19+
vars:
20+
caldera_agent_server_type: "linux"
21+
when: caldera_server.caldera_server == "1" and linux_servers.install_caldera_agent == "1"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- name: Install Linux Agent [Caldera Agent]
3+
ansible.builtin.shell: >
4+
server="http://{{ caldera_server.private_ip }}:8888";agent=$(curl -svkOJ -X POST -H "file:sandcat.go" -H "platform:linux" $server/file/download 2>&1 | grep -i "Content-Disposition" | grep -io "filename=.*" | cut -d'=' -f2 | tr -d '"\r') && chmod +x $agent 2>/dev/null;nohup ./$agent -server $server &
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Install on Windows [Caldera Agent]
3+
ansible.builtin.import_tasks: windows.yml
4+
when: caldera_agent_server_type == "windows"
5+
6+
- name: Install on Linux [Caldera Agent]
7+
ansible.builtin.import_tasks: linux.yml
8+
when: caldera_agent_server_type == "linux"

0 commit comments

Comments
 (0)