# Break The Root — Room Authoring and Submission Guide

Everything you need to build a room, test it, and submit it to Break The
Root. Read Part 0 first: it decides which of the remaining parts apply to you.
Follow every section that does before you submit.

Anyone can write a room for the platform. You don't need an invitation or
permission to start — you need a room that meets the contract described here.
When it's ready, send it through the form at
**https://breaktheroot.com/submit-a-room/**. Part 9 covers how to send it and
what happens next.

Three things are worth knowing up front:

- **You do not deploy the room yourself.** You submit a package; we deploy it
  as a draft, verify it, then publish it. Part 9 describes what happens to your
  files, because a few of its details change how you must build them
  (production flags are injected and differ from yours; the SSH password is set
  by us at deploy time, never by your manifest).
- **A room is a contract, not a pile of files.** Filenames, headings, flag file
  contents and manifest fields are parsed by code. The platform refuses a
  package that does not match rather than guessing, so the fastest way to a
  clean submission is to run the local validator (Part 8) before you send it.
- **The room goes out under your name.** It publishes with the author name and
  profile link from your manifest, on the room page and on the catalog card. So
  only submit work that is yours to publish.

---

## Table of contents

**Part 0 — Decide what you are building**

1. The three room types
2. Room naming rule

**Part 1 — What you submit**

3. Submission structure for labs
4. Submission structure for theory rooms
5. Deliverables at a glance

**Part 2 — Backend package (guided and unguided labs)**

6. ZIP structure
7. Dockerfile requirements
8. Application file permissions
9. `entrypoint.sh`
10. SSH requirements
11. Container capabilities and limits
12. Database and runtime state
13. Red flags
14. Remediation checks (blue flags)

**Part 3 — Vulnerable machine UI (guided and unguided labs)**

15. Research before designing
16. Design principles
17. Route architecture
18. Every exploitation endpoint needs visible UI
19. Decoy routes
20. Story pages
21. UI quality checklist

**Part 4 — Frontend submission folder (labs)**

22. Folder structure
23. `overview.md`
24. `descriptions.md` for guided labs
25. `descriptions.md` for unguided labs
26. Screenshots
27. `notes.md`
28. Room icon

**Part 5 — Theory rooms in full**

29. The folder
30. `room.json`
31. Writing `descriptions.md`
32. The question line
33. What learners can type and still be marked correct
34. Theory room pitfalls

**Part 6 — Official writeup (unguided labs only)**

35. The Medium writeup

**Part 7 — Manifest (labs)**

36. What goes in the manifest
37. Example manifest
38. Manifest rules

**Part 8 — Local testing (guided and unguided labs, required)**

39. What the runner does
40. Requirements
41. Prepare the package folder
42. Validate before you start
43. Start the room
44. Test the web app and SSH
45. Test remediation checks
46. Rebuild after changes
47. Test restart and redeploy
48. Build with the legacy builder
49. Validate the final ZIP
50. Test the UI end to end
51. Stop the room
52. Runner command reference
53. Troubleshooting
54. Safety
55. `local-test-results.md`

**Part 9 — After you submit**

56. How to send it
57. Review, drafts and publishing

**Part 10 — Final checklist**

---
---

# PART 0 — DECIDE WHAT YOU ARE BUILDING

## 1. The three room types

Decide the type **before** you start. It changes whether you need a machine,
what goes into `descriptions.md`, which metadata file you write, and whether
you need a writeup.

| Aspect                               | Theory room                                       | Guided lab                                                                                              | Unguided lab                                                                       |
| ------------------------------------ | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| **Purpose**                          | Explain a topic or concept                        | Teach a new concept hands-on, or build concepts for upcoming labs                                       | Test skills and keep them from getting rusty (CTF-style)                           |
| **Machine attached**                 | **No**                                            | Yes                                                                                                     | Yes                                                                                |
| **Backend ZIP, UI, local testing**   | Not needed                                        | Required                                                                                                | Required                                                                           |
| **`descriptions.md`**                | The lesson: sections, each with its own questions | Detailed explanation of every concept **before** the learner attempts the machine, then the walkthrough | Briefing, objectives and getting-started info only; the learner works it out       |
| **Screenshots in `descriptions.md`** | Allowed                                           | Allowed                                                                                                 | No                                                                                 |
| **Writeup**                          | None                                              | None. Everything is explained in the room itself                                                        | **Required.** Official writeup on Medium the learner can refer to if they want     |
| **Assumed knowledge**                | None; this is where concepts are taught           | Concepts are explained (recap only if a theory room already covered them)                               | Learner already has the foundational knowledge                                     |
| **Metadata file**                    | `room.json` in the room folder (Part 5)           | `<slug>-manifest.json` (Part 7), `"guided": true`, no `writeup_url`                                     | `<slug>-manifest.json` (Part 7), `"guided": false`, `writeup_url` required (HTTPS) |

**Theory rooms** are text-only: an explanation of the topic followed by
quiz-style questions, section by section. There is no machine, so there is no
backend ZIP, no vulnerable UI, no flags, no checks and no local testing. The
whole contract is in Part 5. Use the **Intro to Injections** room on the
platform as the reference — it is both a live room and the template every other
theory room is generated from.

**Guided labs** have a machine and no writeup. Everything is explained inside
the room, in `descriptions.md`. Explain each concept in detail **before** the
learner starts on the machine, then walk them through solving it. If a concept
was already covered in an earlier theory room, don't explain it in full again:
give a short recap, point at that room, and move on.

**Unguided labs** are CTF-style challenges with a machine. The room gives the
briefing and objectives; the learner solves it alone. Each one needs an
official writeup published on Medium — a step-by-step exploitation walkthrough,
not a concept lesson (Part 6).

Parts 2, 3 and 8 (backend, UI and local testing) apply to **guided and
unguided labs only**. Part 5 applies to **theory rooms only**.

## 2. Room naming rule

**This matters more than it looks. Please don't use AI-suggested names for
your room.**

You are putting a lot of effort into every room, so give it a name that is
unique and stands out. Names like "Meridian", "Northfall", "Sentinel", "Aegis",
"Nexus", "Obsidian", "Vanguard" and similar are what AI tools suggest by
default. They make every room sound the same.

Good names:

- Come from the actual concept or story of the room (a pun, a reference, an
  in-joke, a real-sounding product name)
- Are short and memorable
- Would not show up if you asked any AI tool to "name a cybersecurity lab"

The same rule applies to the fictional company and product inside the room.

---

# PART 1 — WHAT YOU SUBMIT

## 3. Submission structure for labs

```text
<room-slug>-backend.zip          ← Dockerized vulnerable machine
<room-slug>/                     ← frontend submission folder
├── overview.md
├── descriptions.md
├── notes.md
├── <room-slug>.png              ← room icon
└── <screenshot-name>.png ...    ← guided rooms: every screenshot used in descriptions.md
<room-slug>-manifest.json        ← metadata manifest
local-test-results.md            ← your local test output and redeploy notes
```

For **unguided** rooms, also send the **Medium writeup link** (it also goes in
the manifest as `writeup_url`).

Also include screenshots of the running UI and any setup notes needed to
redeploy.

## 4. Submission structure for theory rooms

A theory room is **one folder**, and nothing else. The folder name becomes the
room's URL, so `after-you-press-enter/` publishes to
`breaktheroot.com/after-you-press-enter/`.

```text
after-you-press-enter/
├── room.json                   required: name, author, catalog blurb, difficulty, category
├── overview.md                 the room landing page
├── descriptions.md             the lesson itself — sections and their questions
├── notes.md                    reference notes learners can download
├── after-you-press-enter.png   cover image, named after the folder
├── client-server.png           diagrams used inside the lesson
├── url-anatomy.png
└── dns-lookup-flow.png
```

Every file sits **directly in the folder**. No subfolders — the uploader
rejects a nested path rather than flattening it. There is no backend ZIP, no
manifest and no `local-test-results.md`. Part 5 is the full specification.

## 5. Deliverables at a glance

| Deliverable | Theory | Guided | Unguided |
| --- | --- | --- | --- |
| Backend ZIP | — | Yes | Yes |
| `overview.md` | Yes | Yes | Yes |
| `descriptions.md` | Yes | Yes | Yes |
| `notes.md` | Yes | Yes | Yes |
| Cover / icon PNG | Yes | Yes | Yes |
| Screenshots / diagrams | If used | If used | — |
| `room.json` | Yes | — | — |
| `<slug>-manifest.json` | — | Yes | Yes |
| `local-test-results.md` | — | Yes | Yes |
| Medium writeup | — | — | Yes |

**Do not include:** `writeup.pdf`, `writeup.md`, generated platform files such
as `index.html`, or `manifest.json` inside the backend ZIP.

---

# PART 2 — BACKEND PACKAGE (guided and unguided labs)

## 6. ZIP structure

The ZIP must contain files **directly at its root**. No outer wrapper folder.

```text
Dockerfile
entrypoint.sh
app/
  server.py
flags/
  red-flag1.txt
  red-flag2.txt
  blue-flag1.txt        ← one per declared extra_check
checks/
  check1.sh
  check2.sh
```

**Correct** (what `unzip -l` should show):

```text
Dockerfile
entrypoint.sh
app/server.py
flags/red-flag1.txt
flags/red-flag2.txt
checks/check1.sh
```

**Incorrect — wrapper folder:**

