Cybrary ForgeCYBRARY / FORGE
Purple team

Defender playbook

Every offensive lab teaches one way in. This is the other half: the controls that would have stopped it, named against the frameworks your auditor already asks about, the hardening change in the words an engineer would make it, and the replay that proves it took.

Pentest: External Recon to Foothold

A forgotten service on the public perimeter, found by scanning everything and reading the version banners.

Open the lab

Do this first: Close the listener nobody owns. Inventory before patching.

Controls that answer it

  • 1.1Establish and maintain a detailed enterprise asset inventory
  • 4.8Uninstall or disable unnecessary services on enterprise assets
  • 7.1Establish and maintain a vulnerability management process
  • CM-7Least functionality
  • RA-5Vulnerability monitoring and scanning
  • M1051Update software

T1595.001T1595.002T1595.003T1190

Hardening, and how to prove it took

  1. 1Reconcile the external address ranges against the asset inventory monthly and own every listener you find.

    Where: Edge firewall and external attack-surface inventory

    Scan the ranges yourself; every open port maps to a named owner and a business reason.

  2. 2Retire the stale daemon outright rather than patching it, and close the port at the edge.

    Where: Edge host and perimeter firewall rules

    Re-run the lab's foothold step and confirm the connection is refused, not just slower.

    Watch out: Anything still consuming the legacy service — find the consumers before the cut.

  3. 3Put authenticated vulnerability scanning on the perimeter hosts, not just unauthenticated sweeps.

    Where: Vulnerability management platform

    The stale version appears in a scan report before an attacker finds it in a banner.

Pentest: Read the AD Attack Graph

Ordinary domain rights chained into domain dominance — a service account, a delegation, an over-broad group.

Open the lab

Do this first: Cut the one edge that shortens the path to Domain Admins the most.

Controls that answer it

  • 5.4Restrict administrator privileges to dedicated administrator accounts
  • 6.8Define and maintain role-based access control
  • AC-6Least privilege
  • IA-5Authenticator management
  • M1026Privileged account management
  • M1027Password policies

T1078.002T1069.002T1558.003T1003.006

Hardening, and how to prove it took

  1. 1Move service accounts to group-managed service accounts so their passwords rotate and cannot be roasted offline.

    Where: Active Directory service accounts

    Kerberoast the domain again; the recovered tickets no longer crack in the lab's time budget.

    Watch out: Applications hard-coding the old service password — stage the migration per app.

  2. 2Remove unconstrained delegation and tier administrative accounts so tier-0 never logs on to tier-2.

    Where: Domain controllers and admin workstation policy

    Re-run the attack graph and confirm the shortest path to Domain Admins gets longer or disappears.

  3. 3Review the graph itself on a schedule, not just after an engagement.

    Where: Quarterly identity attack-path review

    Each review closes at least one edge; the path count trends down between engagements.

Pentest: Web App Assessment (OWASP Top 10)

Authorization decided in the browser: an object reference the server never re-checked against the caller.

Open the lab

Do this first: Re-check ownership server-side on the endpoint the lab abused.

Controls that answer it

  • 16.10Apply secure design principles in application architectures
  • 16.12Implement code-level security checks
  • AC-3Access enforcement
  • SI-10Information input validation
  • M1050Exploit protection

T1595.003T1078T1213T1189

Hardening, and how to prove it took

  1. 1Enforce object-level authorization server-side on every handler that takes an identifier, with a deny default.

    Where: Application authorization middleware

    Replay the lab's IDOR request as a second user and expect a 403, not another user's record.

  2. 2Add an automated test per endpoint that asserts a cross-tenant request is refused.

    Where: CI test suite

    The suite fails when someone removes the check — prove it by removing one on a branch.

  3. 3Log authorization denials with the caller and the object, so abuse is visible before it succeeds.

    Where: Application logging to the SIEM

    A burst of denials from one session raises a case in the console.

Pentest: Cloud Privilege Escalation

A modest cloud role that could grant itself more — policy attachment, role assumption, key creation.

Open the lab

Do this first: Remove the escalating permission from the workload role.

Controls that answer it

  • 5.6Centralize account management
  • 6.7Centralize access control
  • AC-2Account management
  • AC-6(9)Log use of privileged functions
  • M1018User account management

T1078.004T1526T1548T1651

Hardening, and how to prove it took

  1. 1Strip iam:PassRole, policy-attachment and key-creation rights from workload roles; keep them in a break-glass role behind approval.

    Where: Cloud IAM policies

    Re-run the privilege-escalation path and confirm the escalating call is denied, with the denial logged.

    Watch out: Deployment pipelines that quietly relied on those rights — move them to a scoped deploy role.

  2. 2Turn on short-lived credentials everywhere and expire long-lived access keys.

    Where: Cloud identity provider and key policy

    No access key in the account is older than the rotation window.

  3. 3Alert on first use of a privileged API by a role that has never called it before.

    Where: Cloud audit log pipeline

    Call the API from a test role and confirm a case appears.

Pentest: Purple-Team Emulation

Techniques executed openly to test whether the defense sees them — the failure mode is silence.

Open the lab

Do this first: Onboard the missing log source — until it exists, there is nothing to tune.

Controls that answer it

  • 8.2Collect audit logs
  • 8.11Conduct audit log reviews
  • 17.4Establish and maintain an incident response process
  • AU-6Audit record review, analysis, and reporting
  • CA-8Penetration testing
  • M1047Audit

T1595T1059.001T1003.001T1053.005T1021.006T1567.002

Hardening, and how to prove it took

  1. 1Onboard the sources the emulation showed missing before writing any new rule against them.

    Where: Log pipeline

    The source appears in the console with parsed fields, not raw text.

  2. 2Re-tune the rules that fired late, using the measured latency as the target.

    Where: Detection content

    Re-run the same technique and confirm the alert lands inside the agreed window.

  3. 3Schedule the emulation as a recurring exercise, not a one-off, and track coverage over time.

    Where: Purple-team calendar and coverage tracker

    Coverage percentage moves between runs and the regression list stays empty.

Pentest: Wireless Assessment

Radio captured off the air and cracked offline, or a client tricked onto a rogue access point.

Open the lab

Do this first: Stop accepting a pre-shared key on the corporate SSID.

Controls that answer it

  • 12.6Use of secure network management and communication protocols
  • 15.4Ensure service provider contracts include security requirements
  • AC-18Wireless access
  • SC-8Transmission confidentiality and integrity
  • M1032Multi-factor authentication

T1595T1595.002T1040T1110.002

Hardening, and how to prove it took

  1. 1Move the corporate SSID to WPA3-Enterprise with certificate-based authentication and server-certificate validation enforced on clients.

    Where: Wireless controller and device profiles

    Capture the handshake again and confirm there is nothing crackable offline.

    Watch out: Legacy devices that cannot do 802.1X — move them to a segmented SSID, not an exception on the main one.

  2. 2Turn on rogue-AP containment and alert on deauthentication floods.

    Where: Wireless IDS

    Stand up an authorized rogue in the lab SSID and confirm the sensor reports it.

  3. 3Separate guest wireless from corporate at layer 3, with no route between them.

    Where: Network segmentation

    From the guest SSID, confirm no corporate subnet answers.

Pentest: Authorized Phishing Simulation

A believable lure, a credential page, and a session token that survives the password being changed.

Open the lab

Do this first: Phishing-resistant MFA on the accounts the lure targets.

Controls that answer it

  • 9.6Block unnecessary file types
  • 14.2Train workforce members to recognize social engineering attacks
  • AT-2Literacy training and awareness
  • IA-2(1)Multi-factor authentication to privileged accounts
  • M1017User training
  • M1032Multi-factor authentication

T1589.002T1583.001T1566.002T1056.003

Hardening, and how to prove it took

  1. 1Require phishing-resistant multi-factor authentication (FIDO2 or certificate-based) for everyone, not just admins.

    Where: Identity provider conditional access

    Replay the credential capture and confirm the stolen password alone gets nowhere.

    Watch out: Shared accounts and kiosk logins — give them their own hardware keys or retire them.

  2. 2Revoke refresh tokens on password change and bind sessions to device compliance.

    Where: Identity provider session policy

    Change a test password and confirm existing sessions stop working immediately.

  3. 3Make reporting a suspect mail one click, and measure report rate, not just click rate.

    Where: Mail client reporting button and awareness program

    The report rate rises across simulations while time-to-first-report falls.

