Improving Red Team Maturity Through Red Team as Code
Where
Talks
ShmooCon 2024
Duration
21 min
Shows how a red team can use infrastructure-as-code ideas and a scriptable C2 framework to improve repeatability and onboarding.
Summary
The speaker, a red teamer who has played in collegiate red-versus-blue competitions, describes how hand-built bash one-liners struggled to compromise a large environment in minutes. From those events he identifies four problems that also apply to real engagements: reliability at high callback volume, repeatability for training and detection testing, onboarding of new team members, and speed.
He proposes using infrastructure-as-code tooling as a command-and-control layer and reports three years of running Ansible this way. Its strengths were scale, rerunnable discrete tasks, readable YAML that documents itself, and version history that shows how techniques changed from year to year. The drawbacks were heavy logging artifacts, a need for remote management services and credentials that an attacker rarely holds, and weak support for in-memory execution. To address these, he presents Realm, a C2 framework whose Rust agent embeds a Python-like interpreter. Techniques are written as scripts that can be tested locally, uploaded through a GraphQL API, and tasked to beacons. Logging records who ran what and when, the server is stateless on a managed database, and finished scripts can be exported as standalone test cases for detection engineers.
The live demo built a script that enumerates user home directories and collects private SSH keys. The speaker notes that it would need hardening before production use. The takeaway for practitioners is that encoding techniques as versioned, reusable code can make red team operations more repeatable, easier to hand off, and easier to validate against detections. The project is open for anyone to find on GitHub.
Related talks
Track 3·56 min
pr0b3r7 · Josh Huff
Shows how a red team deploys, configures and secures C2 infrastructure, and automates it with infrastructure as code.
Talks·53 min
Ezra Woods
Shows how kiosks and presented apps can be escaped to reach the host, with Windows, ChromeOS and Citrix examples.
Talks·49 min
Nicholas Popovich · Mike Bailey
Shows how misconfigured ServiceNow deployments enable privilege escalation and code execution, and how defenders can detect them.