```text
example-room/
  Dockerfile
  entrypoint.sh
  flags/
```

**Incorrect — wrapper folder plus a ZIP nested inside itself** (this is a
real submission, which is why it is worth showing):

```text
base64-xor-backend.zip
└── base64-xor-backend/            ← wrapper folder, not allowed
    ├── Dockerfile
    ├── app/server.py
    ├── base64-xor-backend.zip     ← a copy of the ZIP inside the ZIP, not allowed
    ├── entrypoint.sh
    └── flags/
        ├── red-flag1.txt
        └── red-flag2.txt
```

To avoid this, ZIP the **contents** from inside the folder, not the folder
itself:

```sh
cd base64-xor-backend
zip -r ../base64-xor-backend.zip Dockerfile entrypoint.sh app flags checks
```

Rules:

- `Dockerfile`, `entrypoint.sh`, `flags/` and `checks/` must appear at the root
- `Dockerfile`, `entrypoint.sh`, `flags/red-flag1.txt` and `flags/red-flag2.txt`
  must exist and be **non-empty**; so must every declared check script and blue
  flag. An empty required file is rejected at deploy time
- Validate with `unzip -l <room-slug>-backend.zip`, or point the local runner
  straight at the ZIP (Section 42) — it checks the layout for you
- Do **not** include `manifest.json` (or `<slug>-manifest.json`) in the ZIP
- Do **not** nest another ZIP inside it
- Only include check files that are declared in `extra_checks`

Two places where the platform is more forgiving than this guide, and you should
still follow the guide: the deploy step tolerates **one** outer folder in the
ZIP and re-applies mode `0755` to `.sh` and `.py` files. The local runner does
neither — it refuses a wrapper folder and a non-executable check — and the
runner is what you have to get through. Build the ZIP flat, with
`chmod +x` applied, and both are satisfied.

## 7. Dockerfile requirements

The Dockerfile must:

- Build without interactive prompts
- Work with BuildKit/buildx **and** the legacy Docker builder
- Avoid unverified BuildKit-only syntax
- Install all runtime dependencies
- Install `openssh-server` when SSH is enabled
- Install `nano` and `micro` when SSH remediation is enabled
- Include `/usr/bin/timeout` (coreutils — present in Ubuntu/Debian images); the
  runner uses it to enforce the check timeout
- Copy the complete application
- Copy `entrypoint.sh` and make it executable
- `EXPOSE` the declared application port
- Start through `entrypoint.sh`
- Keep the main application in the foreground
- Bind to `0.0.0.0` (never `127.0.0.1`)
- Have no host filesystem dependencies
- Have no Docker socket access
- Not need `--privileged`
- Use no production addresses and no external databases

Recommended skeleton:

```dockerfile
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
 && apt-get install -y --no-install-recommends \
    python3 \
    python3-pip \
    ca-certificates \
    curl \
    nano \
    micro \
    openssh-server \
    <other-required-packages> \
 && rm -rf /var/lib/apt/lists/*

RUN useradd -m -s /bin/bash app

WORKDIR /opt/app

COPY app/ /opt/app/
COPY entrypoint.sh /entrypoint.sh

RUN chmod 0755 /entrypoint.sh \
 && mkdir -p /opt/app/data /run/sshd \
 && chmod -R a+rwX /opt/app

EXPOSE 8080

CMD ["/entrypoint.sh"]
```

The service **must** listen on `0.0.0.0:<container_port>`. A localhost-only
bind cannot be reached through the VPN after deployment.

## 8. Application file permissions

If the learner has to patch vulnerable code over SSH, the SSH user must be able
to edit it. At minimum these paths must be writable:

```text
/opt/app/server.py
/opt/app/*
```

Use:

```dockerfile
RUN chmod -R a+rwX /opt/app
```

Do **not** leave the vulnerable source as `-rwxr-xr-x`. That lets the learner
read it but not edit it. The source file named in your walkthrough or writeup
must actually exist at that exact path.

## 9. `entrypoint.sh`

It must:

- Be at the ZIP root
- Be executable (`chmod +x entrypoint.sh` before zipping, and `chmod 0755` in
  the Dockerfile)
- Use `#!/bin/sh`
- Use `set -eu`
- Create required directories — including anything under `/run`, which is
  replaced by an empty tmpfs at startup
- Initialize the database and baseline state
- Create the runtime SSH user when required
- Read the injected SSH credentials
- Generate SSH host keys
- Start SSH correctly
- Start the application in the foreground
- Exit with a clear error when required setup fails

### Stable runtime secret

Create it once per container and reuse it for all workers:

```sh
#!/bin/sh
set -eu

mkdir -p /opt/app/data /run/sshd

if [ ! -s /opt/app/data/.secret_key ]; then
    umask 077
    python3 -c 'import secrets; print(secrets.token_hex(32))' \
        > /opt/app/data/.secret_key
fi

export SECRET_KEY="$(cat /opt/app/data/.secret_key)"
```

Never generate a fresh secret per worker or per request, or users will randomly
get signed out.

### SSH-enabled rooms

```sh
SSH_USERNAME_VALUE="${SSH_USERNAME:-app}"
SSH_PASSWORD_VALUE="${SSH_PASSWORD:-}"

if [ -z "$SSH_PASSWORD_VALUE" ]; then
    echo "SSH_PASSWORD is required" >&2
    exit 1
fi

if ! id -u "$SSH_USERNAME_VALUE" >/dev/null 2>&1; then
    useradd -m -s /bin/bash "$SSH_USERNAME_VALUE"
fi

usermod --shell /bin/bash "$SSH_USERNAME_VALUE"
echo "${SSH_USERNAME_VALUE}:${SSH_PASSWORD_VALUE}" | chpasswd

mkdir -p /run/sshd
ssh-keygen -A >/dev/null 2>&1 || true
/usr/sbin/sshd
```

The SSH user must use `/bin/bash`, never `/usr/sbin/nologin`.

### Foreground application start

```sh
exec gunicorn \
    --bind 0.0.0.0:8080 \
    --workers 2 \
    --threads 4 \
    wsgi:app
```

Never background the app with `&` and then exit. If the main process exits,
Docker stops the room.

## 10. SSH requirements

When SSH is enabled, include:

- `openssh-server`, `/run/sshd` created at runtime, and a valid shell user
- Password or key authentication, plus host-key generation
- A foreground application process
- `nano` and `micro`

The platform injects `SSH_USERNAME` and `SSH_PASSWORD` into the container at
runtime. Read them dynamically. **Never hardcode the password in the image.**
Never put credentials in `overview.md`, `descriptions.md`, `notes.md`,
JavaScript, the Medium writeup, or any public doc.

Test both:

```sh
ssh -p 2222 user@127.0.0.1
ssh -p 2222 user@127.0.0.1 'id'
```

## 11. Container capabilities and limits

Rooms run with every capability dropped. Only these are added back:

| Capability | When |
| --- | --- |
| `DAC_OVERRIDE`, `CHOWN`, `FOWNER`, `SETUID`, `SETGID` | Always |
| `AUDIT_WRITE` | When SSH is enabled (PAM login needs it) |
| `SYS_CHROOT` | When SSH is enabled (sshd privilege separation needs it) |

The container is also limited to 512 MB of memory, 1 CPU and 128 processes.
`/run` and `/tmp` are replaced with small empty `noexec` tmpfs mounts at
startup, and "no new privileges" is on unless the manifest sets
`"privilege_escalation": true`. Section 39 spells out what this means for your
room; the local runner applies exactly the same limits, so if it works there it
works in production.

Do **not** request `--privileged`, `SYS_ADMIN`, Docker socket mounts, or host
filesystem mounts.

## 12. Database and runtime state

Containers are disposable, and a stopped container is never restarted — every
start comes from the immutable image. The room must:

- Create its database if it's missing
- Seed baseline records on startup
- Recreate required directories
- Work after stop/start and after redeployment
- Make no host filesystem assumptions
- Not rely on a previous container
- Use no external production databases

## 13. Red flags

Every backend must contain:

```text
flags/red-flag1.txt
flags/red-flag2.txt
```

One file per entry in `required_flags`, and `red-flag1.txt` and
`red-flag2.txt` are expected even if the UI shows only one objective.

**Flag ids must be 1, 2, 3 or 4.** The platform serves and grades
`red-flag1`–`red-flag4` and nothing else, so a room can have at most four red
flags and the ids must be exactly these numbers — not `0`, not `5`, not a
room-specific scheme. Two is the normal number. Both the local runner and the
deploy step refuse a manifest that breaks this, and they refuse a repeated id
too.

Each file must contain **exactly one** UTF-8 flag on one line:

```text
BTR{your-local-test-value}
```

No quotes, no HTML, no JSON, no explanations, no multiple flags, no extra text.
A single trailing newline is fine; anything else fails validation. The flag must
match `BTR{...}` with no braces or line breaks inside.

The platform mounts the flags **read-only** at:

```text
/opt/seed-flags/red-flag1.txt
/opt/seed-flags/red-flag2.txt
```

- Do not modify the mounted files. Your app can copy the values into its own
  database or into the intended challenge location at startup.
- **Do not bake final flags into the Docker image.** Read them from
  `/opt/seed-flags/` at startup.
- The flag values you ship are **local test values**. Production flags are
  generated at deploy time and differ, which is why the app must read them
  rather than hardcode them.

