BC-SECURITY / Empire

Empire is a post-exploitation and adversary emulation framework that is used to aid Red Teams and Penetration Testers.
https://bc-security.gitbook.io/empire-wiki/
BSD 3-Clause "New" or "Revised" License
4.21k stars 575 forks source link

[BUG] Literal commands in Powershell Agent not working (else is not recognized) #674

Closed crittico closed 1 year ago

crittico commented 1 year ago

Empire Version

OS Information (Linux flavor, Python version)

Describe the bug

When trying to launch a literal command within a Powershell Agent I get the following error: The term 'else' is not recognized as the name of a cmdlet, function, script file, or operable program.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a live Powershell Agent -> Interact tab
  2. Enter a Shell command (e.g. whoami /priv) checking the Literal box
  3. Go to Task and see the error

Expected behavior

The result of the command launched.

Screenshots

Error of the command executed: image

Additional context

The problem is in the Agent.ps1 file, as you can see below there's a ';' after an If and before the following Else. image

I already submitted a trivial pull request that fixes the problem, I'm creating this bug report just to make it easier for other people to find this bug.