3 ms·
Can anyone help me understand this part? > Dropping privileges means that the daemon temporarily forfeits its root privileges, adopting instead the lower privi
by vlovich123 6y ago
Can anyone help me understand this part?
> Dropping privileges means that the daemon temporarily forfeits its root privileges, adopting instead the lower privileges of the user. Ironically, that’s intended to be a security precaution, the goal of which is to protect the daemon from a malicious user who does something like symlinking their .pam_environment to /etc/shadow, which is a highly sensitive file that standard users aren’t allowed to read. Unfortunately, when done incorrectly, it also grants the user permission to send the daemon signals, which is why we’re able to send accounts-daemon a SIGSEGV.
What’s the recommended way to drop permissions while blocking the ability to kill the process (sure you can mask off SIGSEGV but SIGKILL isn’t maskable)?
Also, the wording makes it sound like you can re-acquire the original permissions which I thought is impossible. Isn’t dropping permissions a one-way operation? I would have thought there was some usage of fork here but the usage of `pidof` and 1 result in the write up would imply no forking. Maybe a link to the source here would be sufficient for me (I don’t see one in the article or in the thread here).
- vlovich123 6y agoAnswering my own question. Found the bug report: https://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/1900255 https://bugs.launchpad.net/ubuntu/+source/accountsservice/+b... Accountservice is actually changing its user ID rather than dropping capabilities which is where my confusion came from. It looks like there’s magic in the kernel to allow a process to switch back to the original user & some nuance about some ways of switching allowing you to send signals while other ways make your process act like a semi-hybrid of two user accounts (I.e. it technically looks owned by your user but you still don’t have permissions to do things with it). Security issues always lie in these kind of weird nuances.