Exploitation Tools

Xeca – PowerShell Payload Generator

Xeca - PowerShell Payload Generator


xeca is a project that creates encrypted PowerShell payloads for offensive purposes.
Creating position independent shellcode from DLL files is also possible.

Firstly ensure that rust is installed, then build the project with the following command:

cargo build

How It Works

  1. Identify and encrypt the payload. Load encrypted payload into a powershell script and save to a file named “launch.txt”
  2. The key to decrypt the payload is saved to a file named “safe.txt”
  3. Execute “launch.txt” on a remote host
    • The script will call back to the attacker defined web server to retrieve the decryption key “safe.txt”
    • Decrypt the payload in memory
    • Execute the intended payload in memory

If users must have access to programs such as powershell.exe, consider minimising security risks with Just Enough Administration and PowerShell Logging. Application control policies can be deployed via a whitelisting technology such as Ap pLocker.

This tool would not be possible without the sharing of knowledge and information. Ideas, snippets and code from the following authors should be acknowledged:

xeca is licensed under GPLv3, some sub-components may have separate licenses. See their respective references in this project for details.


About the author

Mazen Elzanaty

Add Comment

Click here to post a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: