Compare commits

...
3 Commits
Author SHA1 Message Date
quoije df5ce2d497 docs: first draft of the workshop deck (21 slides)
Intro, rules, topology, methodology, then the debriefing path and the
defensive angle. Text lives in build_slides.py so it can be regenerated;
the .pptx is the editable artifact.
2026-10-25 13:39:33 -04:00
quoije 0dbfcc7147 lifecycle: up/reset wait for every guest before returning
doctor run right after reset reported false failures because the VMs were
still booting. _start_lab now waits for WinRM on each guest (300 s) and
names the ones that did not answer.
2026-10-24 16:48:01 -04:00
quoije ca72e1aa2e windows: fix first-boot races and non-idempotent stages
A from-scratch rebuild surfaced three defects that only appear on a clean
deployment:

- dc01-post: `Set-ADObject -Identity <sAMAccountName>` raises
  ADIdentityNotFoundException even right after New-ADUser, so resolve the
  DN once and reuse it. The stage aborted before DNS, flags, DHCP and the
  audit policy, leaving a half-built domain.
- bootstrap ran the role script at first boot while `provision` also ran
  it. fs01 tried to join a domain that did not exist yet, and dc01 ran two
  promotions concurrently; the loser wrote "FAIL Stream was not readable".
  Roles are now only started by the harness, which orders them.
- fs01: the `.url` MIME existence test read the staticContent element
  (-Name '.') instead of its collection, so any re-run died on a duplicate
  entry. Test -Name 'collection'.

Every stage now takes a PID-based lock: a duplicate start exits instead of
racing the real one.

