From 09069f75c28ae7f658160120a29ae45ca233f331 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Thu, 16 Oct 2014 08:32:20 -0400 Subject: [PATCH] Fix #4019, fix NameError peer and disconnect in check --- modules/exploits/multi/ftp/pureftpd_bash_env_exec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/exploits/multi/ftp/pureftpd_bash_env_exec.rb b/modules/exploits/multi/ftp/pureftpd_bash_env_exec.rb index c6e1c873cce8..af0e6718abce 100644 --- a/modules/exploits/multi/ftp/pureftpd_bash_env_exec.rb +++ b/modules/exploits/multi/ftp/pureftpd_bash_env_exec.rb @@ -75,11 +75,12 @@ def check random_id = (rand(100) + 1) command = "echo auth_ok:1; echo uid:#{random_id}; echo gid:#{random_id}; echo dir:/tmp; echo end" if send_command(username, command) =~ /^2\d\d ok./i - return CheckCode::Safe if banner !~ /pure-ftpd/i disconnect + return CheckCode::Safe if banner !~ /pure-ftpd/i command = "echo auth_ok:0; echo end" if send_command(username, command) =~ /^5\d\d login authentication failed/i + disconnect return CheckCode::Vulnerable end end @@ -98,7 +99,7 @@ def exploit # Cannot use generic/shell_reverse_tcp inside an elf # Checking before proceeds if generate_payload_exe.blank? - fail_with(Failure::BadConfig, "#{peer} - Failed to store payload inside executable, please select a native payload") + fail_with(Failure::BadConfig, "#{rhost}:#{rport} - Failed to store payload inside executable, please select a native payload") end execute_cmdstager(linemax: 500)