TExcelTAD

Red, Blue and Purple Teams

A company buys a penetration test every year. Each time the report lists fifteen findings, the IT team fixes them, and the next year's report lists fifteen different ones. Meanwhile nobody has checked whether the security operations centre would actually notice any of the testers' activity. The testers worked for two weeks; the logs recorded everything; no alert fired. The company has paid twice for a picture of its weaknesses and still doesn't know if it can detect an attack.

This lesson sorts out the roles that offensive and defensive security people play, how their kinds of assessment differ, and the purple-team way of working that closes exactly that gap. The roadmap's own framing is the reason this track has both sides: understand how attackers find and use weaknesses, within authorised environments, so that you can detect and stop them.

The colours

red teamemulates attackers blue teamdetects, responds purple: togetherone technique at a time run technique -> did we log it? alert? respond? -> tune detection -> run it again shared language: MITRE ATT&CK technique IDs
Team Goal Typical people and work
Red Show how a real adversary would reach a business goal, and whether the organisation notices Red-team operators: goal-oriented, stealthy campaigns over weeks, often including phishing and physical access, under a written authorisation
Blue Prevent, detect and respond SOC analysts, detection engineers, incident responders, threat hunters, system and network engineers who harden; see Defensive Security
Purple Make red's knowledge improve blue's detection Not always a separate team: a way of working where both sit together, run techniques one by one and fix the gaps immediately

Other colours appear in some organisations (white for the group that sets rules of engagement and referees an exercise, yellow for builders, green and orange for teaching builders about defence and attack), but red, blue and purple are the ones you will meet everywhere.

Three kinds of offensive assessment

People mix these up constantly, and buying the wrong one is how the company in the opening wasted its money.

Vulnerability assessment Penetration test Red-team exercise
Question Which known weaknesses exist? Can these weaknesses be used, and how far do they lead? Could a realistic adversary reach this goal, and would we detect and stop them?
Scope Broad: every host in a range Defined systems or an application A goal ("read the payroll database"), many paths allowed
Method Mostly automated scanning, then triage Manual testing with tools, depth over breadth Stealthy, slow, adversary emulation
Defenders told? Yes Usually yes Only a few people ("white cell")
Output List of findings with severity Findings with proof and attack paths A narrative of the campaign, and how detection and response performed

All three need the same paperwork first: written authorisation and a scope, which is the subject of authorization and scope. The methodology of the middle column is taught in Ethical Hacking & Penetration Testing.

The shared language: MITRE ATT&CK

To compare what red did with what blue saw, both need the same names for attacker behaviour. MITRE ATT&CK is a public knowledge base of adversary tactics (the goal of a step, such as Initial Access, Privilege Escalation, Exfiltration) and techniques (how it is achieved), each with an ID: T1110 Brute Force, T1566 Phishing, T1059 Command and Scripting Interpreter, T1078 Valid Accounts. Many techniques have sub-techniques (T1110.003 Password Spraying). Detection rules, threat reports and test plans tagged with these IDs can be joined like tables.

A purple-team exercise as data

In a purple exercise, the red side runs each planned technique in the lab or an agreed test environment, and the blue side records for each one what happened: logged (the evidence exists in the SIEM), alerted (a rule fired) or missed. The results below are synthetic, from an exercise of ten techniques:

python · try it yourself
import pandas as pd

results = pd.DataFrame([
    ("T1566", "Phishing", "Initial Access", "alerted"),
    ("T1190", "Exploit Public-Facing Application", "Initial Access", "logged"),
    ("T1078", "Valid Accounts", "Initial Access", "missed"),
    ("T1059", "Command and Scripting Interpreter", "Execution", "alerted"),
    ("T1053", "Scheduled Task/Job", "Persistence", "logged"),
    ("T1548", "Abuse Elevation Control Mechanism", "Privilege Escalation", "alerted"),
    ("T1110", "Brute Force", "Credential Access", "alerted"),
    ("T1003", "OS Credential Dumping", "Credential Access", "missed"),
    ("T1021", "Remote Services", "Lateral Movement", "logged"),
    ("T1486", "Data Encrypted for Impact", "Impact", "alerted"),
], columns=["id", "technique", "tactic", "result"])

