Lesson 10 Blue Team Capstone: Full Defense Scenario
Theme:

Blue Team Capstone: Full Defense Scenario

Integrating every defensive discipline — log monitoring, network detection, malware analysis, hardening, firewalls, cryptography, vulnerability management, incident response, and digital forensics — into a cohesive security program backed by metrics, automation, and continuous improvement.

Recap: The Complete Defense Stack

Over the past nine lessons you have built individual defensive capabilities. Each lesson addressed a specific layer of the security stack. Taken together, they form a comprehensive defense-in-depth posture. Before we integrate them, let us review what each lesson contributed and map it to the defense-in-depth model:

Lesson Topic Defense-in-Depth Layer Key Capability
01Log Monitoring & SIEMVisibility / DetectionCentralized log collection, correlation, alerting
02Network IDS/IPSNetwork LayerSignature and anomaly-based network threat detection
03Malware DetectionEndpoint LayerStatic and dynamic malware analysis, YARA rules
04Security HardeningHost / ConfigurationCIS benchmarks, least privilege, attack surface reduction
05Firewalls & ACLsNetwork PerimeterTraffic filtering, segmentation, zone-based policies
06Secrets & CryptographyData LayerEncryption, key management, secrets rotation
07Vulnerability & Patch ManagementHost / ApplicationScanning, prioritization, patching workflows
08Incident ResponseProcess / OperationsIR plans, containment, eradication, recovery
09Digital ForensicsPost-Incident / LegalEvidence preservation, timeline reconstruction, attribution

No single layer is sufficient on its own. An attacker who bypasses the firewall (Lesson 05) may still be caught by the IDS (Lesson 02). If the IDS misses the intrusion, endpoint malware detection (Lesson 03) or log correlation (Lesson 01) provides additional chances to detect the threat. This layered redundancy is the essence of defense in depth.

Defense-in-Depth Architecture

Defense in depth is a security strategy that deploys multiple layers of controls so that if one layer fails, the next layer provides protection. The model originates from military doctrine and translates directly to information security:

A mature security program ensures that every layer is actively monitored, regularly tested, and continuously improved. Gaps in any layer should be identified through vulnerability assessments and addressed through the patch management workflow from Lesson 07.

SOC Operations: Tiers, Workflows, and Tooling

A Security Operations Center (SOC) is the organizational nerve center that ties all defensive layers together. SOCs typically operate with a tiered analyst structure:

Example SOC Triage Playbook

# SOC Playbook: Suspicious PowerShell Execution
name: powershell_suspicious_execution
trigger: SIEM alert - "Encoded PowerShell Command Detected"
severity: medium
tier: 1

steps:
  - action: verify_alert
    description: "Confirm the alert fired on a valid event, not a test"
    check: "Review raw log entry in SIEM for process command line"

  - action: check_context
    description: "Determine if this is expected behavior"
    checks:
      - "Is the host a developer workstation with known PS automation?"
      - "Is the user account a service account with scheduled tasks?"
      - "Does the encoded command decode to a known admin script?"

  - action: decode_payload
    command: "echo '' | base64 -d"
    description: "Decode the -EncodedCommand argument"

  - action: assess_risk
    escalate_if:
      - "Decoded payload contains Invoke-WebRequest or Net.WebClient"
      - "Payload attempts to disable Windows Defender"
      - "Execution source is a user mailbox or browser download"
      - "Host is a server, not a workstation"

  - action: escalate_or_close
    escalate_to: tier2
    close_if: "Activity matches documented automation baseline"

Detection Engineering

Detection engineering is the discipline of designing, writing, testing, and tuning detection rules that identify malicious activity while minimizing false positives. Good detection engineers think like attackers: they study TTPs (Tactics, Techniques, and Procedures) from the MITRE ATT&CK framework and write rules that target observable behaviors rather than specific IOCs (Indicators of Compromise), which change frequently.

Sigma Detection Rule Example

# Sigma rule: Detect credential dumping via LSASS memory access
title: LSASS Memory Access - Potential Credential Dumping
id: 5b2e1c4a-8f3d-4a7e-b012-9c6d3e8f1a2b
status: experimental
description: >
  Detects process access to lsass.exe memory, which may indicate
  credential dumping tools like Mimikatz, procdump, or comsvcs.dll.
logsource:
  category: process_access
  product: windows
detection:
  selection:
    TargetImage|endswith: '\lsass.exe'
    GrantedAccess|contains:
      - '0x1010'   # PROCESS_QUERY_LIMITED_INFORMATION + PROCESS_VM_READ
      - '0x1410'   # Above + PROCESS_QUERY_INFORMATION
      - '0x1FFFFF' # PROCESS_ALL_ACCESS
  filter_known:
    SourceImage|endswith:
      - '\wmiprvse.exe'
      - '\taskmgr.exe'
      - '\MsMpEng.exe'
  condition: selection and not filter_known
level: high
tags:
  - attack.credential_access
  - attack.t1003.001

Alert Tuning

Raw detection rules almost always produce false positives in production. Tuning is the iterative process of adding exclusions for known-good behavior, adjusting thresholds, and refining logic. A rule that fires 500 times per day with a 99% false positive rate is worse than useless — it trains analysts to ignore alerts. Effective tuning reduces noise while preserving detection of genuine threats.

Incident Response Coordination

When a confirmed incident occurs, the response requires coordinated action across multiple roles. The NIST incident response lifecycle (Preparation, Detection & Analysis, Containment & Eradication, Recovery, Post-Incident Activity) provides the framework, but execution depends on clear role assignments:

Escalation paths must be predefined: when does the SOC wake up the CISO? When does the organization engage external IR retainers or notify law enforcement? These decisions should never be improvised during a crisis.

Blue Team Metrics

You cannot improve what you do not measure. The following metrics quantify a blue team's effectiveness:

Metric Tracking Script

import json
from datetime import datetime, timedelta
from statistics import mean

def load_incidents(filepath):
    """Load incident records from a JSON file."""
    with open(filepath) as f:
        return json.load(f)

def compute_metrics(incidents):
    """Compute MTTD, MTTR, and false positive rate from incident records."""
    detect_times = []
    respond_times = []
    total_alerts = len(incidents)
    false_positives = 0

    for inc in incidents:
        if inc["classification"] == "false_positive":
            false_positives += 1
            continue

        # Parse timestamps
        compromise_time = datetime.fromisoformat(inc["compromise_time"])
        detect_time = datetime.fromisoformat(inc["detect_time"])
        contain_time = datetime.fromisoformat(inc["contain_time"])

        mttd = (detect_time - compromise_time).total_seconds() / 3600  # hours
        mttr = (contain_time - detect_time).total_seconds() / 3600     # hours

        detect_times.append(mttd)
        respond_times.append(mttr)

    fp_rate = (false_positives / total_alerts * 100) if total_alerts else 0

    return {
        "mttd_hours": round(mean(detect_times), 2) if detect_times else None,
        "mttr_hours": round(mean(respond_times), 2) if respond_times else None,
        "false_positive_rate": round(fp_rate, 1),
        "total_alerts": total_alerts,
        "true_incidents": total_alerts - false_positives,
    }

# Example usage
incidents = load_incidents("incidents_q1.json")
metrics = compute_metrics(incidents)
print(f"MTTD:  {metrics['mttd_hours']} hours")
print(f"MTTR:  {metrics['mttr_hours']} hours")
print(f"FP Rate: {metrics['false_positive_rate']}%")
print(f"True Incidents: {metrics['true_incidents']} / {metrics['total_alerts']}")

Purple Teaming: Red + Blue Collaboration

Purple teaming bridges the gap between offensive and defensive security. Rather than running red team exercises as adversarial, "gotcha" events, purple teaming has both teams working side by side. The red team executes known attack techniques (mapped to MITRE ATT&CK) while the blue team attempts to detect and respond in real time. After each technique, the teams compare notes:

Purple team exercises produce a concrete list of detection improvements that directly increase security posture. They are one of the highest-ROI activities a security program can invest in.

AI as a Force Multiplier for Defenders

AI and large language models have emerged as powerful tools for blue teams. Where attackers need to find just one way in, defenders must cover every possible attack path. AI helps close this asymmetry by augmenting human analysts at scale:

Automated Response Workflow

import subprocess
import json
import logging
from datetime import datetime

logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
logger = logging.getLogger("auto_response")

def isolate_host(hostname, reason):
    """Isolate a compromised host by disabling its network interface via EDR API."""
    logger.info(f"Isolating host {hostname}: {reason}")
    # In production, this calls your EDR's API (CrowdStrike, SentinelOne, etc.)
    payload = {
        "action": "network_isolation",
        "hostname": hostname,
        "reason": reason,
        "timestamp": datetime.utcnow().isoformat(),
    }
    # Simulated API call
    # requests.post("https://edr.internal/api/v1/isolate", json=payload, headers=headers)
    logger.info(f"Host {hostname} isolation request submitted")
    return payload

