next up previous
Next: Don't fix it, rewrite Up: New Solutions Previous: Avoid setuid if a

Use setgid rather than setuid

In many cases, it's enough to make an application setgid rather than setuid. For instance, consider your typical dialout application that has to create a lock file in /var/lock/uucp whenever it grabs the serial device. If the lock directory is owned by user and group uucp, you can make this application setuid or setgid uucp.

Does this make any difference? Yes, there's a small but important one. Assume you've made it setuid, and there's a bug in it that gives the attacker uid uucp. The program he attacked is owned by uucp as well, so he can replace it with a modified version that behaves just like the original one,11.2 but ``steals'' the uids of all users who invoke the program. Who knows, maybe one day the super user will come along and run this utility?

This can be avoided by making the program setgid uucp and giving it mode 555 permissions. An attacker cracking this program will not be able to modify the binary because all he gets out of cracking it is group uucp privilege.


next up previous
Next: Don't fix it, rewrite Up: New Solutions Previous: Avoid setuid if a
Olaf Kirch 2002-01-16