5
5
6
6
require 'msf/core'
7
7
8
- class Metasploit3 < Msf ::Auxiliary
8
+ class Metasploit4 < Msf ::Auxiliary
9
9
10
10
include Msf ::Exploit ::Remote ::HttpClient
11
11
include Msf ::Auxiliary ::WmapScanServer
12
12
include Msf ::Auxiliary ::Scanner
13
13
14
- def initialize ( info = { } )
14
+ def initialize ( info = { } )
15
15
super ( update_info ( info ,
16
- 'Name' => 'HTTP Host- Header Injection Detection' ,
17
- 'Description' => 'Checks if the host is vulnerable to Host-Header Injection ' ,
18
- 'Author' =>
16
+ 'Name' => 'HTTP Host Header Injection Detection' ,
17
+ 'Description' => 'Checks if the host is vulnerable to Host header injection ' ,
18
+ 'Author' =>
19
19
[
20
- 'Jay Turla < @shipcod3>' ,
21
- 'Medz Barao < @godflux>'
20
+ 'Jay Turla' , # @shipcod3
21
+ 'Medz Barao' # @godflux
22
22
] ,
23
23
'License' => MSF_LICENSE ,
24
- 'References' =>
24
+ 'References' =>
25
25
[
26
26
[ 'URL' , 'http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html' ]
27
27
]
28
28
) )
29
29
30
30
register_options (
31
31
[
32
- OptString . new ( 'TARGETHOST' , [ true , " The redirector target" , " evil.com" ] ) ,
33
- ] , self . class )
32
+ OptString . new ( 'TARGETHOST' , [ true , ' The redirector target' , ' evil.com' ] )
33
+ ] , self . class )
34
34
end
35
35
36
- def run_host ( target_host )
37
-
36
+ def run_host ( ip )
38
37
begin
39
- p = "#{ datastore [ 'TARGETHOST' ] } "
40
- res = send_request_raw ( {
38
+ target_host = "#{ datastore [ 'TARGETHOST' ] } "
39
+ res = send_request_raw (
41
40
'uri' => '/' ,
42
41
'method' => 'GET' ,
43
42
'headers' => {
44
- 'host' => p ,
45
- 'x-forwarded-host ' => p ,
43
+ 'Host' => target_host ,
44
+ 'X-Forwarded-Host ' => target_host
46
45
}
47
- } )
46
+ )
48
47
49
48
unless res
50
49
vprint_error ( "#{ peer } did not reply to our request" )
51
50
return
52
51
end
53
52
54
- if res . headers =~ / #{ p } / || res . body =~ / #{ p } /
55
- print_good ( "#{ peer } is vulnerable to HTTP Host-Header Injection " )
53
+ if res . headers . include? ( target_host ) || res . body . include? ( target_host )
54
+ print_good ( "#{ peer } is vulnerable to HTTP Host header injection " )
56
55
report_vuln (
57
- host : rhost ,
56
+ host : ip ,
58
57
port : rport ,
59
58
proto : 'tcp' ,
60
- sname : ( ssl ? 'https' : 'http' ) ,
61
- info : "Vulnerable to HTTP Host-Header Injection" ,
59
+ sname : ssl ? 'https' : 'http' ,
60
+ name : 'HTTP Host header injection' ,
61
+ refs : self . references
62
62
)
63
63
else
64
64
vprint_error ( "#{ peer } returned #{ res . code } #{ res . message } " )
@@ -67,4 +67,5 @@ def run_host(target_host)
67
67
rescue ::Timeout ::Error , ::Errno ::EPIPE
68
68
end
69
69
end
70
+
70
71
end
0 commit comments