nettitude / PoshC2

A proxy aware C2 framework used to aid red teamers with post-exploitation and lateral movement.
BSD 3-Clause "New" or "Revised" License
1.78k stars 323 forks source link

[BUG] PoshC2 Init while creating Donut payload fails #265

Closed laznotlazy closed 2 years ago

laznotlazy commented 2 years ago

Description

When I install PoshC2 from Kali repo on a AWS Kali AMI and configure the project, config and start the poshc2 server or service (posh-service or posh-server), it tries to boot up and create payloads. When creating the donut payload it is stuck with the below error message. Afterwards also implants can't connect, the installation seems broken.

Execution Environment:

All of this must be filled in Data Value
Full Posh version (all the text between the === at the top of the Implant Handler) poshc2/kali-rolling,now 7.4.0-0kali1 all [installed]
OS & version Linux kali 5.16.0-kali7-cloud-amd64 #1 SMP PREEMPT Debian 5.16.18-1kali1 (2022-04-01) x86_64 GNU/Linux

Using AWS Kali AMI

To Reproduce

Steps to reproduce the behavior:

  1. Boot up a AWS EC2 Instance with Kali AMI
  2. sudo apt update -y
  3. sudp apt install poshc2 -y
  4. Configure posh-project and posh-config and launch the server. While launching you run into the donut creation error.

Expected behavior

The PoshC2 Server should create the donut payload.

STDOUT

Donut shellcode files: PY_SSIZE_T_CLEAN macro must be defined for '#' formats Traceback (most recent call last): File "/usr/share/poshc2/poshc2/server/C2Server.py", line 474, in main newdb(DatabaseType) File "/usr/share/poshc2/poshc2/server/C2Server.py", line 381, in newdb newPayload.CreateAll() File "/usr/share/poshc2/poshc2/server/payloads/Payloads.py", line 785, in CreateAll self.CreateDonutShellcode(name) File "/usr/share/poshc2/poshc2/server/payloads/Payloads.py", line 726, in CreateDonutShellcode self.CreateDonutShellcodeFile(Payload, name) File "/usr/share/poshc2/poshc2/server/payloads/Payloads.py", line 744, in CreateDonutShellcodeFile shellcode32 = donut.create(file=f"{self.BaseDirectory}{name}{sourcefile}", arch=1) SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats [>] Create new DB and remove dir (/var/lib/poshc2/testnet/)

riskydissonance commented 2 years ago

Hopefully fixed on the python3.10 branch

you can try .\Install.sh -b python3.10 and create a new project and should be g2g, lmk if any issues

laznotlazy commented 2 years ago

Works just fine, thanks!