Rapid7 Vulnerability & Exploit Database

WinRM Script Exec Remote Code Execution

Back to Search

WinRM Script Exec Remote Code Execution



This module uses valid credentials to login to the WinRM service and execute a payload. It has two available methods for payload delivery: Powershell 2.0 and VBS CmdStager. The module will check if Powershell 2.0 is available, and if so uses that method. Otherwise it falls back to the VBS CmdStager which is less stealthy. IMPORTANT: If targeting an x64 system with the Powershell method you MUST select an x64 payload. An x86 payload will never return.


  • thelightcosine




x86, x64


Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/windows/winrm/winrm_script_exec
msf exploit(winrm_script_exec) > show targets
msf exploit(winrm_script_exec) > set TARGET < target-id >
msf exploit(winrm_script_exec) > show options
    ...show and set options...
msf exploit(winrm_script_exec) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security