## 14. Remediation checks (blue flags)

For every entry in `extra_checks`, provide:

```text
checks/checkN.sh
flags/blue-flagN.txt
```

**Check ids must be 1, 2, 3 or 4**, for the same reason as flag ids: the
platform runs `check1.sh`–`check4.sh` and releases `blue-flag1`–`blue-flag4`.
At most four remediation checks per room.

The numbers must match the declared ids: a declared check with no script is an
error, and a `checks/checkN.sh` that is **not** declared in `extra_checks` is
also an error.

Each check must:

- Exit `0` only on success
- Print exactly `true` on success and `false` otherwise
- Finish within **10 seconds** (the runner kills it after that and counts it as
  a fail)
- Be executable (`chmod +x checks/*.sh` **before** zipping; the folder is
  mounted read-only, so permissions can't be fixed later)
- Verify the actual vulnerability is fixed
- Verify normal functionality still works
- Produce no debug output

```sh
#!/bin/sh
set -eu

if vulnerability_is_fixed && normal_functionality_works; then
    printf 'true\n'
else
    printf 'false\n'
fi
```

**Both conditions must hold.** A check must not pass just because the service
is stopped, the process crashed, an endpoint was deleted, the DB was deleted,
every request errors, the feature was disabled, or legitimate users can no
longer use the feature. You must prove this in local testing (Section 45).

The checks folder is mounted read-only inside the running room at
`/opt/btr/checks/`.

---

# PART 3 — VULNERABLE MACHINE UI (guided and unguided labs)

The UI is the learner's first impression. It must feel like a **real product**,
not an obviously fake vulnerable toy app.

## 15. Research before designing

Before writing any HTML/CSS, study how these platforms present themselves:

- Hack The Box
- TryHackMe
- PortSwigger Web Security Academy
- OWASP Juice Shop
- VulnHub / PentesterLab

Look at their navigation patterns, page layouts, hero sections, card grids,
sidebar structure and interaction density. Then apply what fits your room. Take
their information architecture and feel, not their branding.

## 16. Design principles

- **Dark mode only.** Muted, neutral palette: charcoal, slate, graphite, or
  off-black backgrounds with soft cream or gray text.
- **Restrained accents:** muted teal, dusty rose, brick red, or warm amber.
- **Do not use yellow, purple, blue, or other "AI default" colors.** No neon
  glows, no gradient meshes, no glassmorphism.
- **Human, not "dumb vulnerable app."** Copy should read like a real company's
  internal tool or public product. Include realistic nav items and footer
  links: About, Docs, Status, Contact, Legal, even if those pages are simple.
- **Consistent typography.** One display font and one body font. Use spacing
  and weight for hierarchy, not color.

## 17. Route architecture

- **Every page has its own real URL route.** No single-page anchor navigation
  (`#section`). Clicking a button must load a distinct page.
- Build a proper multi-page app with a shared layout (header, nav or sidebar,
  footer).

```text
/                     → home / hero / product story
/about                → company background
/docs                 → documentation index
/docs/<topic>         → individual doc pages
/status               → system status page
/changelog            → release notes
/contact              → contact form
/legal/privacy        → privacy policy
/legal/terms          → terms
/login                → user login
/register             → signup
/dashboard            → authenticated area
/dashboard/<feature>  → feature pages
/<vulnerable-route-1> → has an on-page button/form that triggers it
/<vulnerable-route-2> → same
```

- Every page must be reachable from the UI (nav, cards, buttons, footer links).
  No hidden routes that have to be guessed.
- A `/health` route that returns 200 is not required, but it makes the start
  probe deterministic and is a good idea.

## 18. Every exploitation endpoint needs visible UI

**No guessing routes. No reading API docs to find the vulnerability.** Every
route in the intended exploitation path needs a visible button, form or card
that triggers it, so the learner can see the feature working before they start
testing it.

For each intended vulnerability:

- A dedicated page, or a clearly labeled feature area, with a real form, button
  or control
- The control actually calls the vulnerable endpoint
- The normal ("happy path") behavior works and is visible
- Error messages read like a human wrote them, not like stack traces, unless
  the room intentionally leaks a stack trace

Examples:

| UI feature | Vulnerability |
| --- | --- |
| Profile edit form exposing `user_id` | IDOR |
| Search box on a product page | Reflected XSS or SQLi |
| Export / import button | Command injection or SSRF |
| Template preview | SSTI |
| File viewer with a `file=` parameter | LFI / path traversal |
| Webhook tester | SSRF |
| Password reset form | Auth bug / token flaw |
| Admin panel preview | Broken access control |

Whatever your room idea is, expose it through the UI.

## 19. Decoy routes

Add **3–6 extra routes** that are not part of the vulnerability chain. They
make the site feel real. For example:

- `/blog` with two or three short posts
- `/pricing` with a simple table
- `/careers` with open roles
- `/support` with a FAQ
- `/partners` with partner logos
- A "coming soon" page for an upcoming feature

They must be plain and working, not broken. Learners should only be able to
tell them apart from the real path by actually testing.

## 20. Story pages

Include at least **2–3 in-world story or briefing pages** that explain:

- What the product or platform does
- Why it exists
- A recent incident, breach note or internal memo related to the challenge

Write in a real voice, with no marketing fluff and no AI-sounding copy. No
spoilers about the vulnerability. No flags.

## 21. UI quality checklist

- [ ] Shared layout (header + nav + footer) on every page
- [ ] Dark, muted palette (no yellow/purple/blue AI defaults)
- [ ] Real downloaded images for the hero and cards
- [ ] Multi-page routing, no `#section` navigation
- [ ] Every intended vulnerable endpoint has a visible trigger (button/form/card)
- [ ] Happy path works and can be shown through the UI
- [ ] 3–6 decoy routes present and working
- [ ] 2–3 story pages present
- [ ] Copy reads human-written, not AI-templated
- [ ] No secrets, flags or SSH credentials in any frontend file
- [ ] Accessible: keyboard focus states, semantic HTML, good contrast


---

# PART 4 — FRONTEND SUBMISSION FOLDER (labs)

Theory rooms use the folder in Part 5 instead.

## 22. Folder structure

```text
<room-slug>/
├── overview.md
├── descriptions.md
├── notes.md
├── <room-slug>.png
└── <screenshot files>      ← guided rooms, if used
```

- `overview.md`, `descriptions.md`, `notes.md` and the cover image must be at
  the **top level** of the folder. Subfolders are allowed for other assets, but
  keep it flat unless you have a reason not to.
- The icon filename must exactly match the slug. If the folder contains more
  than one image — any screenshot at all — this is not optional: the deploy step
  looks for `<slug>.png` by name, and only falls back to "the single image in
  the folder" when there is exactly one.
- Do **not** include `writeup.pdf`, `writeup.md`, or generated platform files
  like `index.html`. The room page and workspace are generated from the
  platform template; a hand-written `index.html` would be taken as authoritative
  and would replace it.

Room content is a contract: `overview.md` is the public room page,
`descriptions.md` is what the learner reads in the workspace, and `notes.md` is
the download. Don't move content between them.

## 23. `overview.md`

`overview.md` is the full room overview, shown directly below the Author
section on the room page:

```text
https://breaktheroot.com/<room-slug>/
```

Use it for the room's story and context:

- Company Background
- The Incident
- Reported by
- What the learner has been asked to investigate
- What the room covers

Use `##` headings. Example:

```markdown
## Company Background

Aegis Cloud Infrastructure operates SentinelLog, an internal SIEM and log
aggregation platform used by its security operations centre.

## The Incident

Reported by: Sarah V., Lead SOC Analyst

Analysts discovered forged HTTP records and an unauthenticated diagnostics
endpoint. Your task is to reproduce the issue, understand its impact, and
fix the vulnerable implementation.

## What This Room Covers

- CRLF log injection
- Log sanitization
- Exposed diagnostics endpoints
- Authentication and access control
- Verification of remediation fixes

```

(The names in this example are for illustration only. Remember the naming rule
in Section 2.)

Do not put the full overview in the manifest. The manifest only gets the short
`catalog_overview` used on the homepage card.

## 24. `descriptions.md` for guided labs

Guided labs have a machine and no writeup, so `descriptions.md` has to teach
everything. Explain each concept in detail **before** the learner tries to
solve the machine, then walk them through it.

Recommended order:

1. **Concepts:** a detailed explanation of each concept the machine uses, with
   examples. If a concept was already covered in an earlier theory room, give a
   short recap instead of the full explanation, and point to that theory room.
2. **Getting Started:** start the machine, download the VPN profile, connect,
   find the assigned IP, and reach the service.
3. **Walkthrough:** step by step through the machine, showing the commands,
   requests and output the learner should see, up to each flag.
4. **Remediation:** how to SSH in, which file to edit, what the vulnerable code
   looks like, how to fix it, and how to confirm the check passes.

```markdown
# What is <concept>?
Detailed explanation, with examples.

![[concept-diagram.png]]

# Recap: <concept from an earlier theory room>
Short overview only. The full explanation is in the <theory room name> room.

# Getting Started
...

# Exploiting the machine
Step-by-step walkthrough.

![[burp-request-step-1.png]]

# Fixing the vulnerability
...
```

## 25. `descriptions.md` for unguided labs

Unguided labs are about testing skills, so `descriptions.md` gives the learner
what they need to start, and the Medium writeup holds the full solution. Don't
explain concepts or exploitation steps here. Include:

- **Getting Started:** how to start the machine, download the VPN profile,
  connect, find the assigned IP, and reach the service
- **Objectives:** what flags to capture and what must be remediated
- **Recon:** what to look for during reconnaissance (without giving away the
  solution)
- **Endpoints / hints:** where useful, at the level of difficulty you intend
- **Remediation:** what the learner must fix and that the checks must pass (and
  how to SSH in, if remediation is done over SSH)
- Difficulty and category at the bottom

Example skeleton:

```markdown
# Getting Started
Start the machine, download your VPN profile, connect, and browse to
http://<MACHINE_IP>:8080/.

# Recon
...

# Objectives
- Capture both flags.
- Investigate the vulnerability.
- Remediate the vulnerability.
- Pass the remediation checks.

---
**Difficulty**: Medium
**Category**: Web, Linux
```

No screenshots in an unguided room's `descriptions.md`.

## 26. Screenshots (theory rooms and guided labs)

- Reference screenshots the way you would in Obsidian, or with standard
  Markdown — both work:

  ```markdown
  ![[screenshot-name.png]]
  ![A client sends a request and the server returns a response](client-server.png)
  ```

  Put the embed exactly where the screenshot should appear in the text.
- Put every screenshot used in `descriptions.md` in the **same folder** as
  `descriptions.md`. Filenames must match the embeds exactly — case, spaces and
  extension included.
- Don't send screenshots that aren't referenced, and don't reference
  screenshots you didn't send. For theory rooms both of those are hard errors
  that stop the upload.
- Use clear, descriptive names such as `login-request-burp.png`, not
  `Screenshot 2026-11-16 at 10.04.png`.
- Allowed formats: PNG, JPG, JPEG, WEBP, GIF, SVG.

### Never in `descriptions.md`, any room type

No final flags, SSH passwords, cloud credentials, VPN private keys, API tokens,
or production infrastructure secrets.

## 27. `notes.md`

The downloadable reference for learners ("Download Room Notes"). Keep it
compact, and make sure it stands alone without the room. It can include:

- Recon commands and testing methodology
- Linux commands and protocol syntax
- Explanations of the concepts used
- Defensive takeaways

Do not include final flags unless the room design requires it.

## 28. Room icon / cover image

- Filename must exactly match the slug: `<room-slug>.png` (`cover.png` is also
  accepted for theory rooms). Required as soon as the folder holds a second
  image — see Section 22
- Square 1:1, PNG, **truly transparent background** (actually removed, not a
  checkerboard drawn in the image)
- PNG, JPG, WEBP or GIF — **not SVG**
- **Compress the image twice** before delivering to reduce file size
- For theory rooms, do not reference the cover image inside
  `descriptions.md`; the cover is the catalog card, and the lesson's diagrams
  are separate files

Use this prompt to generate the icon (replace the bracketed part):

```text
Create a high-quality, square, icon-style vector illustration representing **[ROOM NAME / ROOM CONCEPT]** for a professional cybersecurity learning platform.

### Visual Style
- **Sleek and Vector-Smooth:** Clean geometric shapes, razor-sharp outlines, smooth edges, and uniform color fills.
- **Matte with Glossy Accents:** Predominantly matte surfaces with carefully placed, high-contrast white highlights to add depth and dimension.
- **Crisp and Graphic:** Sharp transitions, precise details, and polished digital illustration. No film grain, noise, rough textures, or unnecessary blur.
- **Minimalist and Recognizable:** Create a strong central visual that communicates the room's name or underlying concept. Avoid unnecessary details and visual clutter.

### Color Palette
Choose a sophisticated, balanced color palette that complements the room's concept.

- Use natural, harmonious colors.
- Prefer deep, muted shades with carefully selected lighter accents.
- Avoid overly saturated colors and excessive neon effects.
- Avoid the typical AI-generated appearance.
- Make each room icon visually distinctive while maintaining a consistent overall illustration style.

### Composition and Background
- Square 1:1 aspect ratio.
- Center the main subject and make it the dominant visual element.
- Keep the composition balanced, compact, and recognizable even at small icon sizes.
- **Completely transparent background, actual removed background not an visualization of it.**
- No solid-colored canvas, background scenery, circular backgrounds, gradients behind the subject, or surrounding frames.
- Ensure all elements have clean, well-defined edges.
- The icon must look equally good when placed on light or dark website backgrounds.

### Strict Restrictions
- No text, letters, numbers, logos, or watermarks.
- No unnecessary decorative elements.
- No borders or frames.
- No photorealistic or painterly effects.
- No excessive lighting, glow, or visual complexity.

### Final Output
A professionally designed, minimalist yet visually distinctive square PNG icon representing the given room concept, with a genuinely transparent background and clean vector-like styling, ready for direct use on a cybersecurity platform.
```


---

# PART 5 — THEORY ROOMS IN FULL

A theory room has no machine. You submit one folder; the platform reads the
Markdown, pulls the questions out of it, builds the room page and the
workspace, and serves your diagrams from the room's own directory. The answer
key is parsed out of `descriptions.md` and **never written to the published
Markdown**, so learners cannot read the answers from the page source.

## 29. The folder

```text
after-you-press-enter/
├── room.json
├── overview.md
├── descriptions.md
├── notes.md
├── after-you-press-enter.png
├── client-server.png
├── url-anatomy.png
└── dns-lookup-flow.png
```

| File | Required | What it does |
| --- | --- | --- |
| `descriptions.md` | Yes | The lesson. One `##` heading per section, each followed by its own questions. |
| `overview.md` | Yes | Shown on the room landing page before anyone joins. Use `##` headings. |
| `notes.md` | Yes | The "Download Room Notes" file. A standalone cheat-sheet. |
| `<folder>.png` | Yes | Cover image for the catalog card. Name it after the folder, or `cover.png`. |
| `room.json` | Yes | Name, author, catalog blurb, difficulty, category — the facts the Markdown cannot supply. |
| other images | No | Any diagram referenced from `descriptions.md`. PNG, JPG, JPEG, WEBP, GIF or SVG. |

Rules the uploader enforces:

- **Everything is flat.** Files must sit directly in the folder; a subfolder is
  rejected.
- The folder name is the slug: lowercase letters, numbers and hyphens, starting
  and ending with a letter or number. If `room.json` also sets `slug`, it must
  equal the folder name — a mismatch stops the upload instead of picking one,
  because the slug decides both the public URL and the directory the lesson
  images are served from.
- The cover must be identifiable: name it `<slug>.png` or `cover.png`. If
  neither exists and there is more than one image, the upload stops rather than
  guessing which image is the cover.
- Every image referenced from `descriptions.md` must exist in the folder, and
  the cover image does not count as a referenced diagram.

## 30. `room.json`

This file carries only what the Markdown cannot say. Nothing in it is guessed:
a missing required key fails the upload and lists every missing key at once.

| Key | Required | Notes |
| --- | --- | --- |
| `name` | Yes | The room name (see the naming rule in Section 2) |
| `author` | Yes | Your name, as the byline. Never defaulted — a room must not publish under the wrong author |
| `catalog_overview` | Yes | Homepage card text, **max 500 characters**. Not the fictional background: say what the learner will do |
| `difficulty` | Yes | `easy`, `medium` or `hard` — nothing else |
| `category` | Yes | Array, e.g. `["Web", "Fundamentals"]` (a comma-separated string is also accepted). No empty values |
| `slug` | No | Defaults to the folder name; if present it must match it |
| `author_link` | No | HTTPS profile URL |
| `description` | No | Longer internal description; defaults to `catalog_overview` |
| `module` | No | Lowercase URL-safe module slug, if the room belongs to a module |
| `visibility` | No | `draft` or `published`. Set `draft`; we pick draft or published at deploy time, and that choice wins |
| `paid` | No | `true` / `false`, default `false` |
| `guided` | No | Defaults to `true` for theory rooms |

A theory room cannot declare a Docker image, a port, flags, checks, SSH or
privilege escalation. There is no machine, so those fields do not exist for it
— don't copy a lab manifest and delete lines.

```json
{
  "name": "After You Press Enter",
  "author": "Your Name",
  "author_link": "https://www.linkedin.com/in/example/",
  "catalog_overview": "Follow one request from the address bar to the server and back: DNS, TCP, TLS, HTTP and the response that paints the page.",
  "difficulty": "easy",
  "category": ["Web", "Fundamentals"],
  "visibility": "draft",
  "paid": false
}
```

Validate it before sending: `python3 -m json.tool room.json`.

## 31. Writing `descriptions.md`

Open with an `#` title and a short framing line. Everything above the first
`##` is treated as the room's intro and shown on every section. Then write one
`##` heading per section — that heading becomes a step in the learner's
sidebar, and they work through them one at a time, answering that section's
questions before moving on.

### Complete worked example

```markdown
# After You Press Enter

_No machine in this room. Work through one section at a time and answer its
questions before moving on._

---

## Client and Server

Almost everything you do on the web is a conversation between two roles: a
**client** and a **server**.

![A client sends a request and the server returns a response](client-server.png)

| Term   | Meaning                          |
|--------|----------------------------------|
| Client | Software that asks for something |
| Server | Software that waits for requests |

**Try it yourself.** Press F12, open the Network tab and reload the page.

### Questions

1. What do we call the software that starts the conversation? ; client
2. What do we call the program that answers it? ; server
3. Which port does https use by default? ; 443 | port 443

## Anatomy of a URL

You type a **URL** to say what you want and where to get it.

![A URL split into its parts](url-anatomy.png)

### Questions

1. Which part says how to talk to the server? ; scheme
2. Which part is never sent to the server? ; fragment
```

That produces two sections, five questions, and the mapping between them.
Question numbering restarts in every section — the platform assigns the real
ids across the room, so inserting a question never means renumbering the rest.

### Section headings

- Sections are `##` headings. Two sections may not share the same title: their
  anchors would collide.
- At least one `##` section is required.
- If you write every section as `# ` and the document has no `##` headings at
  all, the first `#` is kept as the room title and the rest are promoted to
  sections. Don't rely on it — write `##` and be certain of the result.
- The section heading text is part of the room's wiring, so changing a heading
  after a room is deployed is a content change, not a cosmetic one. Tell us
  if you rename one.

### The question block heading

The block that holds a section's questions is an `###` heading, in any
capitalisation, with an optional trailing colon:

```text
### Questions
### Question
### Quick check
### Knowledge check
```

The block ends at the next heading. A question block before the first `##`
section is an error, and so is `# Questions:` at H1 — that is read as a section
title, and the numbered lines below it become prose, shipping a room with no
graded questions and the answers printed on the page.

### Sections with no questions are fine

Leave the `### Questions` block off entirely and the section is read-only: it
completes as soon as the learner reads it. Useful for a "Your Mission" briefing
or a closing summary.

## 32. The question line

One question per line. A semicolon separates the prompt from its answers; a
pipe separates alternative answers that should all be accepted.

```text
1. Which record maps a name to an IPv6 address? ; AAAA | AAAA record
   │                                              │      │
   │                                              │      └── all accepted
   │                                              └── answers
   └── number (restarts each section), then the prompt the learner sees
```

- The number may be followed by `.` or `)`.
- The prompt and at least one answer are both required.
- Any non-blank line inside a question block that does not parse stops the
  upload with the offending line quoted — there is no silent skipping.

### Never put a semicolon in the prompt

The line splits at the **first** semicolon, so the rest of your question
becomes the answer. Nothing errors — the room just ships a broken question.

```text
1. Is it a; b? ; ans
   → prompt:  "Is it a"
   → answer:  "b? ; ans"
```

## 33. What learners can type and still be marked correct

You do not need to list every phrasing. Grading happens on the server, and
matching already forgives case, surrounding punctuation, extra filler words,
plurals, number words and small spelling mistakes:

| Answer you wrote | Learner typed | Result |
| --- | --- | --- |
| `client` | `Client.` | accepted — punctuation and case |
| `client` | `CLIENT` | accepted |
| `client` | `clinet` | accepted — typo tolerance |
| `resolver` | `the resolver` | accepted — filler word |
| `443` | `four four three` | rejected |
| `3` | `three` | accepted — number word |
| `record` | `records` | accepted — plural |
| `client` | `server` | rejected |

What that means in practice:

- Case, accents, punctuation and spacing are normalised away; `&` counts as
  "and".
- Filler words a learner might add are ignored: `a`, `an`, `the`, `of`, `to`,
  `into`, `and`, `or`, `is`, `are`, `does`, `do`, `what`, `its`, `it`, `be`,
  `as`, `by`, `for`.
- Answers of four characters or more tolerate a single-character typo or two
  transposed letters. Short answers (`TTL`, `443`, `DNS`) are matched strictly,
  so make sure every acceptable short form is listed.
- An answer that is only punctuation — `=`, `+` — is compared exactly, because
  there is no spelling of `=` to be tolerant about. If you want the word form
  accepted too, list it: `= | equals sign`.

Use the pipe for genuinely different wordings a reasonable learner would give —
`TTL | time to live`, `hosts file | the hosts file` — not for spelling
variants, which are already handled.

Keep answers to **one or two words** where you can. A long sentence answer is
matched as a whole string and is much easier to get almost-right and be marked
wrong.

## 34. Theory room pitfalls

- A question block at `#` or `##` level is not a question block.
- A semicolon inside a prompt silently eats the question.
- Two sections with the same title fail the upload.
- A referenced image that isn't in the folder fails the upload; an image in the
  folder that nothing references is dead weight (and if the cover can't be
  identified by name, it is also ambiguous).
- `catalog_overview` over 500 characters fails.
- `difficulty` must be exactly `easy`, `medium` or `hard`.
- Don't ask about anything the room text doesn't explain. Every question must
  be answerable from the section it sits under.
- There are no flags, no machine IP, no VPN steps and no SSH instructions in a
  theory room.

---

# PART 6 — OFFICIAL WRITEUP (unguided labs only)

## 35. The Medium writeup

Every unguided lab needs an official writeup **published on Medium**. Put its
HTTPS link in the manifest as `writeup_url`. Theory rooms and guided labs do not
have a writeup.

**The writeup is not a lesson.** Assume the reader already has the foundational
knowledge. Don't explain concepts in detail (what SQL injection is, how SSRF
works, and so on). Just walk through the exploitation step by step: what you
did, the command or request you sent, what came back, and what you did next. A
one-line note on why a step works is fine; a full explanation is not.

