Cron not checking setgid return value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cron (Debian) |
Fix Released
|
Unknown
|
|||
cron (Ubuntu) |
Fix Released
|
Medium
|
Jamie Strandboge | ||
Dapper |
Fix Released
|
Medium
|
Jamie Strandboge | ||
Hardy |
Fix Released
|
Medium
|
Jamie Strandboge | ||
Intrepid |
Fix Released
|
Medium
|
Jamie Strandboge | ||
Jaunty |
Fix Released
|
Medium
|
Jamie Strandboge | ||
Karmic |
Fix Released
|
Medium
|
Jamie Strandboge |
Bug Description
From reading
http://
I noticed, while investigating, that Ubuntu cron doesn't check the return value of setgid. This was checked against the source of cron_3.
There's probably some odd circumstances where this could lead to a user script could be left running as group "root".
Patch (untested):
--- do_command.c.orig 2006-05-25 22:29:05.000000000 +0100
+++ do_command.c 2006-05-25 22:30:01.000000000 +0100
@@ -296,7 +296,13 @@
/* set our directory, uid and gid. Set gid first, since once
* we set uid, we've lost root privledges.
*/
- setgid(e->gid);
+ if (setgid(e->gid) !=0) {
+ char msg[256];
+ snprintf(msg, 256, "do_command:
+ (unsigned long) e->uid, strerror(errno));
+ log_it(
+ exit(ERROR_EXIT);
+ }
# if defined(BSD) || defined(POSIX)
# endif
Changed in cron (Ubuntu Dapper): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
assignee: | nobody → Jamie Strandboge (jdstrand) |
Changed in cron (Ubuntu Hardy): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
assignee: | nobody → Jamie Strandboge (jdstrand) |
Changed in cron (Ubuntu Intrepid): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
assignee: | nobody → Jamie Strandboge (jdstrand) |
Changed in cron (Ubuntu Jaunty): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
assignee: | nobody → Jamie Strandboge (jdstrand) |
Changed in cron (Ubuntu Karmic): | |
status: | Triaged → In Progress |
Changed in cron (Debian): | |
status: | Unknown → Fix Released |
Confirming.