Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method when killing auxiliary module jobs by ID #13593

Closed
1 of 4 tasks
zeroSteiner opened this issue Jun 10, 2020 · 1 comment · Fixed by #13600
Closed
1 of 4 tasks

Undefined method when killing auxiliary module jobs by ID #13593

zeroSteiner opened this issue Jun 10, 2020 · 1 comment · Fixed by #13600
Assignees
Labels

Comments

@zeroSteiner
Copy link
Contributor

Steps to reproduce

There appears to be an issue when trying to kill a job by it's ID. I can reliably reproduce it but only for auxiliary modules (sock4a and socks5) while others like exploit/multi/handler can be killed by it's ID.

To reproduce it:

  1. Start msfconsole
  2. Start an auxiliary server module
  3. Find it's job ID with the output of jobs
  4. Try to kill the specific job using either jobs -k <ID> or kill <ID>, both are exhibiting the same behavior
./msfconsole -r test.rc
                                                  

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMM                MMMMMMMMMM
MMMN$                           vMMMM
MMMNl  MMMMM             MMMMM  JMMMM
MMMNl  MMMMMMMN       NMMMMMMM  JMMMM
MMMNl  MMMMMMMMMNmmmNMMMMMMMMM  JMMMM
MMMNI  MMMMMMMMMMMMMMMMMMMMMMM  jMMMM
MMMNI  MMMMMMMMMMMMMMMMMMMMMMM  jMMMM
MMMNI  MMMMM   MMMMMMM   MMMMM  jMMMM
MMMNI  MMMMM   MMMMMMM   MMMMM  jMMMM
MMMNI  MMMNM   MMMMMMM   MMMMM  jMMMM
MMMNI  WMMMM   MMMMMMM   MMMM#  JMMMM
MMMMR  ?MMNM             MMMMM .dMMMM
MMMMNm `?MMM             MMMM` dMMMMM
MMMMMMN  ?MM             MM?  NMMMMMN
MMMMMMMMNe                 JMMMMMNMMM
MMMMMMMMMMNm,            eMMMMMNMMNMM
MMMMNNMNMMMMMNx        MMMMMMNMMNMMNM
MMMMMMMMNMMNMMMMm+..+MMNMMNMNMMNMMNMM
        https://metasploit.com


       =[ metasploit v5.0.93-dev-fa496b9395               ]
+ -- --=[ 2028 exploits - 1102 auxiliary - 344 post       ]
+ -- --=[ 562 payloads - 45 encoders - 10 nops            ]
+ -- --=[ 7 evasion                                       ]

Metasploit tip: View missing module options with show missing

[*] Processing test.rc for ERB directives.
resource (test.rc)> use auxiliary/server/socks5
resource (test.rc)> run
[*] Auxiliary module running as background job 0.
resource (test.rc)> jobs

Jobs
====

  Id  Name                      Payload  Payload opts
  --  ----                      -------  ------------
  0   Auxiliary: server/socks5           

resource (test.rc)> sleep 5
[*] Starting the socks5 proxy server
resource (test.rc)> jobs -k 0
[*] Stopping the following job(s): 0
[-] Error while running command jobs: undefined method `datastore' for "37VaPVkhTwWsoZEY7T3B3LD0":String

Call stack:
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/command_dispatcher/jobs.rb:216:in `block in cmd_jobs'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/command_dispatcher/jobs.rb:213:in `each'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/command_dispatcher/jobs.rb:213:in `cmd_jobs'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/smcintyre/Repositories/metasploit-framework/lib/rex/ui/text/resource.rb:70:in `load_resource'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/driver.rb:181:in `block in initialize'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/driver.rb:180:in `each'
/home/smcintyre/Repositories/metasploit-framework/lib/msf/ui/console/driver.rb:180:in `initialize'
/home/smcintyre/Repositories/metasploit-framework/lib/metasploit/framework/command/console.rb:62:in `new'
/home/smcintyre/Repositories/metasploit-framework/lib/metasploit/framework/command/console.rb:62:in `driver'
/home/smcintyre/Repositories/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/home/smcintyre/Repositories/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
./msfconsole:23:in `<main>'
resource (test.rc)> exit
[*] Starting persistent handler(s)...
[*] Stopping the socks5 proxy server
RC Script
use auxiliary/server/socks5
run
jobs
sleep 5
jobs -k 0
exit

Expected behavior

The job whose ID is specified should be killed.

Current behavior

Metasploit is throwing a stack trace and not killing the job.

System stuff

Metasploit version

fa496b939550a5b04dbe19df9f47d16eebc08d40 (HEAD -> master, upstream/master) automatic module_metadata_base.json updateg

I installed Metasploit with:

OS

Fedora 32 x64

@zeroSteiner
Copy link
Contributor Author

I should have noted that killing all jobs with jobs -K does not exhibit the same issue. Also verified that the auxiliary/server/capture/vnc module is having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant