Security review: fix traversal, identity, injection and takeover paths
CI / agent (push) Successful in 3s
CI / site (push) Successful in 2s
CI / go (push) Successful in 34s

Findings from a full review (auth/API, CA and rack channel, config
generation, integrations, UI/agents/scripts), each verified in code:

- rack binary endpoint read any region file via arch=../.. (CA key)
- render endpoint traversal; machine-reported MACs used as file paths
- delegated intermediates could mint admin/rack identities and IPs;
  identities now require root-issued certs, intermediates are
  ServerAuth-only with both name types constrained
- rack certs were ServerAuth for rack-chosen SANs: now client-only;
  racks accept only the region's own cert; join checks the CA
  fingerprint; unbound join codes cannot take an existing name; job
  results bound to the rack that took them
- rack self-update: region signs binaries with the CA key, the root
  unit verifies against the join-time CA in a root-owned dir
- dnsmasq reads a checked, root-owned copy limited to generated options
- commissioning could overwrite deployed machines; MAC takeover of PXE
- injection into dnsmasq/cloud-init/PXE/udev/DNS via names and
  machine-reported strings; stored XSS in the UI; CSP and cross-origin
  protection; deploy agent shell injection and seed traversal
- Redfish requests confined to the BMC's /redfish/ tree
- admin_http defaults to loopback; body limits and timeouts; secrets
  off command lines

Also: IPAM claim/reconcile race, sync stopping on one error, watchdog
race, release wiping the wrong disk, SAN LUNs as auto targets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-29 17:58:42 +01:00
1 parent 6e4be736ec
commit a549f01ef5
28 files changed
+782 -154

No files matched your search

+67
View File
@@ -15,7 +15,74 @@ publish a tag that has no section here.
`_rollcall.<name>` TXT marker and update prerequisites, so foreign records are never overwritten;
drift is detected by querying). `rollcall dns`, `rollcall dns sync [-dry]`, a doctor check.
### Security
A review of the whole code base; the fixes below. Upgrading: rerun `deploy/install.sh` on the
region and `deploy/install-rack.sh` on rack hosts (new dnsmasq layout, signed rack updates).
- **Region file read (critical).** A rack controller could read any file on the region (CA key,
config) through `/api/v1/rack/binary?arch=../..`. `arch` is now a known architecture.
- **Path traversal.** In `/api/v1/render/...` (admin) as well.
- **Machine-reported MACs.** A MAC could be a path, letting a PXE-booting host make the rack write
outside the TFTP directory. Only real hardware addresses are accepted. Rack controllers write only
`01-xx-..` file names.
- **Delegated intermediates.** An ACME intermediate could mint admin or rack certificates (name
constraints do not cover the CN), and IP addresses when only a domain was permitted.
- Admin and rack identities must now be signed by the root itself.
- Intermediates carry a ServerAuth-only EKU, and the unconstrained name type is closed.
- **Rack certificates.** These were ServerAuth certificates for any address the rack reported, so
one rack could pose as the region.
- They are now client-only with no names.
- Racks accept only the region's own certificate.
- `rack join` checks the returned CA against the fingerprint in the code.
- An unbound join code cannot take over an existing rack's name.
- Job results are accepted only from the rack that took the job.
- **Rack self-update.** The root unit ran a binary the unprivileged rack user staged.
- The region now signs each binary with its CA key.
- The root unit verifies the signature against the CA from `rack join`, in a root-owned directory,
without following links.
- **dnsmasq as root.** dnsmasq (root) read configuration the rollcall user writes, and the reload
script copied files through links in rollcall's directory.
- It now reads a checked copy in `/var/lib/rollcall-dnsmasq`.
- The copy may hold only the options Rollcall generates: nothing that runs a program or includes
a file.
- **Machine record takeover.** Any host on the provisioning network could overwrite a deployed
machine's record (and BMC) by reporting its UUID.
- Known machines are re-commissioned only when `ready`, `recommission` or failed.
- A MAC another machine owns keeps its boot file.
- The rack controller of a ready machine is not changed by whoever reports it.
- **Injection into dnsmasq, cloud-init, PXE menus, udev rules and DNS updates.** Subnet domain and
gateway, host names, NIC names, reservation names and machine-reported identity strings are now
validated or reduced to one line. Machine IDs are letters and digits only.
- **Web UI.**
- Escaping is fixed for machine-reported inventory fields (stored XSS).
- A Content-Security-Policy, `frame-ancestors 'none'`, nosniff and no-referrer are set.
- Cross-origin state-changing requests are refused (`http.CrossOriginProtection`), so a page
elsewhere cannot use a browser's admin certificate.
- `?token=` is no longer logged.
- **Deploy agent.**
- The image URL no longer goes into a shell command; the checksum is taken over the bytes written.
- Seed files cannot leave the target root.
- The BMC password is not kept in the fallback inventory file.
- **Redfish.** Requests stay on the BMC and under `/redfish/`: paths the BMC returns cannot send the
credentials elsewhere, and `scheme://` addresses are reduced to scheme and host.
- **Defaults and limits.**
- `admin_http` defaults to `loopback`.
- Request bodies are capped (commissioning 4 MB, all 16 MB), with read and idle timeouts.
- `bootstrap.sh` and `publish-image.sh` keep the database password and API tokens off command
lines.
### Fixed
- IPAM: a reconcile running during an allocation could delete the record just reserved in NetBox.
- IPAM and DNS sync: one failing record no longer stops the rest of the pass, deletes included.
Reservations are stored in one spelling.
- The job watchdog could fail a job that had just started.
- Release without `-disk` wiped the smallest disk, not the one the OS was deployed to. Automatic
disk choice skips SAN LUNs (iSCSI, FC, SRP).
- RFC 2136 lookups follow the request context. The marker is not removed when the database cannot
say whether other records need it.
- Smaller fixes:
- `seq` in templates is capped.
- Layout selector `ib:-1` no longer panics.
- Redfish detection no longer runs on a machine that cannot be read.
- dnsmasq busy loop in proxy mode (a dnsmasq bug with tagged proxy ranges, found with gdb): proxy
ranges are untagged, PXE services limited by interface; `dhcp-boot`/`dhcp-match` only for served
subnets, no `dhcp-host` lines for proxied ones.