SOC-SIM

2022-01-25

SOC Simulator (soc-sim) -- Technical Documentation

1. Overview

The SOC Simulator is TryHackMe's interactive Security Operations Center training platform. It places users in realistic SOC analyst scenarios where they triage security alerts using industry-standard SIEM tools (Splunk, Elastic, or Azure Sentinel), investigate incidents on an analyst workstation VM, classify alerts, and write case reports -- all in a time-bound, scored environment.

The system orchestrates the full lifecycle: scenario selection, VM provisioning, log ingestion, timed alert release, real-time investigation, report submission, AI-powered evaluation, and scoring.


2. High-Level Architecture


3. Directory Structure

Backend (API)

apps/api/app/api/v2/src/
├── routes/companies/soc-sim.ts          # Company-scoped API routes
├── controllers/soc-sim/                 # Request handlers
├── services/soc-sim/
│   ├── manage-runs.ts                   # Run lifecycle (init, pause, resume, terminate)
│   ├── vms.ts                           # VM deployment & management
│   ├── runs.ts                          # Run CRUD operations
│   ├── alerts.ts                        # Alert import from Sanity CMS
│   ├── run-alerts.ts                    # Run alert lifecycle & scoring
│   ├── run-logs.ts                      # Log ingestion via EventBridge
│   ├── reports.ts                       # Case report management
│   ├── run-alert-assign.ts             # Alert assignment logic
│   ├── run-evaluate.ts                  # AI-powered evaluation
│   ├── multiplayer-runs.ts             # Multiplayer coordination
│   ├── sentinel.ts                      # Azure Sentinel integration
│   └── socket.ts                        # WebSocket event emitters
├── models/soc-sim/
│   ├── run.ts                           # SOCSimRun Mongoose model
│   └── run-alert.ts                     # SOCSimRunAlert Mongoose model
├── common/
│   ├── interfaces/soc-sim/              # TypeScript interfaces
│   ├── enums/soc-sim/                   # Enums (status, severity, types)
│   ├── constants/vms/index.ts           # VM IDs, health check config
│   └── constants/soc-sim/              # SOC Sim constants
└── infra/sockets/handlers/soc-sim.ts    # WebSocket event handlers

Frontend

apps/frontend/src/features/soc-sim/
├── soc-sim.tsx                          # Root component
├── soc-sim.slice.ts                     # Core RTK Query API slice
├── soc-sim.types.ts                     # TypeScript types
├── landing-sections/                    # Home, scenarios, stats, leaderboard
├── scenario-onboarding/                 # Onboarding flow
├── soc-sim-dashboard/                   # Active run dashboard
├── alert-queue/                         # Alert triage interface
├── case-reports/                        # Report listing
├── case-reports-details/                # Individual report editor
├── playbooks/                           # Playbook listing
├── summary/                             # Run summary page
├── public-summary/                      # Shareable summary
├── components/                          # Shared components (nav, VM frame)
├── contexts/                            # Polling, modal contexts
└── tour/                                # Coach-marking system

4. Data Models

SOCSimRun (soc_sim_runs)

FieldTypeDescription
scenarioStringSanity CMS scenario ID
titleStringScenario display name
userObjectId (User)Run owner
statusEnumstarting, ready, completed, terminated, abandoned, paused
startedAt / endedAtDateRun time boundaries
pausedAt / resumedAtDatePause/resume timestamps
actualRuntime / pausedDurationNumberTime accounting (seconds)
vms.siem{ url, instance }SIEM VM connection
vms.analyst{ url, instance }Analyst VM connection
vms.azure{ labId, url, credentials, instance }Azure Sentinel connection
siemToolEnumsplunk, elastic, sentinel
scenarioSpeedNumberAlert/log release speed multiplier
alertTypesString[]Alert categories in this scenario
multiplayerArrayMulti-user participation data
certificationIdObjectIdOptional certification exam link
pointsAwarded / closedAlertsNumberScoring metrics
mttr / meanDwellTimeNumberPerformance metrics
successBooleanWhether run was successful
isErroredBooleanVM deployment failure flag

SOCSimRunAlert (soc_sim_run_alerts)

FieldTypeDescription
runObjectId (SOCSimRun)Parent run
statusEnumAWAITING_ACTION, IN_PROGRESS, RESOLVED
severityEnumlow, medium, high, critical
typeEnumphishing, process, execution, network, web attack, rce
incidentIdStringScenario incident identifier
alertRuleStringDetection rule name
description / detailsStringAlert content (JSON-encoded details)
shownAtDateWhen the alert becomes visible to user
assignedAt / closedAtDateInvestigation timestamps
resolveTimeNumberTime to resolve (seconds)
userObjectIdAssigned analyst (multiplayer)
releaseTimeNumberOriginal release offset (seconds)
reportEmbeddedclassification, requiresEscalation, writeup, evaluation
metaEmbeddedisTruePositive, isEscalationRequired, points, playbook

5. Run Lifecycle

