diff --git a/README.md b/README.md index a143d5e8..9c0d8b42 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ documents for different readers. at all. Every pinned digest is also scanned weekly for fixable HIGH and CRITICAL CVEs, and each image with findings has an open issue until a scan finds it clean. -- **Documented decisions and runbooks.** 139 ADRs covering what was chosen +- **Documented decisions and runbooks.** 140 ADRs covering what was chosen and what was rejected — including the costs accepted knowingly; 57 runbooks for the operations that are easy to get wrong at 1am, one of which is the handover page a successor reads first. Every critical alert links to @@ -236,7 +236,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology │ ├── architecture.md network.md hardware.md │ ├── observability.md security.md roadmap.md changelog.md │ ├── diagrams/ # the network diagram (SVG) and its predecessors -│ ├── adr/ # 139 ADRs — architecture decision records +│ ├── adr/ # 140 ADRs — architecture decision records │ ├── exercises/ # purple-team exercise records — see its README │ └── runbooks/ # 57 runbooks; successor-handover.md is the front door └── Makefile # make help diff --git a/ansible/README.md b/ansible/README.md index a7152722..41c09337 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -137,24 +137,31 @@ covered in the runbook's [*Run it from `phoenix`*][run] section. | `ucd` | Unconstrained delegation on `ramuh` | §5a | | `cd` | Constrained delegation, `svc-web` to `titan` CIFS | §5a | | `rbcd` | Resource-based constrained delegation on `titan` | §5a | +| `unsigned_ldap` | LDAP signing enforcement lifted on both DCs | §5a | +| `maq` | The shipped machine account quota of 10 | §5a | +| `spooler` | Print Spooler running on both DCs, as shipped | §5a | | `sysmon` | Sysmon and its config, on every guest | §7 | The `tiers`, `shares` and `soc` tags (#448) apply the rest of §5's skeleton and -§11's agents. The last six are +§11's agents. The nine from `kerberoast` to `spooler` are [#449](https://github.com/Gerrrt/HomeLab/issues/449)'s deliberate weaknesses -([ADR-0083]), each off until asked for: `weakness__state` is `absent` by -default, so a plain run leaves none of them present. Enable one, watch the SOC +([ADR-0083], and [ADR-0140] for the last three), each off until asked for: +`weakness__state` is `absent` by default, so a plain run leaves none of +them present. The last three are shipped defaults on the DCs, so for `maq` and +`spooler` a plain run is the change: it sets the quota to 0 and disables +Spooler on both DCs. `unsigned_ldap` absent leaves signing enforced, as Server +2025 ships it. Enable one, watch the SOC see it, disable it, confirm the signal goes: ```bash ansible-playbook lab-domain.yml --tags kerberoast -e weakness_kerberoast_state=present ansible-playbook verify.yml -e weakness_kerberoast_state=present # it is on ansible-playbook lab-domain.yml --tags kerberoast # off again -ansible-playbook verify.yml # all six absent +ansible-playbook verify.yml # all nine absent ``` -A plain `ansible-playbook verify.yml` asserts every one of these six weakness -primitives is absent — the per-primitive negative test. It does not walk the +A plain `ansible-playbook verify.yml` asserts every one of these nine weakness +primitives is absent, and that `dsHeuristics` is still unset ([ADR-0140]) — the per-primitive negative test. It does not walk the domain's authorization graph, so it does not by itself prove *no* path to Domain Admin exists; that graph-level check is a BloodHound collector run with the tags off ([#451](https://github.com/Gerrrt/HomeLab/issues/451)) — the "run @@ -219,6 +226,7 @@ guest. [ADR-0077]: ../docs/adr/0077-configure-the-lab-domain-with-ansible-from-phoenix.md [ADR-0080]: ../docs/adr/0080-record-the-lab-domain-with-sysmon-and-capture-on-demand-with-pktmon.md [ADR-0083]: ../docs/adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md +[ADR-0140]: ../docs/adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md [ADR-0085]: ../docs/adr/0085-check-the-lab-domains-host-keys-against-keys-read-through-the-guest-agent.md [runbook]: ../docs/runbooks/build-the-lab-domain.md [run]: ../docs/runbooks/build-the-lab-domain.md#run-it-from-phoenix diff --git a/ansible/inventory/group_vars/all.yaml b/ansible/inventory/group_vars/all.yaml index e452c4d9..a47b1fb8 100644 --- a/ansible/inventory/group_vars/all.yaml +++ b/ansible/inventory/group_vars/all.yaml @@ -114,7 +114,9 @@ soc_agents_velociraptor_msi_url: >- # dcsync and delegation exercises. Like every secret it comes from phoenix.env, # never this tree, and the dedicated accounts share it. A role refuses to # enable a weakness while it is unset. Nothing is enabled by default: a plain -# run leaves all six absent, which is #449's negative test. +# run leaves all nine absent, which is #449's negative test. The last three +# (ADR-0140) are shipped defaults on the DCs: a plain run turns MAQ and Spooler +# off, and leaves LDAP signing enforced. lab_weak_password: "{{ lookup('ansible.builtin.env', 'LAB_WEAK_PASSWORD') }}" # The dedicated accounts model Tier 1 service identities, so they live in the # Tier 1 OU the skeleton already owns; absent deletes them and the OU stays. @@ -147,6 +149,17 @@ lab_weakness_cd_target_spn: "CIFS/titan.{{ lab_domain }}" lab_weakness_rbcd_account: svc-rbcd lab_weakness_rbcd_spn: "HOST/svc-rbcd.{{ lab_domain }}" lab_weakness_rbcd_resource: TITAN + +# unsigned_ldap (ADR-0140): Server 2025 enforces LDAP signing while this value +# is unset. present writes it as 0; absent removes it. +lab_weakness_unsigned_ldap_key: HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters +lab_weakness_unsigned_ldap_value: LdapServerEnforceIntegrity + +# maq (ADR-0140): ms-DS-MachineAccountQuota on the domain head. present is +# Windows' shipped 10; absent is 0. +lab_weakness_maq_present: 10 +lab_weakness_maq_absent: 0 + # --- Sysmon (#450, ADR-0080) ------------------------------------------------- # Microsoft publishes Sysmon at one unversioned URL, so this pin goes stale the # day a new release ships. roles/sysmon then fails at the checksum, before diff --git a/ansible/lab-domain.yml b/ansible/lab-domain.yml index f01749f1..d8cd54e6 100644 --- a/ansible/lab-domain.yml +++ b/ansible/lab-domain.yml @@ -201,8 +201,10 @@ # (weakness__state, default absent in the role). A plain run leaves every # one absent — the negative test, that the path to Domain Admin is not there. # Enable one, watch the SOC see it, disable it, watch the signal go. ADR-0083, -# and the identifiers are in group_vars/all.yaml. All six are directory writes, -# so they run on the PDC emulator like tiers and population. +# and the identifiers are in group_vars/all.yaml. The first six are directory +# writes, so they run on the PDC emulator like tiers and population. The last +# three (ADR-0140) are shipped defaults on the DCs, where absent is the +# hardened side: a plain run sets MAQ to 0 and disables Spooler on both DCs. - name: Kerberoast — an SPN on a crackable account hosts: dc_primary gather_facts: false @@ -244,3 +246,24 @@ roles: - role: weakness_rbcd tags: [rbcd] + +- name: Unsigned LDAP — signing enforcement lifted on the DCs + hosts: dcs + gather_facts: false + roles: + - role: weakness_unsigned_ldap + tags: [unsigned_ldap] + +- name: Machine account quota — ordinary users create computer accounts + hosts: dc_primary + gather_facts: false + roles: + - role: weakness_maq + tags: [maq] + +- name: Print Spooler on the DCs — the coercion primitive + hosts: dcs + gather_facts: false + roles: + - role: weakness_spooler + tags: [spooler] diff --git a/ansible/roles/weakness_maq/defaults/main.yml b/ansible/roles/weakness_maq/defaults/main.yml new file mode 100644 index 00000000..ed964a62 --- /dev/null +++ b/ansible/roles/weakness_maq/defaults/main.yml @@ -0,0 +1,8 @@ +--- +# Off by default: a plain run sets the quota to 0. Enable (back to Windows' +# shipped 10) with +# ansible-playbook lab-domain.yml --tags maq -e weakness_maq_state=present +# and disable by applying the same tag with the default (or =absent). The two +# values are in inventory/group_vars/all.yaml, shared with verify.yml +# (ADR-0083, ADR-0140). +weakness_maq_state: absent diff --git a/ansible/roles/weakness_maq/tasks/main.yml b/ansible/roles/weakness_maq/tasks/main.yml new file mode 100644 index 00000000..317839a1 --- /dev/null +++ b/ansible/roles/weakness_maq/tasks/main.yml @@ -0,0 +1,36 @@ +--- +# ADR-0140: ms-DS-MachineAccountQuota on the domain head. At the shipped 10, +# any domain user can create computer accounts, the first step of RBCD and +# shadow-credential chains that need no other switch. present restores 10; +# absent sets 0. Nothing the build does needs it: every join runs as +# AD\Administrator, and weakness_rbcd brings its own controlled principal. +# Runs on the PDC emulator; compares before it writes. + +- name: The toggle is a state this role understands + ansible.builtin.assert: + that: weakness_maq_state in ['present', 'absent'] + fail_msg: >- + weakness_maq_state is '{{ weakness_maq_state }}', not 'present' or + 'absent'. A typo must fail here, not take the teardown branch and + silently remove the weakness. + quiet: true + +- name: Set the domain's machine account quota + ansible.windows.win_powershell: + script: | + [CmdletBinding(SupportsShouldProcess)] + param([int]$Want) + $Ansible.Changed = $false + Import-Module ActiveDirectory + $dn = (Get-ADDomain).DistinguishedName + $have = (Get-ADObject -Identity $dn -Properties 'ms-DS-MachineAccountQuota').'ms-DS-MachineAccountQuota' + if ([int]$have -ne $Want) { + if (-not $Ansible.CheckMode) { + Set-ADObject -Identity $dn -Replace @{ 'ms-DS-MachineAccountQuota' = $Want } + } + $Ansible.Changed = $true + } + parameters: + Want: >- + {{ lab_weakness_maq_present if weakness_maq_state == 'present' + else lab_weakness_maq_absent }} diff --git a/ansible/roles/weakness_spooler/defaults/main.yml b/ansible/roles/weakness_spooler/defaults/main.yml new file mode 100644 index 00000000..1a0352b0 --- /dev/null +++ b/ansible/roles/weakness_spooler/defaults/main.yml @@ -0,0 +1,7 @@ +--- +# Off by default: a plain run disables Print Spooler on both DCs. Enable (back +# to Windows' shipped Automatic and running) with +# ansible-playbook lab-domain.yml --tags spooler -e weakness_spooler_state=present +# and disable by applying the same tag with the default (or =absent) +# (ADR-0083, ADR-0140). +weakness_spooler_state: absent diff --git a/ansible/roles/weakness_spooler/tasks/main.yml b/ansible/roles/weakness_spooler/tasks/main.yml new file mode 100644 index 00000000..2996a66d --- /dev/null +++ b/ansible/roles/weakness_spooler/tasks/main.yml @@ -0,0 +1,43 @@ +--- +# ADR-0140: Print Spooler on the domain controllers. A DC is trusted for +# unconstrained delegation by default, so a running spooler lets any domain +# user coerce the DC's machine account into authenticating to a host of their +# choosing. present leaves it as Windows ships it; absent stops and disables +# it. The DCs only: the members keep theirs, which is no path to Tier 0. +# +# PowerShell rather than win_service, which writes every property it +# manages: its desktop_interact defaults to false, and Server 2025 ships +# Spooler with it true, so win_service would change a third thing besides +# start mode and state. This touches those two only, and compares first. + +- name: The toggle is a state this role understands + ansible.builtin.assert: + that: weakness_spooler_state in ['present', 'absent'] + fail_msg: >- + weakness_spooler_state is '{{ weakness_spooler_state }}', not 'present' + or 'absent'. A typo must fail here, not take the teardown branch and + silently remove the weakness. + quiet: true + +- name: Run or disable Print Spooler + ansible.windows.win_powershell: + script: | + [CmdletBinding(SupportsShouldProcess)] + param([string]$Want) + $Ansible.Changed = $false + $s = Get-Service -Name Spooler -ErrorAction Stop + $on = ($Want -eq 'present') + $mode = if ($on) { 'Automatic' } else { 'Disabled' } + $state = if ($on) { 'Running' } else { 'Stopped' } + if ($s.StartType -ne $mode) { + if (-not $Ansible.CheckMode) { Set-Service -Name Spooler -StartupType $mode } + $Ansible.Changed = $true + } + if ($s.Status -ne $state) { + if (-not $Ansible.CheckMode) { + if ($on) { Start-Service -Name Spooler } else { Stop-Service -Name Spooler -Force } + } + $Ansible.Changed = $true + } + parameters: + Want: "{{ weakness_spooler_state }}" diff --git a/ansible/roles/weakness_unsigned_ldap/defaults/main.yml b/ansible/roles/weakness_unsigned_ldap/defaults/main.yml new file mode 100644 index 00000000..76bca99f --- /dev/null +++ b/ansible/roles/weakness_unsigned_ldap/defaults/main.yml @@ -0,0 +1,7 @@ +--- +# Off by default: signing stays enforced unless this is present. Enable with +# ansible-playbook lab-domain.yml --tags unsigned_ldap -e weakness_unsigned_ldap_state=present +# and disable by applying the same tag with the default (or =absent). The +# registry location is in inventory/group_vars/all.yaml, shared with verify.yml +# (ADR-0083, ADR-0140). +weakness_unsigned_ldap_state: absent diff --git a/ansible/roles/weakness_unsigned_ldap/tasks/main.yml b/ansible/roles/weakness_unsigned_ldap/tasks/main.yml new file mode 100644 index 00000000..08dc886c --- /dev/null +++ b/ansible/roles/weakness_unsigned_ldap/tasks/main.yml @@ -0,0 +1,49 @@ +--- +# ADR-0140: LDAP signing, off on demand. Server 2025 DCs enforce signing while +# LdapServerEnforceIntegrity is unset. present writes it as 0, so the DC takes +# unsigned simple and SASL binds, which makes NTLM relay to LDAP possible. absent +# removes the value, and the DC returns to the 2025 default. +# +# LDAPServerIntegrity is not written here. It ships as 1, and at 2 the DC +# requires signing whatever this value says. So present refuses to run on a DC +# where it is not 1, rather than report the switch as on when it is not. +# Runs on both DCs; compares before it writes, so a second run of either +# direction reports nothing changed. + +- name: The toggle is a state this role understands + ansible.builtin.assert: + that: weakness_unsigned_ldap_state in ['present', 'absent'] + fail_msg: >- + weakness_unsigned_ldap_state is '{{ weakness_unsigned_ldap_state }}', not + 'present' or 'absent'. A typo must fail here, not take the teardown branch + and silently remove the weakness. + quiet: true + +- name: Set or remove the DC's LDAP signing enforcement + ansible.windows.win_powershell: + script: | + [CmdletBinding(SupportsShouldProcess)] + param([string]$Path, [string]$Name, [string]$Want) + $Ansible.Changed = $false + $p = Get-ItemProperty -Path $Path -ErrorAction Stop + if ($Want -eq 'present') { + if ([int]$p.LDAPServerIntegrity -ne 1) { + throw ("LDAPServerIntegrity is '$($p.LDAPServerIntegrity)', not the shipped 1: " + + 'signing would stay required. ADR-0140.') + } + if ($null -eq $p.$Name -or [int]$p.$Name -ne 0) { + if (-not $Ansible.CheckMode) { + New-ItemProperty -Path $Path -Name $Name -PropertyType DWord -Value 0 -Force | Out-Null + } + $Ansible.Changed = $true + } + } elseif ($null -ne $p.$Name) { + if (-not $Ansible.CheckMode) { + Remove-ItemProperty -Path $Path -Name $Name + } + $Ansible.Changed = $true + } + parameters: + Path: "{{ lab_weakness_unsigned_ldap_key }}" + Name: "{{ lab_weakness_unsigned_ldap_value }}" + Want: "{{ weakness_unsigned_ldap_state }}" diff --git a/ansible/verify.yml b/ansible/verify.yml index b64f07ee..0fc69e31 100644 --- a/ansible/verify.yml +++ b/ansible/verify.yml @@ -51,6 +51,14 @@ rbcd_state: "{{ weakness_rbcd_state | default('absent') }}" rbcd_account: "{{ lab_weakness_rbcd_account }}" rbcd_resource: "{{ lab_weakness_rbcd_resource }}" + # ADR-0140's three, on the DCs. + unsigned_ldap_state: "{{ weakness_unsigned_ldap_state | default('absent') }}" + unsigned_ldap_key: "{{ lab_weakness_unsigned_ldap_key }}" + unsigned_ldap_value: "{{ lab_weakness_unsigned_ldap_value }}" + maq_state: "{{ weakness_maq_state | default('absent') }}" + maq_present: "{{ lab_weakness_maq_present }}" + maq_absent: "{{ lab_weakness_maq_absent }}" + spooler_state: "{{ weakness_spooler_state | default('absent') }}" SysmonVersion: "{{ sysmon_version }}" SysmonConfig: "{{ sysmon_config_sha256 }}" script: | @@ -149,6 +157,11 @@ $f = Get-DnsServerForwarder $r["forwards to $Gateway only"] = ((@($f.IPAddress.IPAddressToString) -join ',') -eq $Gateway) $r['no root hints'] = -not (Get-DnsServerRootHint) + # ADR-0140: dsHeuristics kept as Server 2025 ships it, unset. The + # 3051/3054 events at boot are expected; a value here is a hardening. + $dsh = Get-ADObject -Identity ("CN=Directory Service,CN=Windows NT,CN=Services," + + (Get-ADRootDSE).configurationNamingContext) -Properties dsHeuristics + $r['dsHeuristics unset, as shipped'] = [string]::IsNullOrEmpty($dsh.dsHeuristics) $src = (w32tm /query /source | Out-String).Trim() if ([bool]::Parse($IsPrimary)) { $r["clock from $Gateway"] = ($src -like "$Gateway*") @@ -292,7 +305,7 @@ } # --- #449: each deliberate weakness is in the state its toggle names - - # Default absent, so a plain run asserts every one of these six + # Default absent, so a plain run asserts every one of these nine # primitives is NOT there — the per-primitive negative test. It does # not walk the authorization graph, so it is not on its own a proof # that no path to Domain Admin exists; that graph-level check is the @@ -368,6 +381,29 @@ $bHave = ($trusted -contains $rp.SID.Value) } $r['rbcd matches its toggle'] = ($bHave -eq ($Weak.rbcd_state -eq 'present')) + + # maq (ADR-0140): the quota on the domain head, 10 or 0, and + # nothing between. + $q = (Get-ADObject -Identity $wbase -Properties 'ms-DS-MachineAccountQuota').'ms-DS-MachineAccountQuota' + $qWant = if ($Weak.maq_state -eq 'present') { $Weak.maq_present } else { $Weak.maq_absent } + $r["machine account quota is $qWant, as maq names"] = ([int]$q -eq [int]$qWant) + } + + if ($onDc) { + # unsigned_ldap (ADR-0140): present is the enforcement value at 0 + # over the shipped LDAPServerIntegrity of 1; absent is the value + # unset, Server 2025's enforced default. + $lp = Get-ItemProperty -Path $Weak.unsigned_ldap_key -ErrorAction SilentlyContinue + $lv = $lp.($Weak.unsigned_ldap_value) + $lHave = ($null -ne $lv -and [int]$lv -eq 0 -and [int]$lp.LDAPServerIntegrity -eq 1) + $r['unsigned_ldap matches its toggle'] = if ($Weak.unsigned_ldap_state -eq 'present') { + $lHave } else { ($null -eq $lv) } + + # spooler (ADR-0140): running and Automatic, or stopped and Disabled. + $spl = Get-Service Spooler -ErrorAction SilentlyContinue + $r['spooler matches its toggle'] = if ($Weak.spooler_state -eq 'present') { + [bool]($spl -and $spl.Status -eq 'Running' -and $spl.StartType -eq 'Automatic') + } else { [bool]($spl -and $spl.Status -eq 'Stopped' -and $spl.StartType -eq 'Disabled') } } if ($LabRole -eq 'endpoint') { diff --git a/docs/adr/0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md b/docs/adr/0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md index b58da952..81aa7969 100644 --- a/docs/adr/0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md +++ b/docs/adr/0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md @@ -6,6 +6,11 @@ > [ADR-0077](0077-configure-the-lab-domain-with-ansible-from-phoenix.md) amends the "join none of the estate's loops" > consequence. The text here is left as written, per ADR-0001 and ADR-0115. > +> [ADR-0140](0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md) amends "LDAP signing on the two DCs" in the +> list of hardening deliberately removed: it is removed on demand, by the +> `unsigned_ldap` switch, and stays enforced as shipped otherwise. The text +> here is left as written, per ADR-0001 and ADR-0115. +> > The host this ADR calls `zion` is named **`smaug`** since 2026-09 > ([ADR-0038](0038-name-the-nas-smaug-and-reserve-zion-for-the-box-that-does-not-exist.md)). > The address, the rules and the decision are unchanged — only the label. The diff --git a/docs/adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md b/docs/adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md index e6cacf4a..386521ae 100644 --- a/docs/adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md +++ b/docs/adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md @@ -6,6 +6,13 @@ secret in `phoenix.env`) and [ADR-0078](0078-populate-the-lab-domain-from-a-committed-file-and-a-seed.md) (the weaknesses it said would come) +> [!NOTE] +> [ADR-0140](0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md) adds three switches in this model, `unsigned_ldap`, +> `maq` and `spooler`, under the reopen clause below. For `maq` and `spooler` +> `absent` is the hardened side, so applying them with the defaults changes +> the DCs, where this ADR's six changed nothing on merge. The text here is +> left as written, per ADR-0001 and ADR-0115. + ## Context [ADR-0029](0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md) diff --git a/docs/adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md b/docs/adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md new file mode 100644 index 00000000..737504db --- /dev/null +++ b/docs/adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md @@ -0,0 +1,115 @@ +# ADR-0140: Switch three of the DCs' shipped defaults, and keep dsHeuristics as shipped + +**Status:** Accepted · 2026-11 · amends +[ADR-0029](0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md) +on LDAP signing, and adds three switches to +[ADR-0083](0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md) +under its reopen clause + +## Context + +A read-only audit of `bahamut`, the PDC emulator, ran from 2026-11-13 to +2026-11-25, with `leviathan` read for the same points. It found four things +on the two domain controllers that the repository either contradicts or does +not mention at all: + +- **LDAP signing is enforced.** ADR-0029 lists it as "hardening deliberately + removed, once, with the removal recorded", because Server 2025 DCs require + it where 2019 and 2022 did not. Nothing removed it. Both DCs read + `LDAPServerIntegrity` 1 with `LdapServerEnforceIntegrity` unset, which on + Server 2025 means enforced, and both log Directory Service event 2888 + (unsigned binds rejected), last on 2026-11-17. + [`build-the-bloodhound-guest.md`](../runbooks/build-the-bloodhound-guest.md) + already works around it: `bloodhound-ce-python` and `netexec` cannot + collect, so SharpHound on a domain host is the only collector. The + repository therefore said two different things, and `ansible/` encoded + neither. +- **`ms-DS-MachineAccountQuota` is 10**, the shipped default. Any of the + population's users can create computer accounts, which is the usual first + step of RBCD and shadow-credential chains. That does not depend on the `rbcd` + switch, so a plain run did not remove it. +- **Print Spooler runs on both DCs.** A DC is trusted for unconstrained + delegation by default, so any domain user can coerce a DC's machine account + to authenticate somewhere. With signing enforced and no AD CS there is no + complete relay path today. It completes one as soon as `ucd` is on or + signing is lifted, outside the switch model. +- **`dsHeuristics` is unset.** Directory Service events 3051 and 3054 at each + boot say that per-attribute authorization on LDAP add and the implicit-owner + restrictions are not enforced. + +ADR-0083 promised that a plain `lab-domain.yml` followed by `verify.yml` is the +negative test: every weakness off, and no path to Domain Admin. MAQ and +Spooler sat outside that test. LDAP signing was on when ADR-0029 said it should +be off. + +ADR-0083's reopen clause says a weakness that turns off a shipped default is a +change to ADR-0029 first. This ADR is that change for LDAP signing. MAQ and +Spooler go the other way: they are shipped defaults that a plain run now turns +off. + +## Decision + +**Three new switches, in ADR-0083's model.** Each is one role and one tag with +`weakness__state`. The default is `absent`, both directions are +idempotent, and `verify.yml` asserts the state the toggle names. + +| Tag | `present` | `absent` (a plain run) | Where | +| --- | --- | --- | --- | +| `unsigned_ldap` | `LdapServerEnforceIntegrity` = 0: unsigned simple and SASL binds are accepted | the value is removed, which is Server 2025's default of enforced | both DCs | +| `maq` | `ms-DS-MachineAccountQuota` = 10, the shipped default | 0: only delegated admins create computer accounts | the domain head | +| `spooler` | Print Spooler Automatic and running, as shipped | Disabled and stopped | both DCs | + +- **LDAP signing becomes off on demand, not off for good.** This amends + ADR-0029's "removed once, recorded". Signing off permanently would make + NTLM relay to LDAP available in every plain run. It would then be part of + every BloodHound graph and every "no path" claim, and it would no longer be + an exercise someone chose to run. As a switch, the relay exercise still + exists, and the removal is recorded each time someone enables it. + `LDAPServerIntegrity` stays at its shipped 1. The role refuses to enable the + switch if that value is anything else, because 2 would require signing + whatever the enforcement setting says. +- **MAQ and Spooler are switches whose `absent` hardens.** ADR-0083's six + *add* a primitive when present. These two *keep* a shipped primitive when + present. The direction is the same: `present` means the weakness exists. It + costs nothing the lab uses. Every join runs as `AD\Administrator`, and + `rbcd` brings its own controlled principal, `svc-rbcd`, rather than one a + user creates. The members' Spooler is not touched. Coercing a member server + is not a path to Tier 0, and §0's list does not cover it. +- **`dsHeuristics` stays as shipped.** It is a Server 2025 default that the lab + keeps, like those in §0's list. Events 3051 and 3054 at boot are expected. + `verify.yml` asserts the attribute is still unset, so a reflexive hardening + shows up red. Hardening it would close owner-rights techniques the exercises + may want later, and it is not on any path the switches open. + +## Alternatives considered + +- **Encode ADR-0029 as written, with signing off for good.** That is what the + ADR says. It was rejected because it puts a relay primitive into the negative + test. +- **Supersede ADR-0029 and keep signing enforced with no switch.** That is + honest about the box, but it deletes the LDAP-relay exercise, which ADR-0029 + chose Server 2025 partly to teach. +- **Set MAQ to 0 and disable Spooler permanently.** That gives the same plain + run, but an RBCD-by-new-computer or coercion exercise would then need a + change to this ADR instead of a tag. +- **Declare MAQ and Spooler as shipped defaults in §0's list.** That keeps "as + Windows ships", but then ADR-0083's negative test is only true if the graph + happens to have no path. It would not be true by construction. + +## Consequences + +- **Unlike ADR-0083's six, these change the live DCs on the first plain run.** + `--tags maq,spooler` with the defaults sets MAQ to 0 on the domain and stops + and disables Spooler on `bahamut` and `leviathan`. `unsigned_ldap` changes + nothing there, because it is already absent. +- **The BloodHound runbook's Linux collectors work only while `unsigned_ldap` + is present.** SharpHound stays the default collector, and its graph is the + one the negative test reads. +- **`verify.yml` checks nine switches plus one kept default.** A plain run + asserts all nine are absent and `dsHeuristics` is unset. +- **The registry value is the proof, not a bind.** `phoenix` has no + `ldap-utils` or GSSAPI tooling. An unsigned bind test from it would need + that tooling added through the repository first. Directory Service event + 2888 on the DCs is the observable for the purple-team loop. +- **Reopened by:** an exercise that needs Spooler on a member server turned + off, or a `dsHeuristics` hardening. Either one is a new ADR. diff --git a/docs/changelog.md b/docs/changelog.md index dc0aca89..cdcbee44 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -19,6 +19,26 @@ docstring gives: it is a record, not a claim about now. ## 2026-11-26 +- **Lab domain: what the `bahamut` audit found, decided (ADR-0140).** The + read-only audit of the PDC emulator (2026-11-13 to 2026-11-25, with + `leviathan` read for the same points) found four things on the DCs that the + repository contradicted or did not mention. Each is now decided in + `ansible/` and asserted by `verify.yml`: + - **LDAP signing was enforced on both DCs**, though ADR-0029 said it was + removed. Directory Service event 2888 recorded rejected unsigned binds, + last on 11-17. It is now the `unsigned_ldap` switch, absent by default, + which leaves the box as it is. + - **`ms-DS-MachineAccountQuota` was 10** and **Print Spooler ran on both + DCs**, and neither was declared. They are now the `maq` and `spooler` + switches. Their absent side is the hardened one, so the first plain run + sets the quota to 0 and disables Spooler on both DCs. + - **`dsHeuristics` is unset**, and events 3051 and 3054 fire at boot. It is + kept as Server 2025 ships it, and `verify.yml` asserts that. + - Not in this change: the pending 2026-11 updates. ADR-0137 already + decided those (not patched in place). The audit's staging-leftovers and + DFSR-noise findings follow separately. The tags have not yet been + applied to the live domain. + - **The read-only audit of `ramuh` (2026-11-13, re-checked 2026-11-25, and checked from `phoenix` today) changes nothing on the guest.** It shares most of what the `titan` audit found. ADR-0136, ADR-0137 and the disk and diff --git a/docs/roadmap.md b/docs/roadmap.md index 3bdaa3ee..1f52fe81 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -100,7 +100,8 @@ Ansible, Sysmon and BloodHound each closed with its issue, and the record is in sub-issue per weakness: #1475 kerberoast, #1476 AS-REP roast, #1477 DCSync, #1478 resource-based constrained delegation, #1479 unconstrained delegation and #1480 constrained delegation. It closes when all six are recorded, each - with a detection outcome. → [runbook](runbooks/build-the-lab-domain.md) + with a detection outcome. The three switches of ADR-0140 (`unsigned_ldap`, + `maq`, `spooler`) are off by default and are not among the six. → [runbook](runbooks/build-the-lab-domain.md) ## last diff --git a/docs/runbooks/build-the-bloodhound-guest.md b/docs/runbooks/build-the-bloodhound-guest.md index 009ed54b..8201dc6e 100644 --- a/docs/runbooks/build-the-bloodhound-guest.md +++ b/docs/runbooks/build-the-bloodhound-guest.md @@ -488,12 +488,17 @@ containers to come back. They have `restart: unless-stopped`. not something to clear. Afterwards undo exactly what you changed — re-enable real-time protection, and if you added the process exclusion, remove it, because re-enabling protection does not clear an exclusion. - - **The network collectors do not work here.** `bloodhound-ce-python` and - `netexec` authenticate, but both DCs enforce LDAP signing and have no - LDAPS certificate (the lab runs no AD CS), so neither can collect: - signing refuses plain LDAP, and `636` has no cert. SharpHound on a - domain host is the only path, because the Windows LDAP client signs and - seals over `389` natively. Do not re-walk the Linux route. + - **The network collectors do not work here by default.** + `bloodhound-ce-python` and `netexec` authenticate, but both DCs enforce + LDAP signing and have no LDAPS certificate (the lab runs no AD CS), so + neither can collect: signing refuses plain LDAP, and `636` has no cert. + SharpHound on a domain host is the path, because the Windows LDAP client + signs and seals over `389` natively. Signing is lifted only by the + `unsigned_ldap` switch + ([ADR-0140](../adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md), + `build-the-lab-domain.md` §5a). While it is present the Linux collectors + work, but the graph that answers "no path with every switch off" is + SharpHound's, collected with it absent. - **Getting the zip to the UI.** `carbuncle`'s own browser cannot upload (Hicks only, above), and RDP is off, so pull the zip off `carbuncle` from `phoenix` with `scp` as the built-in Administrator — `acooper` has no SSH diff --git a/docs/runbooks/build-the-lab-domain.md b/docs/runbooks/build-the-lab-domain.md index 2144af8e..0080e999 100644 --- a/docs/runbooks/build-the-lab-domain.md +++ b/docs/runbooks/build-the-lab-domain.md @@ -865,7 +865,10 @@ turn it off deliberately, and write down that you did. The six weaknesses #449 asks for — `kerberoast`, `asreproast`, `dcsync`, `ucd`, `cd`, `rbcd` — are each a tag on the same playbook, each off until you ask for it ([ADR-0083](../adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md)). -A plain run leaves every one absent. +Three more, `unsigned_ldap`, `maq` and `spooler`, switch shipped defaults on +the DCs the same way +([ADR-0140](../adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md)). +A plain run leaves all nine absent. > [!IMPORTANT] > **The observation is the deliverable, not the compromise.** The point of each @@ -885,6 +888,17 @@ Before the first one, two things: and `rbcd` exercises authenticate with. A role refuses to *enable* a weakness while it is unset. Set it to something a wordlist would find, on purpose. +> [!NOTE] +> **For `maq` and `spooler`, absent is the change.** Windows ships the machine +> account quota at 10 and Print Spooler running on a DC; a plain run sets the +> quota to 0 and stops and disables Spooler on `bahamut` and `leviathan`. +> `unsigned_ldap` absent leaves LDAP signing enforced, as Server 2025 ships +> it. This is ADR-0029's "LDAP signing deliberately removed" made a switch: +> enable it when the exercise is relay to LDAP, and the removal is recorded by +> the run that enabled it. `dsHeuristics` is kept as shipped, unset, so +> Directory Service events 3051 and 3054 at each DC boot are expected and +> `verify.yml` fails if it is ever set. + The loop, one weakness (here `kerberoast`) at a time: ```bash @@ -895,7 +909,7 @@ ansible-playbook lab-domain.yml --tags kerberoast # defaul ansible-playbook verify.yml # confirm it is gone ``` -A plain `ansible-playbook verify.yml`, with nothing enabled, asserts all six of +A plain `ansible-playbook verify.yml`, with nothing enabled, asserts all nine of these primitives are absent — the **per-primitive negative test**. It does not collect the authorization graph, so the graph-level test #449 names — "run the collector with the tags off and confirm the path to Domain Admin is not there" — @@ -910,6 +924,9 @@ not this. A lab that is always exploitable proves nothing about the tags. | `ucd` | `TRUSTED_FOR_DELEGATION` set on `ramuh` | clears the flag on `ramuh` | | `cd` | `svc-web` (its own SPN) allowed to delegate to `CIFS/titan…` | deletes `svc-web`; `titan` untouched | | `rbcd` | `titan` set to trust `svc-rbcd` to act on its behalf | clears the trust on `titan`, deletes `svc-rbcd` | +| `unsigned_ldap` | `LdapServerEnforceIntegrity` 0 on both DCs: unsigned binds accepted, relay to LDAP possible (Directory Service event 2887 counts them, where 2888 counted rejections) | removes the value: signing enforced, as shipped | +| `maq` | `ms-DS-MachineAccountQuota` 10: any domain user can create computer accounts | sets it to 0 | +| `spooler` | Print Spooler Automatic and running on both DCs: any user can coerce a DC's authentication | stops and disables it on both DCs; members untouched | The fixed identifiers — account names, SPNs, the delegation target and resource — are in [`ansible/inventory/group_vars/all.yaml`](../../ansible/inventory/group_vars/all.yaml),