Rapid7 Vulnerability & Exploit Database

Powershell Payload Execution

Back to Search

Powershell Payload Execution



This module generates a dynamic executable on the session host using .NET templates. Code is pulled from C# templates and impregnated with a payload before being sent to a modified PowerShell session with .NET 4 loaded. The compiler builds the executable (standard or Windows service) in memory and produces a binary which can be started/installed and downloaded for later use. After compilation the PoweShell session can also sign the executable if provided a path the a .pfx formatted certificate.


  • RageLtMan <rageltman@sempervictus>
  • Matt "hostess" Andreko




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/local/ps_persist
msf exploit(ps_persist) > show targets
msf exploit(ps_persist) > set TARGET < target-id >
msf exploit(ps_persist) > show options
    ...show and set options...
msf exploit(ps_persist) > 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