Follow this structure:

```text
Overview of the room
Getting Started
Exploitation
  1. Flag 1
  2. Flag 2
  3. Flag 3 … (as needed)
Extra Mile Fixes: how to SSH into the machine and which file to edit
  Fix 1
    1. Exact vulnerable code snippet
    2. Why it is vulnerable
    3. Exact fixed code
    4. Why it is secure
  Fix 2
    (same structure)
  …
```

Rules:

- Include screenshots for every important step
- Use placeholders like `<MACHINE_IP>` and `<SSH_PASSWORD>`, never real
  credentials
- The file paths you name must match the real paths in the container
- You can show flags as `BTR{...}` in screenshots of local test runs, since
  production flags are injected at deploy time and differ from your local test
  flags


---

# PART 7 — MANIFEST (guided and unguided labs)

Theory rooms use `room.json` (Section 30) instead.

## 36. What goes in the manifest

The manifest is machine-readable metadata. Keep it short. Do **not** put the
full Company Background, Incident or room briefing in it. That goes in
`overview.md`.

| Field | Required | Notes |
| --- | --- | --- |
| `slug` | Yes | Lowercase, URL-safe; must match the icon filename |
| `name` | Yes | Room name (see the naming rule) |
| `author` | Yes | Your name |
| `author_link` | Optional | HTTPS profile URL |
| `description` | Yes | Short internal metadata description |
| `catalog_overview` | Yes | Homepage card text, **max 500 characters** |
| `docker_image` | Yes | Unique image name, e.g. `btr/<room-slug>:latest` |
| `container_port` | Yes | Integer 1–65535, must exactly match the port the app listens on |
| `challenge_username` | Yes | Default Linux user; entrypoint must still create whatever we configure |
| `required_flags` | Yes | One entry per red flag, each with an integer `id` in **1–4** |
| `extra_checks` | Yes | One entry per remediation check, each with an integer `id` in **1–4** (empty array if none) |
| `difficulty` | Yes | e.g. `easy`, `medium`, `hard` |
| `category` | Yes | Array, e.g. `["Web", "Linux"]` |
| `visibility` | Yes | Submit as `"draft"`; we publish after testing |
| `guided` | Yes | `true` or `false` |
| `writeup_url` | Unguided only | Medium link, must be HTTPS |
| `paid` | Yes | `true` / `false` |
| `ssh_enabled`, `ssh_required` | Yes | `true` / `false`. If `ssh_enabled` is true, `ssh_required` must be true as well |
| `ssh_username`, `ssh_password` | If SSH enabled | Use a **placeholder** password; never a real one |
| `privilege_escalation` | Yes | `true` / `false`. Leaving it false keeps "no new privileges" on |

