3 ms·
Efficiency (spawning setuid program for every line printed by ls -alv is a bit too much), and you don't want to make too privileged programs too (suid ls?)
by p_l 5y ago
Efficiency (spawning setuid program for every line printed by ls -alv is a bit too much), and you don't want to make too privileged programs too (suid ls?)
- Spivak 5y agoI mean the hypothetical program would have just dumped the whole file minus the sensitive bits.
- chungy 5y agoAnd then you've reinvented /etc/shadow but worse. :)
- mindwok 5y agoExposing a setuid program that prints the file would be more dangerous though. The result is the same (you can read /etc/passwd) except now you have a vector for gaining root access through an exploit to this setuid program.
- a-dub 5y agosee getpwnam, which was already public for years and linked by everything. it queries one record at a time.
- tremon 5y agogetpwnam() gets its data by parsing /etc/{passwd,shadow}[0]. It isn't a magical system call that elevates the privileges of the calling program. [0] assuming your nsswitch says so
- a-dub 5y agoyeah. agree, was merely pointing out the public interface for querying passwd records for the purposes of highlighting why said interface might be another reason to reconsider the proposed idea of a setuid shim that reads a read protected /etc/passwd that contains password hashes and returns only the public components.