def block_ioc(ioc_type, ioc_value):
    """Push an IOC to the firewall block list."""
    logger.info(f"Blocking {ioc_type}: {ioc_value}")
    if ioc_type == "ip":
        # Add to firewall deny list via API or CLI
        cmd = f"firewall-cli add-block --ip {ioc_value} --duration 24h --comment 'auto-response'"
        # subprocess.run(cmd.split(), check=True)
    elif ioc_type == "domain":
        cmd = f"dns-sinkhole add {ioc_value} --comment 'auto-response'"
        # subprocess.run(cmd.split(), check=True)
    elif ioc_type == "hash":
        cmd = f"edr-cli block-hash {ioc_value} --scope global"
        # subprocess.run(cmd.split(), check=True)
    logger.info(f"IOC blocked: {ioc_type}={ioc_value}")

def disable_user_account(username):
    """Disable a compromised user account in Active Directory."""
    logger.info(f"Disabling user account: {username}")
    # In production: ldap modify or AD PowerShell via subprocess
    # subprocess.run(["powershell", "-Command",
    #     f"Disable-ADAccount -Identity {username}"], check=True)
    logger.info(f"Account {username} disabled")

def automated_response_handler(alert):
    """
    Main handler: receives a SIEM alert dict, determines severity,
    and executes appropriate automated response actions.
    """
    severity = alert.get("severity", "low")
    alert_type = alert.get("type", "unknown")

    logger.info(f"Processing alert: {alert.get('title')} (severity={severity})")

    actions_taken = []

    if severity == "critical":
        # Immediate containment for critical alerts
        if "hostname" in alert:
            result = isolate_host(alert["hostname"], alert["title"])
            actions_taken.append(result)
        if "source_ip" in alert and not alert["source_ip"].startswith("10."):
            block_ioc("ip", alert["source_ip"])
            actions_taken.append({"action": "block_ip", "value": alert["source_ip"]})
        if "compromised_user" in alert:
            disable_user_account(alert["compromised_user"])
            actions_taken.append({"action": "disable_account", "value": alert["compromised_user"]})

    elif severity == "high":
        # Block IOCs but do not isolate host without human approval
        for ioc in alert.get("iocs", []):
            block_ioc(ioc["type"], ioc["value"])
            actions_taken.append({"action": f"block_{ioc['type']}", "value": ioc["value"]})

    # Log all actions for audit trail
    response_record = {
        "alert_id": alert.get("id"),
        "timestamp": datetime.utcnow().isoformat(),
        "severity": severity,
        "actions": actions_taken,
    }
    logger.info(f"Response complete: {json.dumps(response_record, indent=2)}")
    return response_record

Building a Security Program: Maturity Models

Individual tools and techniques are necessary but not sufficient. A security program requires a maturity model that provides a roadmap for continuous improvement. The most widely used frameworks include:

Regardless of which model you adopt, the progression follows a predictable pattern: ad hoc and reactive at first, then documented and repeatable, then measured and optimized. The metrics from the previous section feed directly into maturity assessments — you cannot claim a "managed" maturity level if you do not track MTTD and MTTR.

Continuous Improvement Cycle

A mature security program operates as a continuous feedback loop:

  1. Assess — measure current capabilities against the maturity model; identify gaps
  2. Plan — prioritize improvements based on risk, cost, and organizational context
  3. Implement — deploy new tools, write new detection rules, update playbooks, train staff
  4. Validate — run purple team exercises, tabletop scenarios, and penetration tests to verify improvements
  5. Measure — track metrics before and after changes to quantify improvement
  6. Iterate — return to step 1 with updated baselines

Every incident, every purple team exercise, and every missed detection is an opportunity to improve. Post-incident reviews (Lesson 08) and forensic analysis (Lesson 09) produce findings that feed directly into detection engineering (new rules), hardening (new configurations), and training (new playbook steps).

Bringing It All Together

The capstone scenario you will work through in the lab integrates every skill from this course. You will face a simulated multi-stage attack that progresses from initial access through lateral movement to data exfiltration. Your task is to detect the attack using SIEM alerts and IDS signatures (Lessons 01-02), analyze malware samples dropped by the attacker (Lesson 03), identify which hardening gaps were exploited (Lesson 04), review firewall logs for policy violations (Lesson 05), investigate whether encrypted channels were compromised (Lesson 06), determine which unpatched vulnerabilities enabled the attack (Lesson 07), execute the full incident response lifecycle (Lesson 08), and preserve forensic evidence for the post-incident report (Lesson 09).

This is what blue team work looks like in practice: not isolated tools used one at a time, but an integrated, coordinated defense where every capability reinforces the others. The best defenders are not those who master a single tool but those who can orchestrate the entire stack under pressure, communicate clearly with their team, and continuously improve their defenses based on what they learn from each engagement.

Further Reading

Download Files

These files contain synthetic data for the blue team capstone challenge. All files are plain text (.txt) and safe to open.