counts = results["result"].value_counts().reindex(["alerted", "logged", "missed"])
print(counts.to_string())
print(f"detection coverage (alerted): {counts['alerted'] / len(results):.0%}")
print(f"visibility (alerted or logged): {(counts['alerted'] + counts['logged']) / len(results):.0%}")

print("\nwork list:")
order = {"missed": 0, "logged": 1}
todo = results[results["result"] != "alerted"].sort_values("result", key=lambda s: s.map(order), kind="stable")
for row in todo.itertuples():
    action = "add a log source" if row.result == "missed" else "write a detection rule"
    print(f"  {row.id:6} {row.technique:34} {row.result:7} -> {action}")
result
alerted    5
logged     3
missed     2
detection coverage (alerted): 50%
visibility (alerted or logged): 80%

work list:
  T1078  Valid Accounts                     missed  -> add a log source
  T1003  OS Credential Dumping              missed  -> add a log source
  T1190  Exploit Public-Facing Application  logged  -> write a detection rule
  T1053  Scheduled Task/Job                 logged  -> write a detection rule
  T1021  Remote Services                    logged  -> write a detection rule

The two numbers say different things. Visibility (80 %) is how often the evidence existed; detection coverage (50 %) is how often someone would have been told. The work list follows directly: a missed technique needs a new data source first (no rule can find what isn't logged), a logged one needs a rule. After tuning, the same techniques are run again: the retest is what makes it an exercise rather than a report.

Two cautions about such matrices. A technique counted as "alerted" was detected for the one way it was run; attackers have many variants, so mature teams test several procedures per technique. And coverage percentages invite gaming: ten easy techniques at 100 % say less than three hard ones at 33 %.

Detection and the fix, from the organisation's view

The "attack" in this lesson is an organisational one: buying assessments that don't improve defence. Its warning signs are recurring findings of the same class, test reports that never mention detection, and a SOC that learns about a penetration test from the final report. The fixes:

  • Choose the assessment for the question: a vulnerability assessment for hygiene, a penetration test for depth on a system, a red-team exercise only once basic detection exists.
  • Ask testers to log their actions with timestamps and ATT&CK IDs, so the blue team can compare minute by minute.
  • Run purple sessions after each test: replay the findings, check the logs, tune the rules, retest.
  • Track results over time by technique, not by finding.

Pitfalls

  • Red team as a trophy. A red team that "wins" every time without the blue team learning anything has failed its purpose. The deliverable is better defence.
  • Purple meaning "red with a nicer report". If blue is not in the room, it isn't purple.
  • Testing production without agreement. Some techniques (brute force, credential dumping) can lock accounts or crash services. Rules of engagement say which techniques are allowed where.
  • Confusing tactics and techniques. "Credential Access" is a goal; "OS Credential Dumping" is one way to reach it.

Practice

  1. After tuning, the exercise is rerun: T1078 and T1003 become logged, and T1053 and T1021 become alerted. What are the new coverage and visibility?
  2. A bank wants to know whether its SOC would notice an attacker who uses only stolen valid accounts. Which kind of assessment fits, and why?
Answers
  1. Alerted: 5 + 2 = 7 of 10, so coverage 70 %. Logged: T1190, T1078, T1003 = 3. Visibility 10 of 10 = 100 %.
  2. A red-team exercise (or a focused purple exercise on T1078), because the question is about detection of realistic, stealthy behaviour, not about finding vulnerabilities. A vulnerability scan would not even look at it.

Test yourself

What distinguishes a red-team exercise from a penetration test?

  1. Red teams don't need authorisation
  2. A red team pursues a goal stealthily to test detection and response; a penetration test finds and proves weaknesses in a defined scope
  3. Penetration tests are always automated
  4. There is no difference

In the exercise data, what was the detection coverage (techniques that raised an alert)?

  1. 30 %
  2. 50 %
  3. 80 %
  4. 100 %

A technique was 'missed': no evidence appeared anywhere. What is the first fix?

  1. Write a detection rule
  2. Add or enable the log source that would record it
  3. Ignore it
  4. Raise the alert threshold

What is T1110.003 in MITRE ATT&CK?

  1. A tactic
  2. A sub-technique (Password Spraying) of the Brute Force technique
  3. A CVE number
  4. A detection rule