[原文]FreeBSD kernel 4.6 and earlier closes the file descriptors 0, 1, and 2 after they have already been assigned to /dev/null when the descriptors reference procfs or linprocfs, which could allow local users to reuse the file descriptors in a setuid or setgid program to modify critical data and gain privileges.
FreeBSD Kernel /dev/null File Descriptor Handling Local Privilege Escalation
Local Access Required
Loss of Integrity
FreeBSD contains a flaw that may allow a malicious user to gain access to unauthorized privileges. The issue is triggered when the FreeBSD kernel allows a malicious user to direcly supply input to file descriptors during the execution of a setuid or setgid program. This flaw may lead to a loss of integrity.
Upgrade to version 4.6-STABLE; or to any of the RELENG_4_6 (4.6.1-RELEASE-p1), RELENG_4_5 (4.5-RELEASE-p10), or RELENG_4_4 (4.4-RELEASE-p17) security branches dated after the respective correction dates, as it has been reported to fix this vulnerability. In addition, FreeBSD has released patches for some older versions.
It is also possible to correct the flaw by implementing the following workarounds: remove the setuid bit from exploitable programs and unmount all instances of the procfs and linprocfs filesystems.