Pentest: Defense Evasion and EDR Sidestep

The payload runs, but the tooling that should notice is blinded, unloaded or never installed.

Open the lab

Do this first: Alert on the endpoint agent going quiet — silence is the signal.

Controls that answer it

  • 2.5Allowlist authorized software
  • 8.5Collect detailed audit logs
  • 10.7Use behavior-based anti-malware software
  • SI-4System monitoring
  • SI-7Software, firmware, and information integrity
  • M1038Execution prevention
  • M1040Behavior prevention on endpoint

T1595T1562.001T1562.006T1055T1071.001

Hardening, and how to prove it took

  1. 1Enable tamper protection on the endpoint agent and alert when the agent stops reporting.

    Where: EDR platform

    Stop the agent on a test host and confirm a case opens within minutes.

  2. 2Turn on script-block logging and forward it, so a hidden script body is still recorded.

    Where: Windows PowerShell and Sysmon policy

    Run an obfuscated one-liner in the lab and read the deobfuscated body in the console.

  3. 3Move from signature blocking to application allowlisting in the highest-value zones first.

    Where: Application control policy

    The lab's dropped binary is refused execution, not merely flagged.

    Watch out: Unsigned internal tooling — inventory and sign it before enforcement mode.

Pentest: C2 Operations and Tunneling

A beacon that looks like browsing, and a tunnel out over a protocol nobody inspects.

Open the lab

Do this first: Default-deny egress from the server segment.

Controls that answer it

  • 4.9Configure trusted DNS servers on enterprise assets
  • 9.3Maintain and enforce network-based URL filters
  • 13.4Perform traffic filtering between network segments
  • SC-7Boundary protection
  • SI-4(4)Inbound and outbound communications traffic monitoring
  • M1031Network intrusion prevention
  • M1037Filter network traffic

T1595T1071.001T1071.004T1560.001T1041

Hardening, and how to prove it took

  1. 1Force all DNS through inspected resolvers and block direct outbound 53 and DNS-over-HTTPS to unknown resolvers.

    Where: Egress firewall and DNS policy

    Re-run the DNS tunnel and confirm the beacon cannot resolve.

    Watch out: Devices with hard-coded public resolvers — redirect them rather than allowing an exception.

  2. 2Default-deny egress from servers; allow named destinations only.

    Where: Egress firewall rules per segment

    From a server in the lab range, confirm arbitrary outbound HTTPS fails.

  3. 3Score destinations on beacon regularity rather than per-request signatures.

    Where: Detection content over proxy logs

    Replay a jittered beacon and confirm it scores above threshold within one hour.

Pentest: Ransomware Adversary Emulation

Mass file change on a share, backups reached with the same credentials, then the demand.

Open the lab

Do this first: Prove one recovery point cannot be deleted with production credentials.

Controls that answer it

  • 3.11Encrypt sensitive data at rest
  • 11.2Perform automated backups
  • 11.4Establish and maintain an isolated instance of recovery data
  • CP-9System backup
  • CP-10System recovery and reconstitution
  • M1053Data backup

T1595T1053.005T1134.001T1021.006T1486

Hardening, and how to prove it took

  1. 1Hold one immutable, credential-isolated copy of every recovery point — the backup system must not trust production identities.

    Where: Backup platform and its own identity store

    Attempt to delete a recovery point with a compromised production admin and confirm it is refused.

  2. 2Rehearse a restore to a stated recovery-time objective, and time it.

    Where: Recovery runbook

    A full restore of the finance share completes inside the objective, with the time recorded.

  3. 3Alert on mass file modification per share, weighted by sensitivity.

    Where: File-share auditing into the SIEM

    Rewrite 500 benign fixture files and confirm a case opens before the run finishes.

    Watch out: Legitimate bulk jobs — baseline them first so the rule is not switched off in week one.