Open-source cybersecurity training
Learn cybersecurity by breaking a real application.
Bastion Academy runs on your own machine with Docker. Each module starts with a real vulnerability: you exploit it in an isolated lab and capture your flag, then you read the exact code and the test that stop the same attack on Bastion.
- 6levels
- 50lessons
- 28challenges
- 10live labs
- MIT licence
# get the code
$ git clone https://github.com/Azog1812/bastion-academy
$ cd bastion-academy
# build the platform, generate your own secrets
$ docker build -t bastion:local .
$ docker run --rm bastion:local dist/cli.js gen-secrets > .env
# build the labs once, then start
$ docker compose --profile labs build
$ docker compose up -d
✓ http://localhost:3000
The method
Break it, then fix it
Reading about a vulnerability teaches you its name. Exploiting it, then finding the line of code that would have stopped you, teaches you the flaw. Here is one module, from start to finish.
Exploit it in a lab
An invoicing API, started for you alone. You can read your own invoices; change the id in the URL and you read someone else's. The confidential one holds your flag. That is an IDOR, first in the OWASP API Top 10.
# your account, someone else's invoice GET /api/factures/1001 # not yours Authorization: Bearer <your token> 200 OK {"id":1001,"client":"Fonds stratégique","montant":250000, "note":"Accord confidentiel, référence BASTION{…}"}Try the same attack on Bastion
Bastion has the same kind of resource: notes. Ask for another user's note and you get a 404, the same answer as for a note that does not exist. You learn nothing, not even that it exists.
# Mallory asks for Alice's note GET /v1/notes/3f9c… Authorization: Bearer <mallory> 404 Not Found {"error":"not_found","message":"Note not found","requestId":"…"}Read the defence
The owner is part of the SQL query itself, so a foreign note is never fetched. A Semgrep rule rejects any new note query that forgets it, before the code is merged.
// src/services/note-service.ts tx.one('SELECT * FROM notes WHERE id = ? AND owner_id = ?', noteId, ownerId) # .semgrep/bastion.yml: the rule that guards it bastion-note-query-without-ownerRun the test that proves it
The claim is a test: another account tries to read, change and delete the note, and must not be able to tell it exists. You run it yourself.
// test/security/authorization.test.ts it("another user can neither read, modify nor delete it — and can't tell it exists", …) $ npx vitest run test/security/authorization.test.ts Tests 10 passed (10)
Every module of the path works this way: SQL injection, JWT forgery, brute force, SSRF, race conditions… The attack is real, and so is the code you study.
Curriculum
Six levels, from first principles to certification
Lessons, quizzes graded on the server, and hands-on work at every level. A module opens once its prerequisites are done.
- 1
Fundamentals
Security basics, HTTP, sessions and JWT, a first “break it, then fix it” module on IDOR.
- 2
Web and API security
SQL injection, XSS, CSRF, JWT attacks, mass assignment, function-level access control.
- 3
Systems and networks
TCP/IP, DNS and TLS, legal port scanning, Linux privilege escalation, containers, Windows, Kerberos and Active Directory.
- 4
Penetration testing
Legal frame and rules of engagement, PTES and OWASP WSTG, chaining flaws, CVSS 4.0, a report that gets things fixed.
- 5
Defence and detection
What to log, SIEM and correlation, detection rules, incident response (NIST SP 800-61r3), first forensics; optional Wazuh module.
- 6
Expert
Race conditions, insecure deserialization, Kerberos delegation, AD CS and DCSync and how to detect them, preparing a 24-hour practical exam.
The lessons and the web interface are in French. The code and the technical documentation are in English.
Hands-on
Real targets, each in its own box
Every learner gets their own flags, generated for them alone: a flag copied from a friend does not work.
10 live labs
A real vulnerable service, started for you, reachable only from your machine, stopped automatically.
| Lab | Level | What you do |
|---|---|---|
| Les factures des autres | L 1 | Read other customers' invoices (IDOR) |
| Entrer sans mot de passe | L 2 | Log in without a password (SQL injection) |
| Promu administrateur | L 2 | Sign up as an administrator (mass assignment) |
| Un jeton sans signature | L 2 | Forge a token with alg: none |
| Un modérateur trop confiant | L 2 | Steal a moderator's cookie (stored XSS, real headless browser) |
| Un aperçu trop curieux | L 2 | Make the server call its own admin service (SSRF) |
| Le dossier d’à côté | L 3 | Leave the download folder (path traversal) |
| Un shell, mais dans une cage | L 3 | Get a shell, then see why you cannot escape |
| Trois failles, une chaîne | L 4 | Chain three flaws, none enough on its own |
| Une carte cadeau, plusieurs fois | L 6 | Redeem a single-use gift card many times (race condition) |
11 investigation challenges
Tasks from the job, each with data generated for you: peel encodings and break home-made crypto, crack a weak JWT secret, rebuild a blind SQL injection from an access log, decode a network capture, triage a password spray in Windows events.
7 detection challenges
Write the detection rule, and the server scores it on a log dataset made for you, with traps for naive rules. Solved only with every attack caught and zero false positives. Two of them use real Wazuh XML rules.
Heavy modules stay optional
A real Wazuh SIEM (about 4 GB of RAM) or the monitoring stack: each learner adds them from the interface if their machine can run them. Leaving one out never blocks the rest of the path.
Install
Running in a few minutes
Git and Docker are all you need. No account to create anywhere, nothing sent to a server: the platform, your progress and your labs stay on your computer.
- Git
- Docker Desktop or Docker Engine
- Windows · macOS · Linux
Get the code
Clone the repository. No Node.js, no database to install.
Generate your secrets
Build the platform image, then ask it for fresh random keys. They stay in
.envon your machine, and the platform refuses to start without them.Build the labs
Ten small vulnerable applications, one image each. Done once.
Start
Open
http://localhost:3000, create your account and follow the path. Every service listens on127.0.0.1only: nothing is exposed to your network.
# get the code
$ git clone https://github.com/Azog1812/bastion-academy
$ cd bastion-academy
# build the platform, generate your own secrets
$ docker build -t bastion:local .
$ docker run --rm bastion:local dist/cli.js gen-secrets > .env
# build the labs once, then start
$ docker compose --profile labs build
$ docker compose up -d
✓ http://localhost:3000
On Windows, run these commands in Git Bash or WSL. In Windows PowerShell, > writes UTF-16, which Docker cannot read: use docker run --rm bastion:local dist/cli.js gen-secrets | Out-File -Encoding ascii .env instead.
With Node.js 22.13 or later, npm ci --ignore-scripts, npm run build and npm start also run the platform without Docker. The labs always need Docker.
Security
A platform built the way it teaches
Every claim below is backed by code you can read and a test that tries to break it: more than 450 automated tests, most of them abuse cases.
Encrypted at rest
Each note has its own AES-256-GCM key, wrapped by a key that never touches the database. The keys can live in HashiCorp Vault.
Flags nobody can share
A flag is an HMAC of the challenge and the learner. Nothing is stored, and a flag copied from someone else is refused like a wrong one.
Labs in a box
Non-root, read-only, no capabilities, capped memory and processes, a private network with no route out. One component holds the Docker socket and accepts nothing but a catalog id.
A login that resists guessing
Progressive lockout, a breached-password blocklist, the same answer for an unknown e-mail and a wrong password. TOTP and passkeys, written on Node's own crypto.
Evidence you can trust
The audit log is an HMAC chain: a modified entry is found and pinpointed. A copy goes to Wazuh, with detection rules for the platform itself.
A supply chain that signs
Every change runs static analysis, dependency and secret scans, a container scan and an authenticated DAST. Images are signed with Sigstore and ship an SBOM and SLSA provenance.
This website too
The showcase of a security project should not be its weak spot. This site is plain HTML served by nginx:
- No JavaScript at all: there is nothing to inject into.
- No cookies, no analytics, no third party: fonts and images come from this domain.
- A strict Content Security Policy, HSTS and
frame-ancestors 'none'against clickjacking. - A
security.txtfile that says where to report a vulnerability.
# Content-Security-Policy sent by the server
default-src 'none';
style-src 'self';
img-src 'self';
font-src 'self';
base-uri 'none';
form-action 'none';
frame-ancestors 'none';
require-trusted-types-for 'script';
upgrade-insecure-requests
Open source
Every decision is written down
Bastion Academy is the portfolio project of Florent Roch (Mastère cybersécurité, ESTIAM). The repository holds the reasoning as well as the code.