Closed Adastra-thw closed 4 years ago
Same issue.
In my case, I have used different payloads, and the meterpreter shell command and the powershell_shell command of the powershell module always fail me with the error Error running command powershell_shell (or shell): ArgumentError wrong number of arguments (given 4, expected 5).
I have tried to perform the same actions on the victim machine from an old Kali Linux with a Metasploit 4.16.49-dev and it works correctly.
Regarding where it fails:
My version of Metasploit is 5.0.79-dev and my version of Ruby is ruby 2.5.7p206.
Attacker machine: Operating System: Kali GNU / Linux Rolling Kernel: Linux 5.4.0-kali4-amd64
Victim machine: Windows 7 Professional
I met the same issue after I upgraded Metasploit by msfupdate
in Ubuntu.
Here is my apt log:
$ cat /var/log/apt/history.log | grep "metasploit-framework"
Commandline: apt-get install -y --allow-downgrades metasploit-framework
Upgrade: metasploit-framework:amd64 (5.0.77+20200226112448~1rapid7-1, 5.0.80+20200311102409~1rapid7-1)
It seems v5.0.80 is not compatible with v5.0.77, and I tried to downgrade it. But I found the old version debs have been taken down from the online sources. I have to downgrade Metasploit locally and here is my solution.
STEP 1: Search the cached debs from apt cache directory.
$ ls /var/cache/apt/archives | grep "metasploit-framework"
metasploit-framework_5.0.77+20200226112448~1rapid7-1_amd64.deb
metasploit-framework_5.0.80+20200311102409~1rapid7-1_amd64.deb
If you can find an old version deb, follow these...
STEP 2: Copy the old version deb to the current location.
cp /var/cache/apt/archives/metasploit-framework_5.0.77+20200226112448~1rapid7-1_amd64.deb ./
STEP 3: Purge the newest version of Metasploit.
sudo apt-get purge metasploit-framework
STEP 4: Install the old version Metasploit.
sudo apt install ./metasploit-framework_5.0.77+20200226112448~1rapid7-1_amd64.deb
STEP 5: Reset the database of Metasploit.
msfdb reinit
STEP 6: Launch it!
msfconsole
Steps to reproduce
In my case, I've used two different payloads to test and I get the same results. windows/x64/meterpreter/reverse_tcp and php/meterpreter/reverse_tcp.
In both cases I've got the error "ArgumentError wrong number of arguments (given 4, expected 5)".
How'd you do it?
It also happens with some post-exploitaition modules:
post(windows/manage/enable_rdp) > exploit
[] Enabling Remote Desktop [] RDP is disabled; enabling it ... [] Setting Terminal Services service startup mode [] The Terminal Services service is not set to auto, changing it to auto ... [] Opening port in local firewall if necessary [] The following Error was encountered: ArgumentError wrong number of arguments (given 4, expected 5) [] For cleanup execute Meterpreter resource file: /home/user/.msf4/loot/20200311225614_default_192.168.1.101_host.windows.cle_656289.txt [] Post module execution completed
Expected behavior
Generate a command prompt, execute the commands needed in the post post-exploitation modules.... that kind of things that always worked in msf....
Current behavior
Crash .
cat ~/.msf4/logs/framework.log /msf/lib/msf/ui/console/command_dispatcher/core.rb:1384:in'
cmd_sessions' /msf/lib/rex/ui/text/dispatcher_shell.rb:523:in
run_command' /msf/lib/rex/ui/text/dispatcher_shell.rb:474:inblock in run_single' /msf/lib/rex/ui/text/dispatcher_shell.rb:468:in
each' /msf/lib/rex/ui/text/dispatcher_shell.rb:468:inrun_single' /msf/lib/rex/ui/text/shell.rb:158:in
run' /msf/lib/metasploit/framework/command/console.rb:48:instart' /msf/lib/metasploit/framework/command/base.rb:82:in
start' ./msfconsole:49:in `System stuff
Attacker machine: Debian 9, ruby 2.6.0 Victim machine: Windows 10 Home version
Metasploit version
msf5 post(windows/manage/enable_rdp) > version Framework: 5.0.80-dev-47f4f2d981 Console : 5.0.80-dev-47f4f2d981
I installed Metasploit with:
OS
What OS are you running Metasploit on? Debian 9.