exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

cron_root_patch.txt

cron_root_patch.txt
Posted Sep 22, 1999

Vixie cron root exploit patch

tags | exploit, root
SHA-256 | f54026b4066d61c13b69746bfd949aae014586844e6e4dee58a860c2f0096975

cron_root_patch.txt

Change Mirror Download
Subject:      Vixie Cron version 3.0pl1 vulnerable to root exploit
To: BUGTRAQ@SECURITYFOCUS.COM


Vixie Cron version 3.0pl1 vulne.ems Content-Type: text/plain; charset=us-ascii

*** PGP Signature Status: unknown
*** Signer: Unknown, Key ID xAE8F7CF5
*** Signed: 8/28/99 11:42:41 PM
*** Verified: 9/22/99 1:44:11 AM
*** BEGIN PGP VERIFIED MESSAGE ***


Red Hat has recently released a Security Advisory (RHSA-1999:030-01)
covering a reverse denial of service bug in the vixie cron package.
As user you could restart sendmail even if the host should not receive
mail through the SMTP port.

Further investigation discovered that it was even worse. Vixie cron
runs as root at the time sending acknowledge mail to a user. Passing
arbitrary parameters to sendmail at this time leads into a possible
root exploit (like -C/tmp/myexploitsendmail.cf).

Olaf Kirch has developed the following patch that will send the mail
as user instead of root and removes the possibility to pass arguments
to the installed MTA.

Fixed packages available:

Red Hat - already released

Caldera - in progress

Debian - in progress

Slackware - no Vixie cron, they use Dillen's Cron Daemon instead


diff -ur cron-3.0pl1.orig/config.h cron-3.0pl1/config.h
--- cron-3.0pl1.orig/config.h Thu Aug 26 15:03:15 1999
+++ cron-3.0pl1/config.h Thu Aug 26 17:00:14 1999
@@ -42,11 +42,13 @@
*/

#define MAILCMD _PATH_SENDMAIL /*-*/
-#define MAILARGS "%s -FCronDaemon -odi -oem -or0s %s" /*-*/
+#define MAILARGS "%s -FCronDaemon -odi -oem %s" /*-*/
/* -Fx = set full-name of sender
* -odi = Option Deliverymode Interactive
* -oem = Option Errors Mailedtosender
* -or0s = Option Readtimeout -- don't time out
+ * XXX: sendmail doesn't allow -or0s when invoked
+ * by joe user. --okir
*/

/* #define MAILCMD "/bin/mail" /*-*/
diff -ur cron-3.0pl1.orig/cron.h cron-3.0pl1/cron.h
--- cron-3.0pl1.orig/cron.h Thu Aug 26 15:03:16 1999
+++ cron-3.0pl1/cron.h Thu Aug 26 16:45:07 1999
@@ -221,7 +221,7 @@
entry *load_entry __P((FILE *, void (*)(),
struct passwd *, char **));

-FILE *cron_popen __P((char *, char *));
+FILE *cron_popen __P((char *, char *, entry *));


/* in the C tradition, we only create
diff -ur cron-3.0pl1.orig/do_command.c cron-3.0pl1/do_command.c
--- cron-3.0pl1.orig/do_command.c Thu Aug 26 15:03:16 1999
+++ cron-3.0pl1/do_command.c Thu Aug 26 17:14:23 1999
@@ -95,6 +95,21 @@
usernm = env_get("LOGNAME", e->envp);
mailto = env_get("MAILTO", e->envp);

+ /* Check for arguments */
+ if (mailto) {
+ const char *end;
+
+ /* These chars have to match those cron_popen()
+ * uses to split the command string */
+ mailto += strspn(mailto, " \t\n");
+ end = mailto + strcspn(mailto, " \t\n");
+ if (*mailto == '-' || *end != '\0') {
+ printf("Bad Mailto karma.\n");
+ log_it("CRON",getpid(),"error","bad mailto");
+ mailto = NULL;
+ }
+ }
+
#ifdef USE_SIGCHLD
/* our parent is watching for our death by catching SIGCHLD. we
* do not care to watch for our children's deaths this way -- we
@@ -368,7 +383,7 @@
(void) gethostname(hostname, MAXHOSTNAMELEN);
(void) snprintf(mailcmd, sizeof(mailcmd),
MAILARGS, MAILCMD, mailto);
- if (!(mail = cron_popen(mailcmd, "w"))) {
+ if (!(mail = cron_popen(mailcmd, "w", e))) {
perror(MAILCMD);
(void) _exit(ERROR_EXIT);
}
diff -ur cron-3.0pl1.orig/popen.c cron-3.0pl1/popen.c
--- cron-3.0pl1.orig/popen.c Thu Aug 26 15:03:16 1999
+++ cron-3.0pl1/popen.c Thu Aug 26 17:01:24 1999
@@ -44,8 +44,9 @@
static int fds;

FILE *
-cron_popen(program, type)
+cron_popen(program, type, e)
char *program, *type;
+ entry *e;
{
register char *cp;
FILE *iop;
@@ -115,6 +116,14 @@
}
(void)close(pdes[1]);
}
+ /* Lose root privilege */
+ setgid(e->gid);
+# if defined(BSD) || defined(POSIX)
+ initgroups(env_get("LOGNAME", e->envp), e->gid);
+# endif
+ setuid(e->uid);
+ chdir(env_get("HOME", e->envp));
+
#if WANT_GLOBBING
execvp(gargv[0], gargv);
#else

The exploit has also been developed by Olaf Kirch:

Set the user's crontab to

MAILTO=" -C/tmp/myexploitsendmail.cf"
* * * * * ls

In /tmp/myexploitsendmail.cf you basically modify the local mailer:

O DefaultUser=root:root
Mlocal, P=/tmp/hackme, F=lsDFMAw5:/|@qXfmnz9, S=10/30,
R=20/40,
T=DNS/RFC822/X-Unix,
A=mail.local -l

i.e. remove the S flag, and set DefaultUser.

--
----------------------------------------------------------------------
Debian Security Team http://www.debian.org/security/

debian-security-announce@lists.debian.org


*** END PGP VERIFIED MESSAGE ***

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close