BSD privilege escalation
Review doas rules for commands that let a compromised account run a service as root.
doas
doas is the BSD equivalent of sudo: it runs a command as another user.
Whether the configuration is exploitable depends on the rules granted to the
compromised account, so locate the configuration files and read them.
# Locate configuration files
find / -type f -name "doas.conf" 2>/dev/nullA rule such as the following permits exactly the named service action as root:
permit nopass andrew as root cmd service args apache24 onestartThe service can then be started as root:
doas -u root service apache24 onestartThis is not an arbitrary root shell. Escalation beyond that action requires control over a script, binary or configuration it uses.
Resources:
Provenance and confidence
- Version
- 2
- Sources reviewed
- 2026-11-23
- Confidence
- medium — Legacy RTFM; v2 editorial review on 2026-11-23 distinguishes a permitted service action from arbitrary root execution. No host test.
Also searched as: élévation de privilèges, bsd, doas, doas.conf, freebsd