The UNIX Process Identity Crisis
Mark S. Dittmer, Mahesh Tripunitara · 2014
We revisit the setuid family of calls for privilege management that is implemented in several widely-used operating systems. Three of the four commonly used calls in the family are standardized by POSIX. We investigate the current status of setuid, and in the process, challenge some assertions in prior work. We address three sets of questions with regards to the setuid family. (1) Is the POSIX standard indeed broken as prior work suggests? (2) Are implementations POSIX-compliant as claimed? (3) Are the wrapper functions that prior work proposes to circumvent issues with setuid calls correct and usable? Towards (1), we express the standards in a precise syntax that allows us to assess whether they are unambiguous, logically consistent descriptions of well-formed functions. We have discovered that two of the three functions that are standardized fit these criteria, thereby challenging assertions in prior work regarding the quality of the standard. In cases wherein the standard is broken, we give a clear characterization, and suggest that the standard can be fixed easily, but at the cost of backwards-compatibility. Towards (2), we perform a state-space enumeration as in prior work, report on our discoveries, and discuss the implications of non-conformance and differences in implementation. Towards (3), we discuss some issues that we have discovered with prior wrappers. We then propose a new suite of wrapper functions which are designed with a different mindset from prior work, and provide both stronger guarantees with respect to atomicity and a clearer semantics for permanent and temporary changes in process identity. With a fresh approach, our work is a contribution to a well-established approach to privilege management.