Compliance

Phase 1, Phase 2, then keep it running

A fixed-price gap analysis, remediation through to your audit, and upkeep after it. All in a workspace you keep.

All compliance
Security

Find it before a buyer does

Testing, assessments and security leadership, run by the researcher who found the Mirai botnet kill switch.

All security
Industries

Prove you are secure

To the people you sell to, raise from or answer to.

All industries
Resources

Learn the space

Original research, free tools and plain-language guides, from a published security researcher.

Read the blog
Security

Running Vulnerable Lab Environments Safely at Scale

On this page, 9 sections
  1. The threat model of a training lab
  2. Containment: vulnerable inside, sealed at the edge
  3. Isolation between learners
  4. Clean resets
  5. Capacity and reliability
  6. Protecting the platform around the labs
  7. Monitoring and response
  8. A release checklist for a vulnerable lab
  9. Common questions

Running vulnerable lab environments safely at scale comes down to four properties: containment, so nothing a learner does can reach anything outside the lab; isolation between learners, so one person cannot touch or spoil another's instance; clean resets, so every session starts from a known state; and capacity, so the lab stays up when many people attack it at once. Treat the lab as production software.

A training lab is unusual software. It is deliberately insecure, it is attacked by every user, and it often runs code those users upload. If it is built like a demo, it will eventually be used as a launch point, a free compute host or a source of other learners' answers. This post covers how to design and operate vulnerable environments for training so that the only thing that gets compromised is the target.

The threat model of a training lab

Start by listing who might misuse the lab and how. A useful threat model for a training environment includes:

  • Escape. A learner gains control of the vulnerable machine, as intended, then pivots to the host, the hypervisor, the management network or the internet.
  • Abuse of resources. A compromised lab machine is used to send spam, mine cryptocurrency, scan third parties or host malware.
  • Cross-learner interference. One learner attacks another learner's instance, steals their flag or breaks their session.
  • Spoiled state. One learner's changes, such as a dropped file or a changed password, become the next learner's starting point.
  • Denial of service. Heavy scanning or a crashing exploit takes the lab down for everyone.
  • Platform compromise. The surrounding platform, the learner accounts, the scoring system and the flag store are attacked directly.

Every control below maps to one or more of these.

Containment: vulnerable inside, sealed at the edge

In a recent engagement building labs for a capture-the-flag training platform, labs were designed to be deliberately vulnerable inside and contained so nothing learners did could reach anything outside them. In practice, containment has several layers.

Network segmentation

Lab machines sit on networks that can reach only what the exercise requires: the learner's connection and, in multi-machine labs, the other machines in the same scenario. They cannot reach management interfaces, other customers' labs, internal services or the platform's own infrastructure.

Egress control

Outbound traffic is the control most often forgotten. A lab machine that can reach the internet can be turned into a spam relay, an attack host or a download point for real malware. Default to no outbound access. If an exercise genuinely needs it, such as fetching a package, allow only that destination through a proxy you control and log.

Hardened hosts under deliberately weak guests

The vulnerable machine is weak on purpose. The host running it must not be. Keep hypervisors and container runtimes patched, avoid running lab containers in privileged mode, never mount host paths or runtime sockets into a lab, and prefer full virtual machines for labs that grant root, since kernel-level exploits are part of many privilege escalation paths. Remember that the intended way in is not the only one learners will try.

No real credentials, no real data

Lab images should contain only fictional data and credentials that exist nowhere else. Scan images before release for leftover keys, tokens and personal information from whoever built them.

Isolation between learners

Shared labs, where many learners attack the same instance, are cheap but fragile. One person's exploit crashes the service, another reads a flag someone else just surfaced, a third resets a password and locks everyone out. Where possible, give each learner or team its own instance, on its own segment, reachable only through their own connection.

Where a shared instance is unavoidable, such as a competition, make the service resilient to the expected exploit, rotate flags per team, and monitor for learners attacking each other rather than the target.

Clean resets

