AI Pentesting

Red Team vs Blue Team vs Purple Team: Roles, Exercises and Metrics

Amartya | CodeAnt AI Code Review Platform
Sonali Sood

Founding GTM, CodeAnt AI

A purple team is the practice of red and blue teams working together in the open, one attack technique at a time, so every simulated attack turns into a tested detection.

The red team emulates adversaries. The blue team defends and responds. The purple team joins the two so offensive findings become measurable defensive improvements.

That is the whole red team vs blue team question in brief. One side attacks, one side defends, and purple is how they stop keeping score against each other and start fixing things.

What CodeAnt AI solves here: Purple work needs real attack input. CodeAnt AI proves which weaknesses in your exposed apps and APIs are exploitable, with the root cause attached, so defenders work from actual attack data.

Here is the three-way comparison in one place.

Attribute

Red team

Blue team

Purple team

Mission

Emulate a real adversary to reach an objective

Prevent, detect and respond to attacks

Turn attack results into working detections and controls

Mindset

“How would I get in and stay in?”

“What is normal, and what just changed?”

“Did we see that technique, and how do we see it next time?”

Typical activities

Reconnaissance, initial access, privilege escalation, lateral movement, objective-driven operations

Monitoring, alert triage, incident response, hardening, threat hunting

Joint exercises, technique-by-technique replay, detection tuning, retesting

Skills

Offensive tradecraft, social engineering, scripting, infrastructure

Log analysis, detection engineering, forensics, incident handling

Both sides’ context plus facilitation and measurement

Tool categories

Adversary emulation and C2 frameworks, recon tooling, phishing platforms

SIEM, EDR, cloud audit logs, SOAR, identity monitoring

ATT&CK mapping, emulation plans, exercise tracking, detection-as-code

Outputs

Attack narrative, compromised path, timestamped actions

Alerts, incident reports, hardened configs

Coverage map, new or tuned detections, retest evidence

Metrics

Objectives reached, time to objective, actions undetected

Mean time to detect and respond, alert quality

Detection coverage by technique, change in coverage over time

The pattern in the last row matters most. Red and blue each measure their own side. Only purple measures the gap between them.

To see whether your public apps and APIs already give an attacker that first step, is this true for my app? Run a free outside-in pentest.

What Is Red Team and Blue Team in Cyber Security

The NIST glossary carries the CNSSI 4009-2022 definition of a red team as “a group of people authorized and organized to emulate a potential adversary’s attack or exploitation capabilities.”

The same glossary defines the blue team as “the group responsible for defending an enterprise’s use of information systems by maintaining its security posture.” That blue team definition adds a useful detail. The defense happens against a mock attacking group, in a realistic setting, under rules set with a neutral white team.

A second NIST definition describes blue teams that run operational vulnerability evaluations and recommend mitigations, often before a red team test. Both senses show up in practice.

What the red team brings

A red team brings the attacker’s view. It chooses a target, finds a path, avoids detection and documents every move. Our guide on what is red teaming covers how those engagements run.

What the blue team brings

The blue team brings knowledge of the environment. It knows which logs exist, which alerts are noisy and which systems nobody has looked at in a year. The two roles map closely to the split in defensive vs offensive security. Each is incomplete alone.

What Is a Purple Team in Cyber Security

A purple team is usually a function that existing people perform. It can be a standing group, a recurring meeting or a role a detection engineer plays for a week each quarter. The key change is visibility. In a red team engagement, defenders do not know what is coming. In a purple exercise, everyone sees each technique as it runs.

That trade can feel like handing out the answers. You give up the “would we catch it cold?” verdict and gain many small, fixable findings per day. Regulators use the idea too. The ECB’s TIBER-EU framework applies purple-teaming guidance during the testing or closure phase of a red team test.

SCYTHE publishes the Purple Team Exercise Framework (PTEF), an open standard for planning, executing and measuring adversary emulation exercises across red and blue teams.

Purple teaming vs a red team debrief

A red team debrief tells you what you missed. A purple exercise fixes what you missed while the attacker is still in the room. The two fit in sequence. Run a red team to learn your blind spots under realistic pressure, then run purple exercises to close them and prove they stay closed.

How a Purple Team Exercise Actually Runs

A purple team exercise follows a loop of five steps. Each technique moves through it before the next one starts.

Plan around ATT&CK techniques

Start with a short list of techniques, picked from threat intelligence or from your own recent findings. Five to ten techniques is a workable day.

Describe each one using MITRE ATT&CK, which lists 15 Enterprise tactics in v20. A shared ID means red and blue are talking about the same behavior. The MITRE Center for Threat-Informed Defense publishes micro emulation plans for compound behaviors seen across many adversaries. They make good starting scripts.

ATT&CK technique pages now include detection strategies too. The Exploit Public-Facing Application (T1190) page lists one that correlates the request, the error and the follow-on process or egress. Our MITRE ATT&CK framework guide explains how to read tactics, techniques and those detection entries.

Execute

The red side runs one technique, in a controlled way, and announces the time. Everyone knows what is happening and when. For a SaaS company, that might mean testing a known-exploitable endpoint, attempting password guessing against a login, or using a test cloud credential in an unusual way.

Detect

The blue side checks three layers in order. Was telemetry captured? Did an alert fire? Did a person or playbook act on it? The answer often differs per layer. Logs exist, no alert fires, and the dashboard looks calm. That gap is the reason purple exercises exist.

Tune

Both sides write or adjust the detection on the spot. The red side reruns variations to check the rule is specific enough to fire without drowning the SOC. Record the owner and the change. A detection without an owner tends to break quietly within a quarter.

