CAPTEST:(8)
π CAPTEST β a program to demonstrate capabilities β¨
ok so bestie, welcome to captest β it's from section 8 of the manual (System Administration Utilities, iykyk) and it's literally the cutest lil tool for peeking at what your process is allowed to do. let's get into it π«Ά
πΈ NAME πΈ
captest β a program to demonstrate capabilities. that's it, that's the whole vibe π
β¨ SYNOPSIS β¨
captest [ --ambient --drop-all | --drop-caps | --id ] [ --init-grp ] [
--lock ] [ --text ]
π DESCRIPTION π
okay so captest is a program that demonstrates and prints out the current process capabilities. it's giving "show me what i'm working with" energy π
here's the tea: every single option prints the same report. like, the flags change how it sets up the process, but the report itself? same every time. no cap. here's what it does, in order:
- it outputs the current capabilities.
- then it tries to access
/etc/shadowdirectly, just to show if that can even be done π - then it creates a child process that attempts to read
/etc/shadowand outputs the results of that. - then it outputs the capabilities that a child process would have.
so basically a whole little capability saga in one run, slay π
you can also apply file system capabilities to this program to study how they work, which is lowkey the most fun part. for example:
filecap /usr/bin/captest chown
then run captest as a normal user. iconic.
another interesting test is to make captest suid root so you can see what the interaction is between root's credentials and capabilities. for example:
chmod 4755 /usr/bin/captest
when run as a normal user, the program will see if privilege escalation is possible. spicy πΆοΈ
bestie i need you to hear me on this one: do not leave this app setuid root after you are done testing, so that an attacker cannot take advantage of it. seriously. that's not a vibe. clean up after yourself fr fr π¨
π OPTIONS π
--ambientβ this attempts to addCAP_CHOWNambient capability. ambitious of it β¨--drop-allβ this drops all capabilities including ambient, and clears the bounding set. scorched earth, no survivors π--drop-capsβ this drops just traditional capabilities. a lil more chill about it.--idβ this changes to uid and gid99, drops supplemental groups, and clears the bounding set. full identity crisis speedrun π¦--init-grpβ this changes to uid and gid99and then adds any supplemental groups that comes with that account. heads up tho: you would have add them prior to testing, because by default there are no supplemental groups on account99. so like, plan ahead bestie π--textβ this option outputs the effective capabilities in text rather than numerically. way easier on the eyes ngl π--lockβ this prevents the ability for child processes to regain privileges if the uid is0. lock it down, periodt π
π¦ SEE ALSO π¦
π AUTHOR π
Steve Grubb π
and that's the whole page, bestie!! this one came from Red Hat, dated Sept 2020 β so when you're out here checking your capabilities, just know you're standing on some classic Red Hat documentation shoulders. go forth, drop some caps (responsibly!!), and don't forget to un-suid that binary. mwah πβ¨
π¦ where this page comes from
- alpine 3.22: libcap-ng-doc 0.8.5-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.23: libcap-ng-doc 0.8.5-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.24: libcap-ng-doc 0.8.5-r2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: libcap-ng-utils 0.8.2-7.el9 Β· GPLv2+
- debian bookworm: libcap-ng-utils 0.8.3-1+b3 Β· LGPL-2.1-or-later
- debian trixie: libcap-ng-utils 0.8.5-4+b1 Β· LGPL-2.1-or-later
- fedora 43: libcap-ng-utils 0.8.5-8.fc43 Β· LGPL-2.0-or-later
- opensuse-leap 16.0: libcap-ng-utils 0.8.5-160000.3.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: libcap-ng-utils 0.8.5-160000.3.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: libcap-ng-utils 0.8.5-160000.3.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: libcap-ng-utils 0.8.5-160000.3.2 Β· GPL-2.0-or-later
- ubuntu noble: libcap-ng-utils 0.8.4-2build2 Β· LGPL-2.1-or-later
- ubuntu questing: libcap-ng-utils 0.8.5-4build2
- ubuntu resolute: libcap-ng-utils 0.8.5-4build5 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms