Metasploit-framework: Error when run a script [ArgumentError wrong number]

Created on 23 Apr 2016  路  19Comments  路  Source: rapid7/metasploit-framework

Steps to reproduce

How'd you do it?

  1. ms08_067netapi - windows/meterpreter/bind_tcp , port 1338 , Set Target 2
  2. meterpreter > run post/windows/manage/migrate* or any post script *
    [-] Error in script: ArgumentError wrong number of arguments (1 for 0)

Current behavior

meterpreter > run post/windows/manage/migrate
[-] Error in script: ArgumentError wrong number of arguments (1 for 0)

meterpreter > run post/windows/gather/credentials/credential_collector
[-] Error in script: ArgumentError wrong number of arguments (1 for 0)

*_~/.msf4/logs/framework.log *_

/opt/metasploit-framework/bin/../embedded/framework/msfconsole:48:in `<main>'
[04/23/2016 09:05:51] [d(0)] core: Reloading module windows/manage/migrate...
[04/23/2016 09:05:51] [w(0)] core: The module windows/manage/migrate is ambiguous with windows/manage/migrate.
[04/23/2016 09:05:51] [e(0)] core: Error in script: ArgumentError wrong number of arguments (1 for 0)
[04/23/2016 09:05:51] [d(0)] core: Callstack: /opt/metasploit-framework/embedded/framework/modules/payloads/singles/cmd/mainframe/reverse_shell_jcl.rb:247:in `to_s'

System stuff

root:~]# uname -a
Linux kali 4.4.0-kali1-686 #1 SMP Debian 4.4.6-1kali1 (2016-03-18) i686 GNU/Linux

Metasploit version

msf exploit(ms08_067_netapi) > version
Framework: 4.11.22-dev-98f89ca23a67811457a9292023c930dfc6c28558
Console : 4.11.22-dev-98f89ca23a67811457a9292023c930dfc6c28558

I installed Metasploit with:

  • [ X] Kali package via apt
  • [ X] Omnibus installer (nightly)
  • [ ] Commercial/Community installer (from http://www.rapid7.com/products/metasploit/download.jsp)
  • [ ] Source install (please specify ruby version)

    OS

Kali - Rolling

All 19 comments

For some reason you are getting errors running the mainframe reverse_shell_jcl.rb payload. It's funny that this runs as a side-effect when you run a script, put I see what to fix now. Thanks!

Thanks Mate,

From the logs it appears all my issues are from this "reverse_shell_jcl.rb" file.
Also running things like "run getgui" will also produce these issues.
I also have these issues while using a completely different exploit (windows/http/oracle9i_xdb_pass) with a Meterpreter Reverse TCP Payload.

/23/2016 09:31:31] [d(0)] core: Reloading module windows/manage/migrate... [04/23/2016 09:31:31] [w(0)] core: The module windows/manage/migrate is ambiguous with windows/manage/migrate. [04/23/2016 09:31:32] [e(0)] core: Error in script: ArgumentError wrong number of arguments (1 for 0) [04/23/2016 09:31:32] [d(0)] core: Callstack: /opt/metasploit-framework/embedded/framework/modules/payloads/singles/cmd/mainframe/reverse_shell_jcl.rb:247:into_s'
/opt/metasploit-framework/embedded/framework/modules/payloads/singles/cmd/mainframe/reverse_shell_jcl.rb:247:in replace_var'

Any ETA on a fix? I am currently completing my OSCP and use these , well daily :(

Appreciate all the hard work and effort.

Thanks,

Testing the fix out now.

Ah your a legend! Thank you heaps! bug fix in under 3 hours, who can complain! :+1:

Please let me know if you would like me to test anything on my end. I can make the modifications manually if necessary.

Thanks again!

A quick workaround without any code changes is to ensure you 'set LPORT 443' or similar _after_ having set a payload, not before. We have code that assumes LPORT is always an integer, and a quirk in the datastore prevents the type info from working until the first module has declared it. IOW, this will work from a fresh msfconsole instance:

use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LPORT 443

This will fail:

use exploit/multi/handler
set LPORT 443
set payload windows/meterpreter/reverse_tcp

Thank you very much for the workaround - It explains a lot actually. I was using a msfconsole.rc file which was automatically setting the LPORT, so as I opened msfconsole it was entered automatically and thus putting this bug into play from the beginning prior to me even entering any commands.

I guess this is a good habit/process to form anyways. Set payload, then set options.

I have confirmed this workaround, is working.

Thank you again for the hard work.

Kind Regards,

helpme

Don't fix mine :/

It would be helpful to include which version you are using to ensure yours has the patch applied. I believe, and don't quote me, only the git clone version has the patch at this point, as a release including this hasn't happened yet

Yeah, I fixed some errors.(While I writing "run persistence" meterpreter give "script doesn't found.". I fixed from "sciptable.rb" for some little wrong word.) But I have such an error :/
If I'll remove metasploit-framework and after if I'll install from github then is it fix? Does anyone knows?

Scripts are deprecated, run the local module

wow :0
How can I run local module "persistence"?

This isn't a support forum, it's for reporting bugs. Ask in IRC, search the web, or browse the local windows modules

Agh, let me push what I have.

:) @wvu-r7. OK. Is the bug solved?

@ulusher: It will be soon.

@wvu-r7 Well. Is there such a problem in Pro version?

See #7887.

It's definitely time we put a proper nail in the coffin of those scripts. Is the run command used for anything other that Meterp scripts inside of Meterp? If not, perhaps we should put a warning in there saying "What you're doing isn't supported"?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sonya2010 picture Sonya2010  路  3Comments

XSecr3t picture XSecr3t  路  3Comments

Funeoz picture Funeoz  路  3Comments

ejholmes picture ejholmes  路  3Comments

BaconBombz picture BaconBombz  路  3Comments