## 37. Example manifest

```json
{
  "slug": "sentinel-log",
  "name": "SentinelLog",
  "author": "Hassan Ahmed Malik",
  "author_link": "https://www.linkedin.com/in/example/",
  "description": "SIEM log injection and exposed diagnostics challenge.",
  "catalog_overview": "Analyze forged SIEM logs, investigate exposed diagnostics, and fix the logging and access-control weaknesses.",
  "docker_image": "btr/sentinel-log:latest",
  "container_port": 8080,
  "challenge_username": "app",
  "required_flags": [
    { "id": 1, "label": "User flag" },
    { "id": 2, "label": "Root flag" }
  ],
  "extra_checks": [
    { "id": 1, "label": "Verify the logging and access-control fixes" }
  ],
  "difficulty": "medium",
  "category": ["Web", "Linux", "Log Injection"],
  "visibility": "draft",
  "guided": false,
  "writeup_url": "https://medium.com/@author/sentinel-log-official-writeup",
  "paid": false,
  "ssh_enabled": true,
  "ssh_required": true,
  "ssh_username": "app",
  "ssh_password": "replace-with-room-password",
  "privilege_escalation": true
}
```

For a **guided** lab: set `"guided": true` and leave out `writeup_url`.

## 38. Manifest rules

**Slug:** lowercase letters, numbers and hyphens only; 3–64 characters; must
start and end with a letter or number; must match the PNG filename.