Labs in our case study were built to reset cleanly. A reset should return the environment to a known good state with no trace of the previous session. Good patterns include:

  • Rebuilding from an immutable image or snapshot rather than trying to clean up in place.
  • Generating flags at start-up, per instance, so a flag from one session is worthless in the next.
  • Timing out idle instances automatically.
  • Letting learners trigger a reset themselves when they break something.
  • Testing the reset path as often as the exploit path. A reset that fails silently is worse than none.

Free weekly email

Get The Compliance Brief every Tuesday

One email a week from Jacob Masse: the security and compliance stories that changed something that week, and what each one means if you sell software to enterprise buyers. Five stories, a take on each, five minutes to read.

Free. Unsubscribe in one click, and replies reach Jacob directly. Read the latest issue or browse the archive.

Capacity and reliability

A training lab is software that many people attack at once. If a common exploit or an aggressive scan knocks a service over, the lab teaches patience rather than security.

  • Load test with attacker tools. Point the scanners and exploit frameworks learners actually use at the lab, at the concurrency you expect, before release.
  • Limit resources per instance. CPU, memory, disk and process limits stop one runaway exploit from starving its neighbours.
  • Restart automatically. Services that crash under exploitation should come back without an operator.
  • Plan for peaks. Classes, cohort starts and events create bursts. Know the platform's limits and how it degrades when it reaches them.

Protecting the platform around the labs

The vulnerable machines are the intended target. The platform that hosts them is not, but it is reachable by every learner. Treat it like any other internet-facing application: authentication with multi-factor options, least privilege for operators, separation between the learner-facing network and administration, logging and alerting, and regular testing. A penetration test of the platform itself, with the labs out of scope, is a sensible control, and if you serve corporate or academic customers they may ask to see one. For what a buyer will expect from that report, see when a customer wants proof of a penetration test.

Monitoring and response

Expect attacks; that is the product. What you are watching for is attack traffic in the wrong place:

  • Outbound connections from lab segments that should have none.
  • Traffic between learner instances that should be isolated.
  • Unusual resource use that suggests mining or abuse.
  • Access attempts against management or platform infrastructure from lab networks.

Have a written plan for what happens when one of these fires: who isolates the instance, how the learner is contacted, when the account is suspended, and how evidence is kept. A short incident response plan covering these cases is worth writing before launch, not after the first abuse report.

A release checklist for a vulnerable lab

  • Network access limited to what the exercise needs; egress blocked by default.
  • Host hardened; no privileged containers, host mounts or runtime sockets.
  • Image scanned for real credentials and data.
  • Per-learner or per-team instances where possible; per-instance flags.
  • Reset tested and automatic; idle instances time out.
  • Load tested with attacker tools at expected concurrency; resource limits set.
  • Monitoring in place for egress, cross-instance traffic and resource abuse.
  • Unintended paths reviewed by someone who did not build the lab.

Common questions

Should training labs run in containers or virtual machines?

Containers work for many web and service labs if they run unprivileged with no host mounts. Labs that grant root or involve kernel-level privilege escalation are safer in full virtual machines, because the isolation boundary is stronger.

Do vulnerable labs need internet access?

Usually not. Default to no outbound access and allow specific destinations through a controlled proxy only when an exercise needs them. Open egress is the most common way a lab becomes a launch point.

How do you stop learners sharing flags?

Generate flags per instance at start-up, so a flag is only valid for the session that produced it. Rotate them on every reset.

Should the training platform itself be penetration tested?

Yes. The labs are meant to be broken, but the platform, accounts and scoring system are not, and every learner can reach them.

If you run or plan to run vulnerable environments for training, book a free call and we can review the design or test the platform around it.

Running labs for many learners? Security awareness training and incident response tabletops built by practitioners.

See security awareness trainingOr book a free call

Before you go

Want the rest of this by email?

If this was useful, I send a few short notes on security posture. Unsubscribe in one click, and replies reach me directly.

From Jacob Masse, Principal of TrazTech: the files by email, then a few short notes over the next month. No spam, unsubscribe in one click.