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.8k stars 326 forks source link

[BUG] Python3 Implant Not Working #248

Closed r00t0v3rr1d3 closed 2 years ago

r00t0v3rr1d3 commented 3 years ago

Description

Using Python 3.9.2 that is installed by default on the latest up-to-date Kali results in errors and implants not functioning.

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 v7.4.0 (f6664b1)
OS & version Kali 2021.2 Rolling
Using Docker/containerisation? no

Implant Info

Defensive Technologies

To Reproduce

Steps to reproduce the behavior:

  1. Install PoshC2 with defaults.
  2. Create a project named project.
  3. Run python3 /var/poshc2/project/py_dropper.py

Expected behavior

Implant shows up as expected - "New Python implant connected..." - and it displays all the expected information, but it doesn't accept commands or return results. Every check-in it spits out:

error expected string or bytes-like object 'utf-8' codec can't decode byte byte 0xc1 in position 0: invalid start byte error expected string or bytes-like-object

Also, when running the implant using python2, it appears to function properly, but every time it checks in with no tasking, it spits out an error: Incorrect padding.

Screenshots

poshc2_error1 poshc2_error2

benpturner commented 3 years ago

Hi,

Will give this a test shortly. Thanks for raising a bug, was the comms local e.g. over the local network or domain fronted or via a proxy or anything?

Thanks

r00t0v3rr1d3 commented 3 years ago

The comms were local, on the same machine actually.

benpturner commented 3 years ago

Hi - do you mind trying this branch - https://github.com/nettitude/PoshC2/tree/update-mods

benpturner commented 3 years ago
Screenshot 2021-08-08 at 17 06 20
benpturner commented 3 years ago

Tested against both python2 and python3. There are some errors on the dropper side that are not suppressed but are expected just FYI

r00t0v3rr1d3 commented 3 years ago

Looks great! Python2 and Python3 implants working on latest Kali.

benpturner commented 3 years ago

Amazing, will get this PR closed and into DEV this week