Escalate through explicit replication rights, not a protected group

The AdminSDHolder anchor worked but handed svc_backup GenericAll over every
protected object, including Domain Admins — a shortcut that undermined the
intended lesson.

New design, matching how backup products actually get AD access:
  svc_backup --GenericAll--> m.legault (plain user, never protected)
  m.legault in Sauvegarde-AD, which holds Replicating Directory Changes
  and ...All on the domain — the vendor requirement for AD-aware backups

Nothing on that path is a protected object, so SDProp has nothing to rewrite.
t.smith stays as the decoy whose ACE is reverted hourly.

The flag moves to C:\Sauvegarde, shared as Sauvegarde\$ readable by the
backup group: C\$ is admin-only, so a plain account could never fetch it.

web --sync now mirrors instead of merging (it used to leave deleted files
served forever) and clears the staging folder that smbclot only adds to.
Lore 2016/2021 rewritten around the replication requirement.
This commit is contained in:
2026-10-24 14:06:21 -04:00
parent 5e9be0a0b3
commit 122aeed6cb
7 changed files with 107 additions and 61 deletions
+36 -28
View File
@@ -101,54 +101,62 @@ cmd_doctor() {
}
# The puzzle has invariants that services do not reveal: a delegated right,
# an SPN, a disabled pre-authentication, a password policy. SDProp quietly
# reverts ACEs on protected objects, so this is worth checking every time.
# The puzzle has invariants that services do not reveal: a delegated right, an
# SPN, disabled pre-authentication, a password policy, replication rights.
# SDProp quietly reverts ACEs on protected objects, so the target must stay
# outside protected groups — worth checking every time.
_lab_state() {
local out key value
out=$(backend_ps dc01 '
Import-Module ActiveDirectory,DnsServer
$dn = (Get-ADUser t.smith).DistinguishedName
$acl = Get-Acl ("AD:\" + $dn)
$dom = Get-ADDomain
$base = $dom.DistinguishedName
$acl = Get-Acl ("AD:\" + (Get-ADUser t.smith).DistinguishedName)
"ace=" + @($acl.Access | Where-Object { $_.IdentityReference.Value -like "*svc_backup*" }).Count
$plainAcl = Get-Acl ("AD:\" + (Get-ADUser m.legault).DistinguishedName)
"ace_plain=" + @($plainAcl.Access | Where-Object { $_.IdentityReference.Value -like "*svc_backup*" }).Count
"plain_enabled=" + (Get-ADUser m.legault).Enabled
"dcadmin=" + ((Get-ADGroupMember "S-1-5-32-544").Name -contains "Serveurs-Admins")
"sdh=" + @((dsacls.exe ("CN=AdminSDHolder,CN=System," + (Get-ADDomain).DistinguishedName) | Select-String "svc_backup")).Count
"admincount=" + (Get-ADUser t.smith -Properties adminCount).adminCount
"mcount=" + (Get-ADUser m.legault -Properties adminCount).adminCount
"repl=" + @((dsacls.exe $base | Select-String "Sauvegarde-AD")).Count
"share=" + ((Get-SmbShare -Name "Sauvegarde$" -ErrorAction SilentlyContinue) -ne $null)
"root=" + (Test-Path C:\Sauvegarde\root.txt)
"spn=" + @((Get-ADUser svc_backup -Properties ServicePrincipalNames).ServicePrincipalNames).Count
"preauth=" + (Get-ADUser j.contractor -Properties DoesNotRequirePreAuth).DoesNotRequirePreAuth
"minage=" + (Get-ADDefaultDomainPasswordPolicy).MinPasswordAge.TotalHours
"root=" + (Test-Path C:\flag\root.txt)
"txt=" + ((Get-DnsServerResourceRecord -ZoneName norbourg.lab -Name yourlove -EA SilentlyContinue) -ne $null)
"dhcp=" + ((Get-DhcpServerv4Scope -EA SilentlyContinue) -ne $null)
"kali_res=" + @((Get-DhcpServerv4Reservation -ScopeId 10.10.10.0 -EA SilentlyContinue) | Where-Object { $_.IPAddress -eq "10.10.10.101" }).Count
' 2>/dev/null) || { _d_warn "cannot query DC01 for lab state"; return; }
local sdh_ok=0
while IFS='=' read -r key value; do
value=${value//$'\r'/}
case $key in
ace) if [[ $value -ge 1 ]]; then _d_ok "delegated right: svc_backup has an ACE on t.smith"
else _d_fail "delegated right missing (ACE on t.smith)"; fi ;;
ace_plain) if [[ $value -ge 1 ]]; then _d_ok "stable path: svc_backup has an ACE on m.legault"
else _d_fail "stable path missing (ACE on m.legault)"; fi ;;
ace) if [[ $value -ge 1 ]]; then _d_ok "delegated right: svc_backup has an ACE on t.smith (decoy)"
else _d_warn "decoy ACE on t.smith reverted by SDProp (expected)"; fi ;;
ace_plain) if [[ $value -ge 1 ]]; then _d_ok "stable path: svc_backup has an ACE on m.legault"
else _d_fail "stable path missing (ACE on m.legault)"; fi ;;
plain_enabled) if [[ $value == True ]]; then _d_ok "m.legault account enabled"
else _d_fail "m.legault is disabled — the path is dead"; fi ;;
dcadmin) if [[ $value == True ]]; then _d_ok "Serveurs-Admins is DC local admin"
else _d_fail "Serveurs-Admins is not in BUILTIN\Administrators"; fi ;;
sdh) if [[ $value -ge 1 ]]; then _d_ok "AdminSDHolder carries the delegation (SDProp-proof)"; sdh_ok=1
else _d_warn "delegation not anchored in AdminSDHolder"; fi ;;
admincount) if (( sdh_ok )) || [[ $value == 0 ]]; then _d_ok "protected objects cannot strip the ACE"
else _d_warn "adminCount=$value and no AdminSDHolder anchor"; fi ;;
spn) [[ $value -ge 1 ]] && _d_ok "service account: SPN present" || _d_fail "svc_backup has no SPN" ;;
preauth) [[ $value == True ]] && _d_ok "pre-auth disabled on j.contractor" || _d_fail "j.contractor still requires pre-auth" ;;
minage) [[ $value == 0 ]] && _d_ok "minimum password age: 0" || _d_fail "minimum password age is $value h" ;;
root) [[ $value == True ]] && _d_ok "root.txt on DC01" || _d_fail "root.txt missing" ;;
txt) [[ $value == True ]] && _d_ok "easter egg TXT record" || _d_warn "yourlove TXT record missing" ;;
dhcp) [[ $value == True ]] && _d_ok "DHCP scope present" || _d_fail "DHCP scope missing" ;;
kali_res) [[ $value -ge 1 ]] && _d_ok "DHCP reservation 10.10.10.101" || _d_fail "Kali reservation missing" ;;
else _d_fail "m.legault is disabled — the path is dead"; fi ;;
mcount) if [[ -z $value || $value == 0 ]]; then _d_ok "m.legault outside protected groups"
else _d_fail "adminCount=$value: m.legault is protected, SDProp will wipe the ACE"; fi ;;
repl) if [[ $value -ge 2 ]]; then _d_ok "Sauvegarde-AD holds replication rights (DCSync)"
else _d_fail "replication rights missing on Sauvegarde-AD"; fi ;;
share) if [[ $value == True ]]; then _d_ok "backup share with the flag"
else _d_fail "Sauvegarde\$ share missing"; fi ;;
root) if [[ $value == True ]]; then _d_ok "root.txt reachable through the backup share"
else _d_fail "root.txt missing"; fi ;;
spn) if [[ $value -ge 1 ]]; then _d_ok "service account: SPN present"
else _d_fail "svc_backup has no SPN"; fi ;;
preauth) if [[ $value == True ]]; then _d_ok "pre-auth disabled on j.contractor"
else _d_fail "j.contractor still requires pre-auth"; fi ;;
minage) if [[ $value == 0 ]]; then _d_ok "minimum password age: 0"
else _d_fail "minimum password age is $value h"; fi ;;
txt) if [[ $value == True ]]; then _d_ok "easter egg TXT record"
else _d_warn "yourlove TXT record missing"; fi ;;
dhcp) if [[ $value == True ]]; then _d_ok "DHCP scope present"
else _d_fail "DHCP scope missing"; fi ;;
kali_res) if [[ $value -ge 1 ]]; then _d_ok "DHCP reservation 10.10.10.101"
else _d_fail "Kali reservation missing"; fi ;;
esac
done <<< "$out"
}