Actions
Bug #437
closedserver.c misinterprets 'chroot -u'
Status:
Fixed
Priority:
Normal
Category:
core
Target version:
-
ASK QUESTIONS IN Forums:
Description
Hi!
If I want to run lighty with 'chroot -u', I get this:
'''Are you nuts ? Don't apply a SUID bit to this binary'''
man chroot tells me:
----
If the u, -g or -G options are given, the user, group and group list of
the process are set to these values after the chroot has taken place.
See setgid(2), setgroups(2), setuid(2), getgrnam(3) and getpwnam(3).
---
The SUID-check is based on '''geteuid()* and *getegid()''', so - even if the SUID-bit of the executable is not set - the following '''src/server.c'''-block will evaluate as ''true'':
#ifdef HAVE_GETUID if (!i_am_root && (geteuid() == 0 || getegid() == 0)) { /* we are setuid-root */ log_error_write(srv, __FILE__, __LINE__, "s", "Are you nuts ? Don't apply a SUID bit to this binary"); server_free(srv); return -1; } #endif
Kind regards,
Petar Bogdanovic
-- p.netbsd
Updated by Anonymous over 19 years ago
- Status changed from New to Fixed
- Resolution set to fixed
Sorry, I was totally blind: I forgot '_-g'_ of chroot, so '''getegid() == 0'''!
I apologise for the trouble caused - please close.
Kind regards,
Petar Bogdanovic
-- p.netbsd
Actions
Also available in: Atom