Retest

Rerun the same technique days or weeks later, ideally without warning the person on call. If it still fires and gets handled, mark it covered. Retest is the easiest step to drop, and the one that turns a workshop into a program.

A worked exercise sheet for a SaaS stack

The sheet below shows how a purple team might record one exercise against a typical cloud-hosted product. Technique names and IDs come from ATT&CK.

Technique (ATT&CK)

Expected telemetry

Logged?

Alerted?

Responded?

Action

Exploit Public-Facing Application (T1190)

WAF and app logs, error spikes, new outbound connections

Yes

No

No

Correlate request, error and egress into one alert

Brute Force (T1110)

Auth failures by source and account

Yes

Yes

Partly

Route to on-call, add lockout review

Valid Accounts, Cloud Accounts (T1078.004)

Cloud audit logs, new region or API pattern for an identity

Partly

No

No

Enable missing audit trail, baseline per role

Exfiltration Over Web Service (T1567)

Egress logs to file-sharing or webhook destinations

No

No

No

Add egress logging before writing any rule

Read each row left to right. Every “No” in the logging column blocks the columns after it, so telemetry gaps come first.

How Small SaaS Teams Run Purple Exercises Without a Full Red Team

A five-person security team rarely has in-house red operators. The red input can come from somewhere else, as long as it is real and specific.

Continuous pentesting findings are the most useful source. Each exploit-proven finding is a technique that worked against your own stack, with a timestamp you can look up. CodeAnt AI tests exposed apps and APIs from the outside on an ongoing basis. Each finding comes with evidence and its root cause in code, cloud or internal systems.

For a blue team, that changes the question. Instead of asking whether someone could exploit a weakness, it asks what the logs recorded at the exact minute the weakness was exploited.

A lightweight monthly loop looks like this:

  1. Pick: Take two or three exploit-proven findings from the last pentest cycle.

  2. Map: Tag each with its ATT&CK technique. Our guides on initial access and lateral movement help with the common ones.

  3. Look back: Check telemetry, alerts and response at the time the test ran.

  4. Fix both sides: Patch the root cause and add the missing detection, so the next variant is caught even if a new bug appears.

  5. Retest: Confirm the fix and the detection in the next cycle.

Automated tools can add volume. Our comparison of breach and attack simulation vs penetration testing covers where each fits as red input.

Purple Team Metrics That Show Progress

Good metrics are boring to compute and hard to game. The ones below hold up in a quarterly review.

Metric

How to compute it

Common trap

Detection coverage by technique

Techniques tested that were logged, alerted and responded to, divided by techniques tested

Counting “logged” as “covered”

Mean time to detect (MTTD)

Time from the red action to the first alert, averaged across techniques

Measuring from when the analyst saw the alert instead of when it fired

Mean time to respond

Time from the alert to containment or a documented decision

Stopping the clock at ticket creation

Retest pass rate

Previously fixed techniques that still fire on rerun

Skipping retests, which hides decay

Telemetry gaps closed

Techniques moved from “not logged” to “logged” this period

Adding logs nobody queries

The coverage number is the headline. MTTD and retest pass rate tell you whether it is real.

PTEF suggests replacing pass and fail with graded outcome scores from 0 (no visibility) to 5 (automated, tuned response). That scale is useful when a binary covered column hides partial wins.

Common Purple Team Failure Modes

These patterns turn a purple program into a calendar invite.

  • Coverage theater: Testing only techniques you already detect. The coverage chart goes up and nothing improves.

  • Telemetry denial: Writing detection rules for data you do not collect. Check the logging column first.

  • Red input from a generic list: Running the same technique library every quarter, unrelated to your stack or your real findings.

  • No retest: Detections drift as log formats, cloud services and agents change. Unretested coverage is a guess.

  • One-sided fixes: Patching the bug without adding a detection, or adding a detection without fixing the root cause.

  • Blame sessions: If the blue team feels graded, it will stop volunteering what it missed.

A purple exercise that ends with everyone agreeing all is well has likely tested the wrong things.

Who Owns What in a SaaS Security Team

Small teams do not need three separate groups. They need clear owners for three kinds of work.

Stage

Red input

Blue ownership

Purple cadence

Early, no SOC

Continuous or periodic pentesting

Engineering on-call plus cloud provider alerts

A light quarterly review of top findings

Growing, managed detection

Continuous pentesting plus occasional objective-based tests

Managed provider with an internal owner

Monthly exercise on recent exploit-proven findings

Mature, in-house SOC

External red team engagements plus continuous testing

Internal SOC and detection engineering

Standing purple function with retest tracking

The takeaway is that purple work starts early. You do not need a red team to run it, only real attack data and someone who owns detection.

Where This Leaves You

Red finds the path, blue holds the line, and purple makes sure each lesson becomes a detection that still works next quarter. You can start purple work with what you already have. Take your most recent exploit-proven findings, check what your logs saw, and fix both the bug and the blind spot.

Try it on your app: Run a free scan and get a pentest report in 48 hours, or book a pentest. Want to see the output first? Open the sample report.

FAQs

What is a purple team in cyber security?

What is the difference between red team and blue team?

Do you need a red team to do purple teaming?

How often should you run a purple team exercise?

What metrics matter for a purple team?

Start Your 14-Day Free Trial

AI code reviews, security and quality trusted by modern engineering teams.

Table of Content
No headings found on page

Ship clean & secure code faster

Get Pentest Report

NO CC REQUIRED