- Valid: `session-lab`, `invoice-after-dark`, `unguessable-not-authorized`
- Invalid: `Example-Room`, `example_room`, `-room`, `room-`

**Docker image:** unique per room. Never reuse another room's image name.

**Port:** must exactly match the app's listening port.

**Flags and checks:** `required_flags` and `extra_checks` are arrays of objects
with an integer `id` and a `label`. Ids must be in **1–4** — the platform
serves `red-flag1`–`red-flag4` and runs `check1.sh`–`check4.sh`, so a fifth of
either cannot be graded. Every id must have its file in the backend package,
and no check script may exist that isn't declared.

**Booleans are booleans:** `true` / `false`, not `"true"`.

**Secrets:** never include production secrets. The real SSH password is set by
us at deploy time. The SSH password in your manifest is a placeholder only, and
the local runner ignores it entirely.

**Some fields are re-stated by us at deploy time.** `guided`,
`writeup_url`, `paid`, `ssh_enabled`, `ssh_required`, `ssh_username`,
`ssh_password` and `privilege_escalation` are form controls on the deployment
page, and what the form sends overrides the manifest. That is not licence to
leave them wrong: we set the form **from your manifest**, so a wrong value
there becomes a wrong deployment. Say in your submission notes if any of them
is unusual for your room.

**`author_link` and `writeup_url` must be HTTPS**, with a host, and no
credentials in the URL.

Validate the JSON before sending:

```sh
python3 -m json.tool <room-slug>-manifest.json
```

---

# PART 8 — LOCAL TESTING (guided and unguided labs, required before you submit)

We push your package to production, and you never get a shell on the platform
to debug it there, so everything has to be proven locally first.

All local testing is done with the **local room runner**, `local-room.py` — one
Python file that needs nothing installed beyond Python and Docker. Download it
from the submission page:

```text
https://breaktheroot.com/submit-a-room/local-room.py
```

It is the same runner we use on our side, and that is the point: it validates
your package against this guide, builds and runs your room in a disposable
Docker container on localhost, with the same package contract and container
limits that production deployments use. If your room works under the runner, it
should work on the platform.

Because the runner normally lives inside our repository at
`local-room.py`, one or two of the hints it prints spell that path out.
That is the same file you downloaded. Throughout this guide the commands are
written as `python3 local-room.py`, run from wherever you saved it.

The runner accepts either:

- an **unzipped package folder** (with the manifest next to the backend files),
  or
- the **exact backend ZIP you will submit**, with `--manifest` pointing at the
  manifest you will send alongside it.

Test both. The ZIP is what you submit, so the last test you run should be the
ZIP.

## 39. What the runner does

When you start a room, the runner:

1. Finds and validates the manifest
2. Validates the package layout against the submission rules (and the ZIP
   layout, when you pass a ZIP)
3. Finds the package `Dockerfile`
4. Builds the image if it isn't already built locally
5. Mounts your red flags read-only at `/opt/seed-flags/`
6. Mounts your `checks/` folder read-only at `/opt/btr/checks/`
7. Injects `SSH_USERNAME` and `SSH_PASSWORD` when SSH is enabled
8. Starts a constrained, disposable container
9. Waits for the web port to open and prints the local URL

It applies the same limits as production:

| Limit | Value |
| --- | --- |
| Memory | 512 MB |
| CPU | 1 core |
| Processes (PIDs) | 128 |
| Capabilities | All dropped, then only `DAC_OVERRIDE`, `CHOWN`, `FOWNER`, `SETUID`, `SETGID` added |
| Extra capabilities | `AUDIT_WRITE` and `SYS_CHROOT` when SSH is enabled |
| `/run` | tmpfs, 16 MB, `noexec,nosuid` |
| `/tmp` | tmpfs, 64 MB, `noexec,nosuid` |
| No new privileges | On, unless the manifest sets `"privilege_escalation": true` |
| Published ports | `127.0.0.1` only, never exposed to the network |

What this means for your room:

- **`/run` and `/tmp` are wiped and replaced at startup.** Anything your
  Dockerfile puts in `/run` (such as `/run/sshd`) is gone. Your `entrypoint.sh`
  must recreate it at runtime (`mkdir -p /run/sshd`).
- **Nothing can be executed from `/run` or `/tmp`.** Don't put scripts,
  binaries or app files there.
- **Stay within 512 MB and 128 processes.** Keep gunicorn workers/threads
  modest (2 workers × 4 threads is fine).
- **Don't rely on capabilities that aren't in the table.** If the room doesn't
  work under these limits, it won't work in production.

## 40. Requirements

- Python 3.10 or newer
- Docker installed and running (check with `docker info`)
- A free local web port (default `8080`)
- A free local SSH port if SSH is enabled (default `2222`)
- `local-room.py`, downloaded from the submission page

Run the commands from the folder you saved `local-room.py` in, and give it the
path to your room package:

```sh
cd /path/to/the/folder/you/saved/it/in
python3 local-room.py /path/to/<room-slug> --validate
```

## 41. Prepare the package folder

The folder form of the runner works on an **unzipped package folder**. For
testing, the folder must contain the manifest next to the backend files:

```text
<room-slug>/
├── <room-slug>-manifest.json    ← or manifest.json; needed for local testing only
├── Dockerfile
├── entrypoint.sh
├── app/
├── flags/
│   ├── red-flag1.txt
│   ├── red-flag2.txt
│   └── blue-flag1.txt
└── checks/
    └── check1.sh
```

Before you run anything:

- **The manifest must have a valid slug**, or the runner refuses to start
  ("no manifest.json or `<slug>-manifest.json` at the root").
- **There must be exactly one `Dockerfile`**, at the root of the folder.
- **Make every check executable on your machine:** `chmod +x checks/*.sh`. The
  checks folder is mounted read-only, so the runner can't fix the permissions
  inside the container. Create the ZIP on Linux or macOS so the executable bit
  survives.
- **Your image needs `/usr/bin/timeout`.** The runner calls it to enforce the
  check timeout. Ubuntu and Debian images have it by default.
- Set `ssh_enabled`, `ssh_required` and `privilege_escalation` in the manifest
  to match how the room will really be deployed. The runner uses them to decide
  which capabilities to grant.

**Remember:** the manifest is in this folder for testing only. When you build
the final backend ZIP, leave the manifest out (Section 6) and send it
separately as `<room-slug>-manifest.json`.

## 42. Validate before you start

This runs every submission check without building or starting anything. Do it
first — it is the fastest way to find a layout, flag or manifest mistake:

```sh
python3 local-room.py /path/to/<room-slug> --validate
```

And on the ZIP you intend to send:

```sh
python3 local-room.py /path/to/<room-slug>-backend.zip \
  --manifest /path/to/<room-slug>-manifest.json --validate
```

It fails on, among other things: a bad slug or port, a flag or check id
outside 1–4 or declared twice, a wrapper folder, a missing or non-executable
`entrypoint.sh`, a manifest inside the ZIP, a ZIP inside the ZIP, a missing or
malformed flag file, a declared check with no script, a script with no
declaration, a non-executable check, and a `catalog_overview` over 500
characters. It warns about a missing `app/` folder,
a `visibility` that isn't `draft`, and an unguided room with no HTTPS
`writeup_url`.

Fix everything it prints before moving on.

## 43. Start the room

Without SSH:

```sh
python3 local-room.py /path/to/<room-slug> --port 8080
```

With SSH (the password comes from the environment so it doesn't end up in your
shell history):

```sh
BTR_LOCAL_SSH_PASSWORD='local-test-password' \
python3 local-room.py /path/to/<room-slug> \
  --port 8080 \
  --ssh-port 2222 \
  --ssh
```

If the manifest has `"ssh_enabled": true`, SSH turns on automatically and the
runner will refuse to start without a password. The SSH password in the
manifest is **not** used; always pass a local one.

The runner prints something like:

```text
Room started: <Room Name> (<room-slug>)
Web:        http://127.0.0.1:8080/
SSH:        ssh -p 2222 app@127.0.0.1
Password:   the one you supplied locally
Container:  btr-local-<room-slug>
Image:      btr-local-<room-slug>:latest
Probe:      HTTP 200 on /
Logs:       docker logs -f btr-local-<room-slug>
Stop:       python3 tools/local-room.py /path/to/<room-slug> --stop
```

- The container is named `btr-local-<slug>` by default.
- The runner probes `/health` and then `/` over HTTP. A simple `/health` route
  returning 200 is a good idea but not required.
- If the runner prints `Probe: TCP listener only`, the port is open but neither
  `/health` nor `/` answered. Check the logs.
- It waits up to 60 seconds for an answer; raise it with `--timeout` if your
  room genuinely needs longer to seed.

**SSH username:** taken from `--ssh-username`, then `ssh_username` in the
manifest, then `challenge_username`, then `app`. To override it:

```sh
BTR_LOCAL_SSH_PASSWORD='local-test-password' \
python3 local-room.py /path/to/<room-slug> --ssh --ssh-username app
```

## 44. Test the web app and SSH

Open the printed URL (normally `http://127.0.0.1:8080/`) and follow the
application logs in another terminal:

```sh
docker logs -f btr-local-<room-slug>
```

Check that the expected pages load and the container stays up.

For SSH rooms, use the connection command the runner printed:

```sh
ssh -p 2222 -o StrictHostKeyChecking=no app@127.0.0.1
ssh -p 2222 -o StrictHostKeyChecking=no app@127.0.0.1 'id && echo "$SHELL"'
ssh -p 2222 app@127.0.0.1 'ls -la /opt/app && test -w /opt/app/server.py'
```

Verify: login works, the connection stays open, the shell is `/bin/bash`,
`nano` and `micro` open, and the vulnerable source file is writable.

## 45. Test remediation checks

Checks run inside the room that's **already running**. They don't start the
room for you.

```sh
python3 local-room.py /path/to/<room-slug> --check 1
python3 local-room.py /path/to/<room-slug> --check 2
```

- A passing check prints `Check 1: passed` and the matching blue flag from
  `flags/blue-flag1.txt`.
- A failing check prints `Check 1: failed` and exits with status 1.
- A check passes only if it exits `0` **and** prints exactly `true`. Anything
  else is a fail.
- **Each check has 10 seconds.** A check that takes longer is killed and counts
  as a fail.

Run the full cycle:

1. **Before patching:** the exploit works, the legitimate feature works, and
   `--check N` **fails**.
2. **Apply the fix over SSH**, exactly as the learner would (edit the file with
   `nano` or `micro`, restart anything that needs restarting).
3. **After patching:** the exploit fails, the legitimate feature still works,
   `--check N` **passes**, and the service is still running.

Also prove the check can't be cheated: stop the app, or break the feature, and
confirm `--check N` **fails**.

## 46. Rebuild after changes

The runner reuses the existing image when it can. After changing your
Dockerfile or any app files, force a rebuild and replace the old container:

```sh
BTR_LOCAL_SSH_PASSWORD='local-test-password' \
python3 local-room.py /path/to/<room-slug> \
  --port 8080 \
  --ssh-port 2222 \
  --ssh \
  --rebuild \
  --replace
```

`--replace` only removes the container with the same name. It doesn't touch
other containers or images.

## 47. Test restart and redeploy

Production replaces containers during redeployment, and a stopped container is
never reused — every start comes from the image. So the room must start clean
every time.

```sh
python3 local-room.py /path/to/<room-slug> --stop
python3 local-room.py /path/to/<room-slug>              # add --ssh and the password if needed
```

`--stop` removes the container and all its runtime state; the image stays.
After restarting, verify that:

- The app starts and the web port opens
- Baseline database rows exist again
- Flags are available at the intended location
- SSH works
- Nothing depends on the old container's state
- Fixes from the previous run are gone (the room is vulnerable again)

Then do one full `--rebuild --replace` run to confirm the image still builds
from scratch.

## 48. Build with the legacy builder

The runner builds with your default Docker builder. Production must also work
with the legacy builder, so run it once:

```sh
python3 local-room.py /path/to/<room-slug> --rebuild --replace --legacy-build
```

Or directly, from the package folder:

```sh
DOCKER_BUILDKIT=0 docker build --pull=false -t btr-local-<room-slug>:legacy .
docker image inspect btr-local-<room-slug>:legacy
```

A BuildKit "cleanup attempted" message on its own doesn't prove success or
failure. Inspect the image.

## 49. Validate the final ZIP

Build the ZIP from **inside** the package folder, leaving the manifest out:

```sh
cd /path/to/<room-slug>
zip -r ../<room-slug>-backend.zip Dockerfile entrypoint.sh app flags checks
```

Then check it — first with the runner, which applies every submission rule:

```sh
python3 local-room.py ../<room-slug>-backend.zip \
  --manifest ../<room-slug>-manifest.json --validate
```

and by hand:

```sh
unzip -l ../<room-slug>-backend.zip
unzip -q ../<room-slug>-backend.zip -d /tmp/room-check
test -x /tmp/room-check/entrypoint.sh && echo "entrypoint OK"
wc -l /tmp/room-check/flags/red-flag1.txt /tmp/room-check/flags/red-flag2.txt
```

Confirm: `Dockerfile`, `entrypoint.sh`, `app/`, `flags/` and `checks/` at the
root, no wrapper folder, no nested ZIP, no manifest, and each flag file is
exactly one line.

Finish by starting the room **from the ZIP** and running the checks once more,
so the thing you submit is the thing you tested.

## 50. Test the UI end to end

- Visit every route and confirm it renders correctly
- Click every vulnerable-feature button/form and confirm the endpoint fires
- Confirm the happy path works before any exploit
- Confirm decoy pages and story pages load
- Confirm all images load (no broken links)
- Confirm there is no `#section` navigation
- Confirm there are no console errors on the main pages

## 51. Stop the room

```sh
python3 local-room.py /path/to/<room-slug> --stop
```

If you started it with a custom `--name`, pass the same name to `--stop` and
`--check`:

```sh
python3 local-room.py /path/to/<room-slug> --name my-room --check 1
python3 local-room.py /path/to/<room-slug> --name my-room --stop
```

## 52. Runner command reference

```text
python3 local-room.py PACKAGE [OPTIONS]
```

| Option | Default | Purpose |
| --- | --- | --- |
| `PACKAGE` | required | Room package folder, or the backend ZIP |
| `--manifest PATH` | found automatically | Manifest path; required for a ZIP unless one sits next to it |
| `--port PORT` | `8080` | Host web port mapped to the container port |
| `--ssh-port PORT` | `2222` | Host SSH port mapped to container port 22 |
| `--ssh` | off | Enable SSH even if the manifest doesn't request it |
| `--ssh-username USER` | manifest value | Override the local SSH username |
| `--ssh-password PASSWORD` | env / empty | Local SSH password (prefer `BTR_LOCAL_SSH_PASSWORD`) |
| `--name NAME` | `btr-local-<slug>` | Custom container name |
| `--replace` | off | Remove an existing container with the same name first |
| `--rebuild` | off | Rebuild the image before starting |
| `--legacy-build` | off | Build with the legacy builder (`DOCKER_BUILDKIT=0`) |
| `--timeout SECONDS` | `60` | How long to wait for the app to answer |
| `--validate` | off | Only validate the package; don't build or start it |
| `--stop` | off | Stop and remove the room container |
| `--check N` | none | Run `checks/checkN.sh`; print `flags/blue-flagN.txt` if it passes |

## 53. Troubleshooting

| Problem | Fix |
| --- | --- |
| Docker is not installed or not on PATH | Install Docker, start the daemon, verify with `docker info` |
| Local port already in use | Use other host ports: `--port 8081 --ssh-port 2223`. The container still listens on the manifest's port; only the host side changes |
| `container ... already exists` | Run with `--stop` first, or start with `--replace` |
| Web port never opens | Run `docker logs btr-local-<slug>`. Usual causes: the app crashes at startup, `container_port` doesn't match the app, the app binds to `127.0.0.1` instead of `0.0.0.0`, or `entrypoint.sh` doesn't start the web service |
| `--check N` says the container is missing | Start the room first; checks only run inside a running room |
| SSH enabled but no password supplied | Set `BTR_LOCAL_SSH_PASSWORD` before starting |
| SSH fails right after start | Make sure `entrypoint.sh` creates `/run/sshd` at runtime (the runner replaces `/run` with an empty tmpfs) |
| Check fails with "permission denied" | Run `chmod +x checks/*.sh` on your machine and restart the room |
| Check reports `/usr/bin/timeout` is missing | Install coreutils in the image |
| `no manifest.json or <slug>-manifest.json` | Put the manifest in the package folder (or pass `--manifest`) and make sure the slug follows the slug rules |
| The package "does not meet the submission guidelines" | Read the list it prints; every line is one rule from Part 2 or Part 7 |

## 54. Safety

- The runner is only for rooms you own or are authorized to test.
- `flags/` contains challenge secrets. Keep it out of public archives and make
  sure your `.gitignore` excludes it before sharing anything.
- Don't commit passwords, flags, VPN profiles or generated room databases to
  any repository.
- The runner publishes ports on `127.0.0.1` only. Don't "fix" that by
  publishing on `0.0.0.0` — you would be exposing a deliberately vulnerable app
  to your network.

## 55. `local-test-results.md`

Include in your submission:

- The runner's `--validate` output (clean)
- The runner's start output (the `Room started` block)
- Results of `--check N` before and after the fix (fail, then pass)
- Proof the check fails when the app is stopped or the feature is broken
- Restart test results
- Legacy builder result
- `unzip -l` output of the final ZIP, and the clean `--validate` run against
  the ZIP
- Screenshots of the running UI
- Any setup notes needed to redeploy

---

# PART 9 — AFTER YOU SUBMIT

## 56. How to send it

The submission form is at **https://breaktheroot.com/submit-a-room/**. It asks
who you are, what the room is, and for one link to the files.

**Put the files somewhere we can download them.** The form takes a link rather
than an upload, because a backend package, a cover image and a folder of
screenshots are far too much to push through a web form reliably. Google Drive,
Dropbox, OneDrive, WeTransfer, a private GitHub repository or a release asset
are all fine. What matters is:

- **One link**, holding everything Part 1 lists for your room type.
- **Anyone with the link can download it** without asking for access. A
  "request access" screen is the most common reason a submission stalls.
- **It stays alive for a few weeks.** A transfer link that expires in seven
  days can go dead before anyone has read it.
- **Your room's internals are not public.** Local test flags are throwaway
  values, but a public repository containing the room's checks and solution
  spoils the room before it ships. Keep it private, or send a ZIP.

Use the notes field for anything unusual: a manifest field that is deliberately
set the way it is, a room that replaces an earlier deployment of the same slug,
or a part of the room you are unsure about.

Leave an email address you actually read. It is the only way we can come back
to you with questions, or tell you the room is live.

## 57. Review, drafts and publishing

What happens to your files:

1. **We read the package and run the same validator you did.** A package that
   fails validation comes back to you with the output, so run it yourself first
   (Part 8) — that round trip is the slowest part of the whole process, and it
   is entirely avoidable.
2. **We deploy it as a draft.** A draft is live on the platform but visible
   only to us: the room page, the workspace, the machine and the remediation
   checks all behave exactly as they will for learners.
3. **We verify it.** The machine starts, the exploitation path works over the
   VPN, every flag grades, every check fails before the fix and passes after
   it, and the room content reads correctly in the workspace.
4. **Production flags are generated at deploy time.** The values in your ZIP
   are local test values and are thrown away — which is why your app has to
   read its flags from `/opt/seed-flags/` at startup instead of baking them in.
5. **We set the SSH password,** not your manifest.
6. **We publish it,** and the room appears in the catalog under the author name
   and profile link from your manifest.

If something needs changing, we come back to you with specifics. Send fixes as
**one replacement package** rather than a drip of small corrections: a redeploy
of a live room removes that room's running containers, so every redeploy
interrupts anyone who is mid-room.

### Things about production that change how you build

- **Flags are injected, not shipped.** Production flag values are generated at
  deploy time and mounted read-only at `/opt/seed-flags/`. They are not the
  values in your ZIP, which is why the app must read them at startup and why
  showing your local flags in a writeup screenshot is harmless.
- **Flags are graded server-side.** The browser only ever sees flag ids and
  labels; submissions are compared against host-only files. Ids are `1`–`4`,
  which is the real reason for the limit in Section 13.
- **Remediation checks** are mounted read-only at `/opt/btr/checks/` and run
  inside the learner's own container with a hard 10-second limit — the same
  conditions as `--check N` locally. A pass releases the blue flag.
- **Containers are disposable and never reused.** A stopped room is thrown away
  and the next start comes from the immutable image, because the writable layer
  may hold the learner's own exploit. This is why Section 12 matters.
- **Each learner gets their own container** on a per-user network, reached over
  the platform VPN.
- **A redeploy of a live room removes that room's running containers**, so
  learners mid-room are interrupted. Expect your fixes to be batched, and send
  them as one package rather than a drip of small corrections.
- **After a room is live**, renaming a theory section heading, moving a flag,
  or changing the vulnerable file's path is a coordinated change. Tell us
  rather than sending a silently different folder.
- **AI-powered rooms** (a live model behind the room) go through a separate
  deploy path with its own contract: a fixed container port, no privilege
  escalation, draft-only first deploy, and enrolment with the inference proxy.
  Ask before building one.

---
# PART 10 — FINAL CHECKLIST

### Room type and naming

- [ ] Room type decided: theory, guided or unguided
- [ ] Room name and in-world company name are original, not AI-suggested

### Theory rooms only

- [ ] One flat folder, named exactly as the slug
- [ ] `room.json` present with `name`, `author`, `catalog_overview`,
      `difficulty` (`easy`/`medium`/`hard`), `category`
- [ ] `room.json` is valid JSON; `catalog_overview` ≤ 500 characters
- [ ] `room.json` has no `slug`, or one equal to the folder name
- [ ] `overview.md`, `descriptions.md`, `notes.md` present
- [ ] Cover named `<slug>.png` (or `cover.png`), not an SVG, not referenced in
      the lesson
- [ ] `descriptions.md` opens with an `#` title and intro, then one `##` per
      section
- [ ] No two sections share a title
- [ ] Each section's questions sit under an `###` block heading
      (`Questions` / `Quick check` / `Knowledge check`)
- [ ] Every question line is `N. prompt ; answer | alternative`
- [ ] No semicolon anywhere inside a prompt
- [ ] Answers are one or two words; short answers list every acceptable form
- [ ] Every question is answerable from the text in its own section
- [ ] Every referenced diagram is in the folder; nothing unreferenced is sent
- [ ] No backend ZIP, flags, machine instructions or SSH anywhere in the room
- [ ] `visibility` is `draft`
- [ ] Folder is at most 60 files and 60 MB
- [ ] Skip the backend, UI, writeup and local-testing sections below

### Backend (guided and unguided labs)

- [ ] Backend ZIP has `Dockerfile` at root
- [ ] Backend ZIP has executable `entrypoint.sh` at root
- [ ] No outer wrapper folder and no nested ZIP
- [ ] No manifest inside the ZIP
- [ ] Dockerfile builds without prompts
- [ ] BuildKit/buildx build tested
- [ ] Legacy Docker build tested
- [ ] App binds to `0.0.0.0`
- [ ] Declared port works and matches `container_port`
- [ ] App stays in the foreground
- [ ] DB initializes on fresh startup
- [ ] Runtime secret is stable across workers
- [ ] `/usr/bin/timeout` present in the image
- [ ] `nano` and `micro` installed when SSH is enabled
- [ ] `/opt/app` writable for remediation
- [ ] SSH user created dynamically
- [ ] SSH password read dynamically (not hardcoded)
- [ ] SSH user has a real shell (`/bin/bash`)
- [ ] SSH interactive login works
- [ ] SSH non-interactive command works
- [ ] `entrypoint.sh` recreates `/run/sshd` at runtime
- [ ] Required capabilities tested locally
- [ ] `red-flag1.txt` and `red-flag2.txt` exist, non-empty, one `BTR{...}` line each
- [ ] Every flag and check id is in 1–4 (at most four of each)
- [ ] Flags read from `/opt/seed-flags/`, none baked into the image
- [ ] Every declared check has `checkN.sh`, executable
- [ ] Every declared check has `blue-flagN.txt`
- [ ] No check script that isn't declared in `extra_checks`
- [ ] Checks print exactly `true` or `false` and finish within 10 seconds
- [ ] Exploit works before remediation
- [ ] Legitimate feature works before remediation
- [ ] Exploit fails after remediation
- [ ] Legitimate feature works after remediation
- [ ] Check fails when the app is stopped or the feature is broken
- [ ] Restart behavior tested

### UI (guided and unguided labs)

- [ ] Dark mode, muted palette
- [ ] No yellow/purple/blue AI colors
- [ ] Real downloaded images used
- [ ] Every intended vulnerable endpoint has a visible button/form/card
- [ ] Every page has its own route (no `#section`)
- [ ] 3–6 decoy routes present
- [ ] 2–3 story pages present
- [ ] Copy reads human-written
- [ ] All images load, no broken links
- [ ] No console errors on main pages

### Frontend folder (labs)

- [ ] `overview.md`, `descriptions.md`, `notes.md` exist
- [ ] `<room-slug>.png` exists, named exactly after the slug, transparent
      background, compressed twice
- [ ] `overview.md`, `descriptions.md`, `notes.md` and the cover are at the top
      level of the folder
- [ ] No `writeup.pdf` / `writeup.md` / `index.html` included
- [ ] Guided: `descriptions.md` explains every concept before the walkthrough
- [ ] Guided: concepts already covered in a theory room get a short recap only
- [ ] Guided: every `![[screenshot.png]]` has a matching file in the folder
- [ ] Unguided: `descriptions.md` covers Getting Started, Recon, Objectives,
      Remediation, with no solution and no screenshots

### Local testing (guided and unguided labs)

- [ ] `python3 local-room.py <folder> --validate` is clean
- [ ] `python3 local-room.py <zip> --manifest <manifest> --validate` is clean
- [ ] Room starts and the probe returns a response
- [ ] Room works within the runner's limits (512 MB, 128 PIDs, dropped caps)
- [ ] `--check N` fails before the fix and passes after it
- [ ] `--check N` fails when the app is stopped or the feature is broken
- [ ] Room comes back clean after `--stop` and a fresh start
- [ ] Legacy builder build tested
- [ ] Final ZIP built from inside the folder, without the manifest, and started
      from the ZIP once
- [ ] `local-test-results.md` written

### Writeup and manifest

- [ ] Unguided: official writeup published on Medium, following the required
      structure
- [ ] Unguided: writeup is step-by-step exploitation only, no concept lessons
- [ ] Manifest JSON is valid
- [ ] Manifest slug matches the icon filename
- [ ] `guided` set correctly; `writeup_url` present (HTTPS) for unguided rooms
- [ ] `catalog_overview` is 500 characters or less
- [ ] `visibility` is `"draft"`
- [ ] `ssh_required` is true wherever `ssh_enabled` is true
- [ ] Flag and check ids are in 1–4 and match the files in the ZIP
- [ ] Submission notes say whether this is a new room or replace an earlier
      deployment of the same slug
- [ ] SSH password in the manifest is a placeholder

### Before you send it

- [ ] One download link with everything for your room type, open to anyone who
      has it, not expiring in the next few weeks
- [ ] An email address you read on the submission form
- [ ] Notes cover anything unusual, and say whether this replaces an earlier
      deployment of the same slug

### Secrets

- [ ] No secrets, real passwords or production flags anywhere
- [ ] No credentials in `overview.md`, `descriptions.md`, `notes.md`,
      JavaScript or the writeup
- [ ] No production host paths assumed