Lifecycle Steps

  1. STARTING -- Run document created, VM deployment triggered asynchronously
  2. READY -- VMs are healthy, logs scheduled, alerts inserted; user can begin investigation
  3. PAUSED -- VMs terminated, alert shownAt timestamps frozen
  4. COMPLETED -- All true-positive alerts resolved; scoring + AI evaluation triggered
  5. TERMINATED -- User manually ended the run before completing
  6. ABANDONED -- System auto-terminated (VM expiry, inactivity)

6. VM Creation & Deployment

VM Types & IDs

VM RoleSIEM ToolHardcoded Upload ID
SIEMSplunk (with collector API)6900943a0e5714f3db8fefa2
SIEMElastic68a86b8926462357824ff3da
SIEMSentinel68bf3507a2d75b47d470c4ee (Azure Lab)
AnalystAll tools668c3018946888fcc0034de6

These defaults can be overridden per-scenario via Sanity CMS fields (analyst_vm_upload_id, siem_vm_upload_id, siem_elastic_vm_upload_id).

Deployment Details


7. Alert Generation & Release

Alert Timing Formula

scenarioSpeed = 0  →  shownAt = run.startedAt + index (all at once)
scenarioSpeed = 1  →  shownAt = run.startedAt + releaseTime + 150s buffer
scenarioSpeed > 1  →  shownAt = run.startedAt + (releaseTime / scenarioSpeed)

The 150-second buffer at scenarioSpeed === 1 ensures alerts appear after the corresponding SIEM logs have been ingested, giving users evidence to investigate before the alert fires.

Alert Properties from CMS

Each scenario alert in Sanity contains:


8. Log Ingestion Pipeline

Log Scheduling Details


9. Scoring & Evaluation

Scoring Breakdown

CategoryConditionPoints
ClassificationCorrect TP or FP classificationmeta.classificationPoints (from CMS)
Classification PenaltyClassified FP as TP-10
EscalationTP correctly escalatedmeta.escalationPoints (default 10)
EvaluationAI-scored writeup qualityUp to meta.evaluationPoints

Completion Trigger

A run completes automatically when all true-positive alerts have been resolved (areTruePositivesResolved()). False-positive alerts do not need to be resolved for completion. Upon completion:

  1. VMs are terminated asynchronously
  2. Classification & escalation points are calculated
  3. AI evaluation runs on all report writeups
  4. Run stats computed (MTTR, FP rate, mean dwell time)
  5. Certification section updated (if applicable)
  6. Segment analytics event fired
  7. Mission progress tracked

10. Real-Time Communication

The WebSocket layer is primarily used for multiplayer runs where multiple analysts share the same alert queue. Events notify all participants of alert assignments and run status changes in real-time.


11. Feature Flags (GrowthBook)

FlagTypePurpose
soc-sim-vms-deployBooleanEnables real VM deployment (off = mock mode for local dev)
soc-sim-pause-runBooleanEnables pause/resume functionality
soc-sim-playbooksBooleanEnables playbook feature
soc-sim-scenario-speedNumberOverride scenario speed multiplier
soc-sim-live-log-streamingBooleanLive log streaming mode
soc-sim-coach-markingBooleanTour/onboarding coach marks
soc-sim-badgesBooleanBadge system
soc-sim-siem-tool-modalBooleanSIEM tool selection UI
soc-sim-public-summary-pageBooleanPublic shareable summary
soc-sim-hacktivitiesBooleanHacktivities integration
soc-sim-short-scenariosBooleanShort scenario format
verify-and-restore-socsim-analyst-vmBooleanVM restore feature

12. Frontend User Flow


13. API Endpoints Summary

Public Routes (User-facing)

MethodEndpointDescription
GET/soc-sim/runs/activeGet active run data
POST/soc-sim/runsCreate new run
POST/soc-sim/runs/pausePause active run
POST/soc-sim/runs/resumeResume paused run
POST/soc-sim/runs/terminateTerminate run
GET/soc-sim/alertsGet paginated alerts (visible only)
PUT/soc-sim/alerts/assignAssign alert to user
PUT/soc-sim/alerts/unassignUnassign alert
GET/soc-sim/alerts/detailsGet alert details
GET/POST/PUT/DELETE/soc-sim/reports/*Case report CRUD
PATCH/soc-sim/vms/extendExtend VM time by 1 hour
POST/soc-sim/vms/refresh-urlRefresh Guacamole connection URL
GET/soc-sim/content/scenariosList available scenarios
GET/soc-sim/content/playbooksGet playbooks for run
GET/soc-sim/statsUser statistics
GET/soc-sim/leaderboardLeaderboard
GET/soc-sim/runs/summaryRun summary data

Company Routes (Management Dashboard)

MethodEndpointDescription
GET/companies/soc-sim/usersCompany SOC Sim users
POST/companies/soc-sim/assignmentCreate scenario assignment
POST/companies/soc-sim/stats/progressionTeam progression stats
POST/companies/soc-sim/statsCompany SOC Sim stats
GET/companies/soc-sim/runsUser runs for company
POST/companies/soc-sim/stats/rateAlert classification rate

14. Infrastructure Summary

Key infrastructure characteristics: