bats3c / shad0w

A post exploitation framework designed to operate covertly on heavily monitored environments
https://blog.dylan.codes/shad0w/
MIT License
2.03k stars 323 forks source link

Incorrect pading error #101

Open yurivich opened 3 years ago

yurivich commented 3 years ago

I've just installed Shad0w and fired up the application and got a working beacon, however when I try to run any commands on the beacon I keep getting the same error :

[2021-08-18 04:48:26,683] ERROR in app: Exception on /tasks [POST] Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2070, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1515, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1513, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1499, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/root/shad0w/lib/http_server.py", line 59, in web_task_beacon return phandle.task_beacon(request) File "/root/shad0w/lib/path_handler.py", line 40, in task_beacon beacon_id, opcode, data = tools.get_data_from_json(jdata) File "/root/shad0w/lib/tools.py", line 48, in get_data_from_json data = base64.b64decode(data).decode() File "/usr/lib/python3.9/base64.py", line 87, in b64decode return binascii.a2b_base64(s) binascii.Error: Incorrect padding

yurivich commented 3 years ago

Just found out that running the C2 using sudo python3 shad0w.py listen -e x.x.x.x actually works and does not give that error, but running it this way : sudo shad0w listen -e x.x.x.x does give the error

kousha1999 commented 3 years ago

I have this problem too, and sudo python3 shad0w.py listen -e x.x.x.x didn't work for me!

kousha1999 commented 3 years ago

I've found it root cause is lack of "=" in padding. I've printed the output (edited source code) and decoded by myself. 2021-08-18_12-25 2021-08-18_12-25_1

2021-08-18_12-24

bats3c commented 3 years ago

Im aware of this issue, and will get on fixing it soon

eqn-group commented 3 years ago

Did you try running directly from latest source code?

kousha1999 commented 3 years ago

Yes.

Adastra-thw commented 3 years ago

I've found the same issue but not only this, almost every command that I run don't gets executed. Only works the commands that depends on other tools like the binaries in Ghospack. For example, the meterpreter command "seems to work", but the instruction is never send to the remote server. I've tried this in Windows Server 2019 and Windows 10 Home/PRO. I think this issue is related with this, for that reason I write here, but if it's another thing I can open a new issue

eqn-group commented 3 years ago

i made some pull request and closed it. check recent closed pull request.

Adastra-thw commented 3 years ago

Yes, I've seen the pull request, the files changed are not included in master yet but in any case I've checked that it doesn't solves the issue. Applying the changes I still get "Incorrect padding" when lunch some simple commands and in other cases it (seems) don't perform any action

hookthieves commented 3 years ago

Hello all, Just wondering if anyone got this working on their end? I have the same issue as everyone else.

Adastra-thw commented 3 years ago

Hello all, Just wondering if anyone got this working on their end? I have the same issue as everyone else.

No changes in the repository, issue still present.

neil-fox commented 2 years ago

Same issue

cr7pt0pl4gu3 commented 2 years ago

Same issue

milldawgydawg commented 2 years ago

Made the change to core.c as mentioned by kousha1999 and doesn't appear to solve the issue.