Enabling no_new_privs/NoNewPrivs, disabling setuid on Linux
Setuid binaries are not dangerous in themselves, but can lead to a security nightmare if they have vulnerabilities. The no_new_privs flag from the kernel effectively disables setuid binaries. This article explains how a Linux system with no_new_privs enabled by default can work.
I wonder if we could achieve the same with mac_do(4). I haven't yet played with it.
Credentials Transitions with mdo(1) and mac_do(4) | FreeBSD Foundation
Credentials Transitions with mdo(1) and mac_do(4) Credentials Transitions with mdo(1) and mac_do(4) By Olivier Certner In this article, we explore how the mdo(1) program can be used to easily and quickly launch a new process with different credentials and how system administrators can enable...