dropping privileges and checking error returns
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Security Advisory |
Won't Fix
|
Undecided
|
Unassigned | ||
oslo.privsep |
In Progress
|
Low
|
Unassigned |
Bug Description
Hello, I'm conducting a super-quick review of oslo.privsep as part of the
Ubuntu Main Inclusion process.
I noticed a few odd things with some of the privilege dropping code that
may or may not represent bugs:
def _drop_privs(self):
try:
# Keep current capabilities across setuid away from root.
if self.group is not None:
if self.user is not None:
if self.group is not None:
finally:
First, if the transition is to a non-root user, the only setgid()
transitions that will work are to the real group ID or saved set-group-ID.
If the setgid() and setuid() lines are swapped, all group IDs will work.
Is this intentional?
Second, I don't understand why supplementary groups aren't dropped always.
The 'is not None' check doesn't make sense to me. Why not drop the
supplementary groups unconditionally?
Third, and most troubling, the setuid() and setgid() functions throw
exceptions when they fail but this function ignores all exceptions. These
calls can fail and when they do, it can have catastrophic consequences.
The error returns from the system calls must be checked. Does oslo.privsep
die properly when these functions fail?
Thanks
Changed in ossa: | |
status: | New → Incomplete |
description: | updated |
I added a manual subscription to hopefully make these visible. If that didn't do it, I'll just open them public.
Thanks