Validated on a fresh build: doctor 0 warnings, and the full path
(site -> SMB -> AS-REP -> Kerberoast -> WinRM -> ACL -> replication ->
DCSync) reproduces.
2026-10-24 16:38:37 -04:00
11 changed files with 655 additions and 5 deletions
+1
View File
@@ -203,6 +203,7 @@ la mémoire de l'hôte et prévient avant le build.
| `content/web/` | site assemblé et fichiers pièges | | `content/web/` | site assemblé et fichiers pièges |
| `content/scripts/` | assistants partagés (WinRM, préparation du site, liste de mots) | | `content/scripts/` | assistants partagés (WinRM, préparation du site, liste de mots) |
| `docs/` | documentation de l'atelier, en français | | `docs/` | documentation de l'atelier, en français |
| `docs/slides/` | présentation d'introduction et de débriefing (`.pptx` + script de génération) |
| `answers/` | solution complète — **ignoré par git** | | `answers/` | solution complète — **ignoré par git** |
| `build-bundle.sh` | fabrique une archive autonome par plateforme | | `build-bundle.sh` | fabrique une archive autonome par plateforme |
+14
View File
@@ -116,6 +116,20 @@ _start_lab() {
backend_launch "$name" run || { fail "$name did not start"; return 1; } backend_launch "$name" run || { fail "$name did not start"; return 1; }
fi fi
done done
# Return only once every guest answers: running `doctor` the instant `up`
# printed its last line used to report false failures during boot.
step "wait for the guests"
local notready=0
for name in "${VM_NAMES[@]}"; do
if backend_ready "$name" 300; then
ok "$(printf '%-6s ready' "$name")"
else
warn "$name did not answer in time"
notready=1
fi
done
return $(( notready ))
} }
cmd_up() { cmd_up() {
+5 -2
View File
@@ -98,10 +98,13 @@ try {
Set-Content -Path "$base\stamp.txt" -Encoding ascii Set-Content -Path "$base\stamp.txt" -Encoding ascii
# ------------------------------------------------------------------ role # ------------------------------------------------------------------ role
# The role stages are driven by the host (`./lab.sh provision`), which orders
# them: the DC must be promoted before a member tries to join. Running them
# here as well made every guest race the harness — fs01 joined before the
# domain existed, and dc01 ran two promotions at once.
$role = Join-Path $here "roles\$($Config.Role).ps1" $role = Join-Path $here "roles\$($Config.Role).ps1"
if (Test-Path $role) { if (Test-Path $role) {
Write-Host "bootstrap: running role $($Config.Role)" Write-Host "bootstrap: role $($Config.Role) staged, waiting for ./lab.sh provision"
& $role
} else { } else {
Write-Host "bootstrap: no role script for '$($Config.Role)' yet (phase 5)" Write-Host "bootstrap: no role script for '$($Config.Role)' yet (phase 5)"
} }
+23
View File
@@ -27,6 +27,29 @@ function Fail-Stage {
throw $Message throw $Message
} }
# A stage can be started twice: the harness schedules it, and a retried
# transport call or a manual run can schedule it again. Two concurrent
# Install-ADDSForest calls fight over the same promotion and one of them
# writes FAIL, which stops a provisioning that actually worked.
function Enter-StageLock {
param([string]$Path)
$lock = "$Path.lock"
if (Test-Path $lock) {
$owner = Get-Content $lock -ErrorAction SilentlyContinue
if ($owner -and (Get-Process -Id ([int]$owner) -ErrorAction SilentlyContinue)) {
return $false
}
# The owner is gone (reboot, crash): the lock is stale.
}
Set-Content -Path $lock -Value $PID -Encoding ascii
return $true
}
function Exit-StageLock {
param([string]$Path)
Remove-Item "$Path.lock" -Force -ErrorAction SilentlyContinue
}
function Wait-ForDomain { function Wait-ForDomain {
param([int]$TimeoutSeconds = 600) param([int]$TimeoutSeconds = 600)
$deadline = (Get-Date).AddSeconds($TimeoutSeconds) $deadline = (Get-Date).AddSeconds($TimeoutSeconds)
+11 -2
View File
@@ -4,6 +4,10 @@
. "$PSScriptRoot\..\lib\common.ps1" . "$PSScriptRoot\..\lib\common.ps1"
$self = $PSCommandPath $self = $PSCommandPath
if (-not (Enter-StageLock $self)) {
Write-LabLog 'stage already running on this guest; duplicate start ignored'
return
}
Write-LabLog 'dc01: post stage starting' Write-LabLog 'dc01: post stage starting'
try { try {
@@ -119,14 +123,17 @@ try {
$domainAcl.CommitChanges() $domainAcl.CommitChanges()
Write-LabLog 'dc01: Sauvegarde-AD granted replication rights' Write-LabLog 'dc01: Sauvegarde-AD granted replication rights'
# Set-ADObject does not resolve a sAMAccountName reliably (it raises
# ADIdentityNotFoundException), so resolve the DN once and use it below.
$plainDn = (Get-ADUser 'm.legault').DistinguishedName
# m.legault must not carry a stale adminCount flag from an earlier design, # m.legault must not carry a stale adminCount flag from an earlier design,
# or SDProp would keep treating the account as protected and wipe the ACE. # or SDProp would keep treating the account as protected and wipe the ACE.
Set-ADObject -Identity 'm.legault' -Replace @{ adminCount = 0 } -ErrorAction SilentlyContinue Set-ADObject -Identity $plainDn -Replace @{ adminCount = 0 } -ErrorAction SilentlyContinue
# Realistic delegation: the service account manages a plain user who is a # Realistic delegation: the service account manages a plain user who is a
# member of the server-admin group. m.legault is NOT in a protected group, # member of the server-admin group. m.legault is NOT in a protected group,
# so SDProp leaves this ACE alone — unlike the Domain Admin target above. # so SDProp leaves this ACE alone — unlike the Domain Admin target above.
$plainDn = (Get-ADUser 'm.legault').DistinguishedName
if (-not (dsacls.exe $plainDn | Select-String 'svc_backup')) { if (-not (dsacls.exe $plainDn | Select-String 'svc_backup')) {
$null = dsacls.exe $plainDn /G '@@NETBIOS@@\svc_backup:GA' $null = dsacls.exe $plainDn /G '@@NETBIOS@@\svc_backup:GA'
Write-LabLog 'dc01: GenericAll granted to svc_backup over m.legault' Write-LabLog 'dc01: GenericAll granted to svc_backup over m.legault'
@@ -240,4 +247,6 @@ try {
Complete-Stage $self 'ok' Complete-Stage $self 'ok'
} catch { } catch {
Fail-Stage $self $_.Exception.Message Fail-Stage $self $_.Exception.Message
} finally {
Exit-StageLock $self
} }
+6
View File
@@ -5,6 +5,10 @@
. "$PSScriptRoot\..\lib\common.ps1" . "$PSScriptRoot\..\lib\common.ps1"
$self = $PSCommandPath $self = $PSCommandPath
if (-not (Enter-StageLock $self)) {
Write-LabLog 'stage already running on this guest; duplicate start ignored'
return
}
Write-LabLog 'dc01: stage 1 starting' Write-LabLog 'dc01: stage 1 starting'
try { try {
@@ -37,4 +41,6 @@ try {
Restart-Computer -Force Restart-Computer -Force
} catch { } catch {
Fail-Stage $self $_.Exception.Message Fail-Stage $self $_.Exception.Message
} finally {
Exit-StageLock $self
} }
+12 -1
View File
@@ -5,6 +5,10 @@
. "$PSScriptRoot\..\lib\common.ps1" . "$PSScriptRoot\..\lib\common.ps1"
$self = $PSCommandPath $self = $PSCommandPath
if (-not (Enter-StageLock $self)) {
Write-LabLog 'stage already running on this guest; duplicate start ignored'
return
}
Write-LabLog 'fs01: starting' Write-LabLog 'fs01: starting'
try { try {
@@ -29,14 +33,19 @@ try {
# IIS ships no MIME mapping for .url; the archived "Your Love" shortcut # IIS ships no MIME mapping for .url; the archived "Your Love" shortcut
# needs one or IIS answers 404.3. # needs one or IIS answers 404.3.
Import-Module WebAdministration Import-Module WebAdministration
# -Name '.' returns the staticContent element, not its entries, so the
# existence test always failed and a re-run died on a duplicate entry.
# The collection of mappings is -Name 'collection'.
$urlMime = Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' ` $urlMime = Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/staticContent' -Name '.' | -Filter 'system.webServer/staticContent' -Name 'collection' |
Where-Object { $_.fileExtension -eq '.url' } Where-Object { $_.fileExtension -eq '.url' }
if (-not $urlMime) { if (-not $urlMime) {
Add-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' ` Add-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/staticContent' -Name '.' ` -Filter 'system.webServer/staticContent' -Name '.' `
-Value @{ fileExtension = '.url'; mimeType = 'application/internet-shortcut' } -Value @{ fileExtension = '.url'; mimeType = 'application/internet-shortcut' }
Write-LabLog 'fs01: .url MIME mapping added' Write-LabLog 'fs01: .url MIME mapping added'
} else {
Write-LabLog 'fs01: .url MIME mapping already present'
} }
$root = 'C:\inetpub\wwwroot' $root = 'C:\inetpub\wwwroot'
@@ -81,4 +90,6 @@ Ne pas supprimer.
Restart-Computer -Force Restart-Computer -Force
} catch { } catch {
Fail-Stage $self $_.Exception.Message Fail-Stage $self $_.Exception.Message
} finally {
Exit-StageLock $self
} }
@@ -3,6 +3,10 @@
. "$PSScriptRoot\..\lib\common.ps1" . "$PSScriptRoot\..\lib\common.ps1"
$self = $PSCommandPath $self = $PSCommandPath
if (-not (Enter-StageLock $self)) {
Write-LabLog 'stage already running on this guest; duplicate start ignored'
return
}
Write-LabLog 'ws01: post stage starting' Write-LabLog 'ws01: post stage starting'
try { try {
@@ -36,4 +40,6 @@ try {
Complete-Stage $self 'ok' Complete-Stage $self 'ok'
} catch { } catch {
Fail-Stage $self $_.Exception.Message Fail-Stage $self $_.Exception.Message
} finally {
Exit-StageLock $self
} }
+6
View File
@@ -5,6 +5,10 @@
. "$PSScriptRoot\..\lib\common.ps1" . "$PSScriptRoot\..\lib\common.ps1"
$self = $PSCommandPath $self = $PSCommandPath
if (-not (Enter-StageLock $self)) {
Write-LabLog 'stage already running on this guest; duplicate start ignored'
return
}
Write-LabLog 'ws01: starting' Write-LabLog 'ws01: starting'
try { try {
@@ -27,4 +31,6 @@ try {
Restart-Computer -Force Restart-Computer -Force
} catch { } catch {
Fail-Stage $self $_.Exception.Message Fail-Stage $self $_.Exception.Message
} finally {
Exit-StageLock $self
} }
+571
View File
@@ -0,0 +1,571 @@
#!/usr/bin/env python3
"""Build the Norbourg workshop deck (first draft).
python3 session1/docs/slides/build_slides.py
Everything lives in this file so the deck can be regenerated after a text
change. Edit freely in PowerPoint; this script is only the starting point.
"""
from pathlib import Path
from pptx import Presentation
from pptx.dml.color import RGBColor
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import MSO_ANCHOR, PP_ALIGN
from pptx.oxml.ns import qn
from pptx.util import Emu, Inches, Pt
OUT = Path(__file__).with_name("norbourg-atelier-1.pptx")
# ------------------------------------------------------------------ palette
NAVY = RGBColor(0x0F, 0x27, 0x40)
NAVY_SOFT = RGBColor(0x1B, 0x3A, 0x5C)
TEAL = RGBColor(0x2A, 0x7F, 0x7F)
AMBER = RGBColor(0xC0, 0x8A, 0x2E)
PAPER = RGBColor(0xF6, 0xF3, 0xEC)
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
INK = RGBColor(0x1F, 0x23, 0x28)
GRAY = RGBColor(0x6B, 0x72, 0x80)
LINE = RGBColor(0xD8, 0xD2, 0xC4)
FONT = "Arial"
W, H = 13.333, 7.5
def new_deck():
prs = Presentation()
prs.slide_width = Inches(W)
prs.slide_height = Inches(H)
return prs
def blank(prs, bg=PAPER):
slide = prs.slides.add_slide(prs.slide_layouts[6]) # blank
fill = slide.background.fill
fill.solid()
fill.fore_color.rgb = bg
return slide
def textbox(slide, left, top, width, height, text="", size=18, color=INK,
bold=False, align=PP_ALIGN.LEFT, anchor=MSO_ANCHOR.TOP,
line_spacing=1.1, font=FONT):
box = slide.shapes.add_textbox(Inches(left), Inches(top), Inches(width), Inches(height))
tf = box.text_frame
tf.word_wrap = True
tf.margin_left = 0
tf.margin_right = 0
tf.margin_top = 0
tf.margin_bottom = 0
tf.vertical_anchor = anchor
p = tf.paragraphs[0]
p.alignment = align
p.line_spacing = line_spacing
run = p.add_run()
run.text = text
run.font.size = Pt(size)
run.font.bold = bold
run.font.color.rgb = color
run.font.name = font
return box
def bullets(slide, items, left=0.9, top=1.85, width=11.5, height=4.6,
size=19, color=INK, space=12):
box = slide.shapes.add_textbox(Inches(left), Inches(top), Inches(width), Inches(height))
tf = box.text_frame
tf.word_wrap = True
tf.margin_left = 0
tf.margin_right = 0
tf.margin_top = 0
tf.margin_bottom = 0
first = True
for item in items:
level = 0
if isinstance(item, tuple):
item, level = item
p = tf.paragraphs[0] if first else tf.add_paragraph()
first = False
p.line_spacing = 1.15
p.space_after = Pt(space)
pPr = p._p.get_or_add_pPr()
pPr.set("marL", str(Inches(0.34)))
pPr.set("indent", str(-Inches(0.34)))
buFont = pPr.makeelement(qn("a:buFont"), {"typeface": "Arial"})
buChar = pPr.makeelement(qn("a:buChar"), {"char": "•" if level == 0 else "–"})
pPr.append(buFont)
pPr.append(buChar)
run = p.add_run()
run.text = item
run.font.size = Pt(size if level == 0 else size - 2)
run.font.color.rgb = color if level == 0 else GRAY
run.font.name = FONT
return box
def content_slide(prs, title, kicker=None):
slide = blank(prs)
bar = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, Inches(W), Inches(0.14))
bar.fill.solid()
bar.fill.fore_color.rgb = NAVY
bar.line.fill.background()
if kicker:
textbox(slide, 0.9, 0.55, 11.5, 0.3, kicker.upper(), size=11, color=TEAL, bold=True)
textbox(slide, 0.9, 0.85, 11.5, 0.8, title, size=30, color=NAVY, bold=True)
accent = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0.9), Inches(1.62),
Inches(1.1), Inches(0.05))
accent.fill.solid()
accent.fill.fore_color.rgb = AMBER
accent.line.fill.background()
return slide
def footer(slide, number):
textbox(slide, 0.9, 6.95, 8.0, 0.3, "Laboratoire Norbourg · atelier 1",
size=10, color=GRAY)
textbox(slide, 11.6, 6.95, 1.0, 0.3, f"{number:02d}", size=10, color=GRAY,
align=PP_ALIGN.RIGHT)
def notes(slide, text):
slide.notes_slide.notes_text_frame.text = text
def section(prs, number, title, subtitle=""):
slide = blank(prs, NAVY)
textbox(slide, 0.9, 2.2, 1.6, 0.4, "SÉQUENCE", size=12, color=TEAL, bold=True)
textbox(slide, 0.9, 2.55, 2.0, 1.5, number, size=80, color=AMBER, bold=True)
textbox(slide, 2.6, 2.75, 9.8, 1.0, title, size=40, color=WHITE, bold=True)
if subtitle:
textbox(slide, 2.6, 3.85, 9.5, 0.8, subtitle, size=17, color=LINE)
return slide
def card(slide, left, top, width, height, title, body="", accent=TEAL,
title_size=16, body_size=12):
box = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(left), Inches(top),
Inches(width), Inches(height))
box.adjustments[0] = 0.08
box.fill.solid()
box.fill.fore_color.rgb = WHITE
box.line.color.rgb = LINE
box.line.width = Pt(1)
box.shadow.inherit = False
bar = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(left), Inches(top),
Inches(0.07), Inches(height))
bar.fill.solid()
bar.fill.fore_color.rgb = accent
bar.line.fill.background()
textbox(slide, left + 0.25, top + 0.18, width - 0.4, 0.4, title,
size=title_size, color=NAVY, bold=True)
if body:
textbox(slide, left + 0.25, top + 0.62, width - 0.4, height - 0.7, body,
size=body_size, color=GRAY, line_spacing=1.05)
def arrow(slide, left, top, width, height=0.22, color=TEAL):
shape = slide.shapes.add_shape(MSO_SHAPE.RIGHT_ARROW, Inches(left), Inches(top),
Inches(width), Inches(height))
shape.fill.solid()
shape.fill.fore_color.rgb = color
shape.line.fill.background()
def table(slide, data, left, top, width, col_widths, header=True, size=15,
row_height=0.5):
rows, cols = len(data), len(data[0])
shape = slide.shapes.add_table(rows, cols, Inches(left), Inches(top),
Inches(width), Inches(row_height * rows))
tbl = shape.table
for i, w in enumerate(col_widths):
tbl.columns[i].width = Inches(w)
for r in range(rows):
tbl.rows[r].height = Inches(row_height)
for c in range(cols):
cell = tbl.cell(r, c)
cell.text = ""
cell.margin_left = Inches(0.12)
cell.margin_right = Inches(0.1)
cell.margin_top = Inches(0.04)
cell.margin_bottom = Inches(0.04)
cell.vertical_anchor = MSO_ANCHOR.MIDDLE
p = cell.text_frame.paragraphs[0]
run = p.add_run()
run.text = str(data[r][c])
run.font.name = FONT
run.font.size = Pt(size if r else size - 1)
run.font.bold = bool(header and r == 0)
if header and r == 0:
cell.fill.solid()
cell.fill.fore_color.rgb = NAVY
run.font.color.rgb = WHITE
else:
cell.fill.solid()
cell.fill.fore_color.rgb = WHITE if r % 2 else PAPER
run.font.color.rgb = INK
return tbl
def build():
prs = new_deck()
# ---------------------------------------------------------------- 01
s = blank(prs, NAVY)
textbox(s, 0.9, 0.9, 8.0, 0.4, "ATELIER 1 · PENTEST DE DOMAINE", size=12,
color=TEAL, bold=True)
textbox(s, 0.9, 1.55, 9.5, 1.0, "Laboratoire Norbourg", size=50, color=WHITE, bold=True)
textbox(s, 0.9, 2.75, 8.6, 1.5,
"Prendre le contrôle d'un Active Directory,\ndu site Web jusqu'au DCSync",
size=21, color=LINE, line_spacing=1.25)
rule = s.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0.9), Inches(4.35),
Inches(1.6), Inches(0.06))
rule.fill.solid()
rule.fill.fore_color.rgb = AMBER
rule.line.fill.background()
textbox(s, 0.9, 4.7, 8.0, 0.4, "Document de travail · première ébauche", size=14, color=GRAY)
textbox(s, 0.9, 6.55, 9.0, 0.4, "Instructeur : ______________________ Date : ______________", size=12, color=GRAY)
# decorative blocks
for i, col in enumerate((TEAL, AMBER, NAVY_SOFT)):
b = s.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(10.6 + i * 0.62),
Inches(5.6), Inches(0.5), Inches(1.2))
b.fill.solid()
b.fill.fore_color.rgb = col
b.line.fill.background()
notes(s, "Adapter la date et le nom de l'instructeur. Le décor Norbourg est fictif et "
"pédagogique ; ne pas présenter les faits réels de l'affaire comme source du labo.")
# ---------------------------------------------------------------- 02
s = content_slide(prs, "Le contexte", "Pourquoi ce laboratoire")
bullets(s, [
"Norbourg Services Financiers : firme de gestion de fonds, fermée en 2005.",
"Le serveur de fichiers n'a jamais été mis au rancart.",
"Le site Web de 2002 est toujours en ligne, archives du service des TI comprises.",
"La direction veut un audit avant de confier la migration.",
"Votre mandat : montrer ce qu'un attaquant pourrait y faire.",
])
footer(s, len(prs.slides))
notes(s, "Le décor est une fiction pédagogique. Le point important : un système laissé "
"en l'état raconte son histoire à qui sait lire ses journaux et ses fichiers.")
# ---------------------------------------------------------------- 03
s = content_slide(prs, "L'objectif", "Ce qu'on cherche")
bullets(s, [
"Partir d'un accès anonyme.",
"Prendre le contrôle du domaine — pas seulement « entrer » sur une machine.",
"Deux drapeaux : user.txt sur un poste, root.txt sur le contrôleur de domaine.",
"Format NORBOURG{...} ; ils se rapportent au débriefing.",
"Être Domain Admin est une route ; ce n'est pas la seule.",
])
footer(s, len(prs.slides))
notes(s, "Insister sur la dernière ligne : le chemin du laboratoire passe par une "
"délégation, pas par un compte Domain Admins.")
# ---------------------------------------------------------------- 04
s = content_slide(prs, "Le déroulé", "Une séance de deux heures")
table(s, [
["Durée", "Segment"],
["15 min", "Accueil, contexte, règles d'engagement"],
["15 min", "Rappel terminal et méthodologie"],
["75 min", "Travail en autonomie · indices à trois niveaux"],
["20 min", "Débriefing technique : le chemin complet"],
["15 min", "Volet défensif : ce que les journaux auraient montré"],
], 0.9, 1.95, 11.4, [1.6, 9.8], size=16, row_height=0.55)
textbox(s, 0.9, 5.9, 11.4, 0.5,
"Les plus rapides peuvent explorer les archives ; les autres reçoivent des indices.",
size=13, color=GRAY)
footer(s, len(prs.slides))
notes(s, "Le minutage est une cible, pas une contrainte. En pratique, l'autonomie "
"déborde souvent de dix minutes.")
# ---------------------------------------------------------------- 05
s = content_slide(prs, "Règles d'engagement", "Avant de commencer")
bullets(s, [
"Seulement 10.10.10.0/24.",
"Ne touchez pas à l'hôte du laboratoire (10.10.10.230 sur qemu, 10.10.10.1 sur Proxmox).",
"Pas de déni de service : pas de balayage agressif, pas de saturation.",
"Pas de destruction : comptes, mots de passe, fichiers.",
"Rien ne sort du laboratoire.",
"Vous cassez quelque chose ? Dites-le : ça se répare, mais il faut le savoir.",
])
footer(s, len(prs.slides))
notes(s, "Ces règles sont aussi un prétexte pour parler du périmètre d'un vrai mandat : "
"ce qui est autorisé, ce qui ne l'est pas, et pourquoi on l'écrit.")
# ---------------------------------------------------------------- 06
s = content_slide(prs, "Le laboratoire", "Trois machines, un segment isolé")
seg = s.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(5.0), Inches(1.95),
Inches(7.9), Inches(4.55))
seg.adjustments[0] = 0.04
seg.fill.solid()
seg.fill.fore_color.rgb = WHITE
seg.line.color.rgb = LINE
seg.line.width = Pt(1.2)
seg.shadow.inherit = False
textbox(s, 5.35, 2.1, 7.2, 0.35, "10.10.10.0/24 · pont isolé", size=13,
color=TEAL, bold=True)
card(s, 5.35, 2.55, 7.2, 0.95, "DC01 · 10.10.10.10", "domaine, DNS, DHCP", NAVY)
card(s, 5.35, 3.65, 7.2, 0.95, "FS01 · 10.10.10.20", "site 2002, partages", NAVY)
card(s, 5.35, 4.75, 7.2, 0.95, "WS01 · 10.10.10.31", "poste de travail", NAVY)
textbox(s, 0.9, 2.2, 3.2, 0.35, "Participant", size=12, color=GRAY, bold=True)
card(s, 0.9, 2.6, 3.3, 1.1, "Kali · 10.10.10.101", "votre machine d'attaque", TEAL)
arrow(s, 4.35, 3.05, 0.55)
textbox(s, 5.35, 5.9, 7.2, 0.4, "aucun accès Internet, aucun accès au réseau du bureau",
size=12, color=GRAY)
footer(s, len(prs.slides))
notes(s, "Le pont n'a aucun port. Une VM compromise ne peut pas atteindre le réseau "
"d'entreprise — c'est la propriété la plus importante du montage.")
# ---------------------------------------------------------------- 07
s = content_slide(prs, "Votre poste de travail", "Kali, prêt à l'emploi")
bullets(s, [
"Console web Proxmox (une VM par personne) ou VM locale, selon la plateforme.",
"Identifiants dans la VM : kali / kali.",
"Déjà installés : nxc, Impacket, evil-winrm, hashcat, bloodhound-python.",
"DNS : 10.10.10.10, le contrôleur de domaine.",
"Liste de mots : /opt/norbourg/wordlists/norbourg.txt.",
"Pas d'Internet — tout ce qu'il faut est déjà là.",
])
footer(s, len(prs.slides))
notes(s, "Faire vérifier une fois : ping 10.10.10.20, getent hosts fs01.norbourg.lab. "
"Si la résolution échoue, le reste de l'atelier sera incompréhensible.")
# ---------------------------------------------------------------- 08
s = content_slide(prs, "Méthodologie", "Six temps, dans l'ordre")
steps = [
("1", "Reconnaissance", "qui répond, quels services"),
("2", "Énumération", "partages, comptes, pages, versions"),
("3", "Point d'entrée", "un premier identifiant valide"),
("4", "Élévation", "d'un compte ordinaire à un compte puissant"),
("5", "Latéral", "d'une machine à l'autre"),
("6", "Domaine", "la cible finale"),
]
for i, (n, title, sub) in enumerate(steps):
col = i % 3
row = i // 3
x = 0.9 + col * 3.9
y = 2.0 + row * 2.1
card(s, x, y, 3.55, 1.55, f"{n}. {title}", sub, TEAL if i < 3 else AMBER,
title_size=15, body_size=12)
footer(s, len(prs.slides))
notes(s, "La méthodologie compte plus que l'outil : les participants qui sautent "
"l'énumération tournent en rond.")
# ---------------------------------------------------------------- 09
s = content_slide(prs, "Repères Active Directory", "Le vocabulaire du débriefing")
bullets(s, [
"Contrôleur de domaine : Kerberos (88), LDAP (389), SMB (445).",
"SPN : un service publié dans l'annuaire — et le ticket qui va avec.",
"ACL / ACE : qui peut quoi, sur quel objet.",
"Objets protégés : adminCount=1, ACL réécrite par SDProp chaque heure.",
"Réplication : les DC se copient les secrets ; DCSync emprunte ce canal.",
])
footer(s, len(prs.slides))
notes(s, "Pas un cours d'AD : juste les cinq notions qui reviennent dans le chemin. "
"Le reste s'explique au moment où il sert.")
# ---------------------------------------------------------------- 10
s = content_slide(prs, "Le fil narratif", "Lisez les archives")
bullets(s, [
"Le partage Public contient les archives du service des TI : 1985, 2003, 2004, 2011, 2016, 2019.",
"Chaque note justifie une décision : compte de service et SPN, mot de passe permanent.",
"La délégation a été refaite « pour chaque compte ».",
"Le groupe WS Admins, puis Sauvegarde-AD et ses droits de réplication.",
"Ces notes expliquent pourquoi le laboratoire est dans cet état.",
])
footer(s, len(prs.slides))
notes(s, "C'est le matériel du débriefing : chaque droit exploité se relie à une "
"décision documentée. Les participants qui lisent les archives comprennent "
"plus vite.")
# ---------------------------------------------------------------- 11
s = content_slide(prs, "À vous de jouer", "75 minutes, deux drapeaux")
bullets(s, [
"Commencez par le site : http://10.10.10.20/",
"Trois niveaux d'indices ; demandez-les un à la fois.",
"Objectif : user.txt sur un poste, root.txt sur le contrôleur de domaine.",
"Notez vos commandes : le débriefing s'appuie sur votre parcours.",
"Le temps restant s'affiche au tableau ; les plus rapides explorent les archives.",
], size=19)
footer(s, len(prs.slides))
notes(s, "Slide de lancement. Ne pas révéler le chemin : les indices doivent rester "
"progressifs. Rappeler que le laboratoire est isolé et que rien ne sort.")
# ---------------------------------------------------------------- 12
s = section(prs, "02", "Débriefing", "Le chemin complet — à ne pas montrer avant l'exercice")
footer(s, len(prs.slides))
# ---------------------------------------------------------------- 12
s = content_slide(prs, "Le chemin, en une page", "Du site Web au DCSync")
row1 = ["Site 2002", "SMB", "AS-REP", "Kerberoast"]
row2 = ["WinRM / WS01", "ACL", "Réplication", "DCSync"]
for i, label in enumerate(row1):
x = 0.9 + i * 3.0
card(s, x, 2.0, 2.55, 0.95, label, "", TEAL, title_size=15)
if i < 3:
arrow(s, x + 2.62, 2.36, 0.32)
textbox(s, 0.9, 3.2, 5.0, 0.35, "puis…", size=12, color=GRAY, bold=True)
for i, label in enumerate(row2):
x = 0.9 + i * 3.0
card(s, x, 3.75, 2.55, 0.95, label, "", AMBER, title_size=15)
if i < 3:
arrow(s, x + 2.62, 4.11, 0.32, color=AMBER)
textbox(s, 0.9, 5.15, 11.6, 0.9,
"Chaque étape produit la suivante : un identifiant, un hash, une session, un droit, "
"puis les secrets du domaine.",
size=15, color=GRAY)
footer(s, len(prs.slides))
notes(s, "Vue d'ensemble à garder au tableau pendant le débriefing. Les slides suivantes "
"détaillent chaque maillon.")
# ---------------------------------------------------------------- 13
s = content_slide(prs, "Le point d'entrée", "Un site de 2002, une note oubliée")
bullets(s, [
"Le site expose /public/ : documents, archives, fichiers de travail.",
"IT-inventaire.txt laisse un identifiant : helpdesk1.",
"Le même mot de passe ouvre le partage Public.",
"Les archives donnent les noms, les habitudes et les décisions.",
"Pas d'exploit : un fichier laissé au mauvais endroit.",
])
footer(s, len(prs.slides))
notes(s, "Le message : la reconnaissance Web et SMB est la même enquête. "
"Le site n'est pas un décor, c'est une source.")
# ---------------------------------------------------------------- 14
s = content_slide(prs, "Deux hashs, aucun bruit", "AS-REP et Kerberoasting")
card(s, 0.9, 1.95, 5.6, 2.2, "j.contractor · AS-REP",
"Pré-authentification désactivée : le DC renvoie un TGT chiffré "
"sans vérifier le mot de passe.\nhashcat -m 18200", NAVY, body_size=13)
card(s, 6.9, 1.95, 5.6, 2.2, "svc_backup · Kerberoasting",
"Le compte a un SPN MSSQL : tout utilisateur authentifié peut demander "
"un ticket de service.\nhashcat -m 13100", NAVY, body_size=13)
bullets(s, [
"Cassage hors ligne : quelques secondes avec la liste de l'atelier.",
"Côté AD : une demande de TGT (4768) et une demande de service (4769).",
"Le cassage lui-même ne laisse aucune trace dans l'annuaire.",
], top=4.5, width=11.5, height=2.0, size=16)
footer(s, len(prs.slides))
notes(s, "Deux comptes, deux raisons différentes : l'un n'exige pas de "
"pré-authentification, l'autre publie un SPN. Le point commun : le mot de passe "
"voyage sous forme de hash, et se casse ailleurs.")
# ---------------------------------------------------------------- 15
s = content_slide(prs, "Le mouvement latéral", "Un compte de service, administrateur local")
bullets(s, [
"svc_backup est membre de WS Admins.",
"WS Admins est administrateur local sur ws01.",
"WinRM (5985) : evil-winrm, ou nxc winrm.",
"user.txt est dans C:\\flag.",
"Un compte de service qui ouvre une session interactive : déjà une anomalie.",
])
footer(s, len(prs.slides))
notes(s, "Faire remarquer que rien n'a été « exploité » ici : le groupe accorde "
"l'administration locale, et le protocole d'administration est ouvert.")
# ---------------------------------------------------------------- 16
s = content_slide(prs, "L'élévation", "Une délégation trop généreuse")
card(s, 0.9, 2.3, 2.9, 1.05, "svc_backup", "compte de service", TEAL, title_size=17)
arrow(s, 4.0, 2.7, 1.0)
textbox(s, 3.95, 2.35, 1.2, 0.3, "GenericAll", size=12, color=AMBER, bold=True,
align=PP_ALIGN.CENTER)
card(s, 5.2, 2.3, 2.9, 1.05, "m.legault", "utilisateur ordinaire", TEAL, title_size=17)
arrow(s, 8.3, 2.7, 1.0)
textbox(s, 8.25, 2.35, 1.2, 0.3, "membre de", size=12, color=GRAY, align=PP_ALIGN.CENTER)
card(s, 9.5, 2.3, 3.0, 1.05, "Sauvegarde-AD", "droits de réplication", AMBER, title_size=17)
textbox(s, 9.5, 3.55, 3.4, 0.7,
"Replicating Directory Changes (All) sur le domaine",
size=12, color=GRAY, line_spacing=1.1)
box = s.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, Inches(0.9), Inches(4.6),
Inches(11.6), Inches(1.25))
box.adjustments[0] = 0.08
box.fill.solid()
box.fill.fore_color.rgb = WHITE
box.line.color.rgb = LINE
box.shadow.inherit = False
textbox(s, 1.15, 4.8, 11.1, 0.9,
"t.smith (Domain Admins) a reçu le même droit : objet protégé, SDProp l'efface "
"chaque heure. C'est le leurre — et la leçon sur les objets protégés.",
size=14, color=INK, line_spacing=1.15)
footer(s, len(prs.slides))
notes(s, "Ce n'est pas un exploit : c'est un droit accordé, et le compte qui le porte "
"appartient à un groupe doté des droits de réplication. Deux décisions "
"inoffensives séparément.")
# ---------------------------------------------------------------- 17
s = content_slide(prs, "La preuve finale", "DCSync")
bullets(s, [
"m.legault est membre de Sauvegarde-AD.",
"Sauvegarde-AD détient Replicating Directory Changes (All).",
"secretsdump -just-dc-user krbtgt : le hash du compte krbtgt.",
"m.legault n'est pas Domain Admin au sens strict.",
"Et pourtant : le domaine est compromis.",
])
footer(s, len(prs.slides))
notes(s, "Nuance importante pour le débriefing : on n'a pas « volé » un compte "
"d'administrateur ; on a emprunté le canal de réplication que le produit de "
"sauvegarde utilise légitimement.")
# ---------------------------------------------------------------- 18
s = content_slide(prs, "Volet défensif", "Ce que les journaux auraient montré")
table(s, [
["Étape", "Événement", "Ce qu'on voit"],
["AS-REP", "4768", "TGT demandé sans pré-authentification"],
["Kerberoasting", "4769", "ticket de service en RC4 (0x17)"],
["Mouvement latéral", "4624 type 3/10, 4672", "session réseau, privilèges spéciaux"],
["Réinitialisation", "4724", "un compte de service réinitialise un utilisateur"],
["DCSync", "4662", "réplication demandée par un compte qui n'est pas un DC"],
["Cassage hors ligne", "aucun", "invisible côté AD — le point du débriefing"],
], 0.9, 1.95, 11.4, [2.7, 2.4, 6.3], size=14, row_height=0.52)
footer(s, len(prs.slides))
notes(s, "Le cassage est le seul maillon muet. Tout le reste laisse une trace : c'est "
"ce qui rend la détection possible même quand l'attaque réussit.")
# ---------------------------------------------------------------- 19
s = content_slide(prs, "Trois leçons", "À retenir")
card(s, 0.9, 1.95, 3.6, 3.3, "1. La délégation",
"Un droit accordé « pour rendre service » est un chemin d'élévation. "
"Le périmètre d'un compte de service se relit chaque année.",
TEAL, title_size=17, body_size=13)
card(s, 4.85, 1.95, 3.6, 3.3, "2. La réplication",
"Replicating Directory Changes (All) vaut un Domain Admin pour qui sait "
"demander les bons secrets. Le groupe de sauvegarde est sensible.",
AMBER, title_size=17, body_size=13)
card(s, 8.8, 1.95, 3.6, 3.3, "3. Le bruit",
"L'étape la plus bruyante n'est pas celle qu'on croit : le cassage hors ligne "
"ne laisse aucune trace dans l'annuaire.",
NAVY, title_size=17, body_size=13)
footer(s, len(prs.slides))
notes(s, "Ces trois leçons sont la raison d'être du volet défensif : chaque maillon a "
"un propriétaire et une décision derrière.")
# ---------------------------------------------------------------- 20
s = content_slide(prs, "Après l'atelier", "Et la suite")
bullets(s, [
"Remise à zéro : ./lab.sh reset (base gelée, environ deux minutes).",
"Les drapeaux restent identiques : tout le monde repart du même état.",
"Session 2 : voler le matériel d'authentification dans LSASS (mimikatz, pass-the-hash).",
"Vos questions et vos fausses pistes alimentent la prochaine version.",
])
footer(s, len(prs.slides))
notes(s, "La session 2 n'est pas encore implémentée : c'est un plan. Le laboratoire de "
"la session 1 reste la référence.")
prs.save(OUT)
print(f"{OUT} · {len(prs.slides)} slides")
if __name__ == "__main__":
build()
Binary file not shown.