its-a-feature / Mythic

A collaborative, multi-platform, red teaming framework
Other
3.15k stars 425 forks source link

Error protocol.connection_task uncaught In Dynamichttp Profile #301

Closed nspagnola-r7 closed 1 year ago

nspagnola-r7 commented 1 year ago

Hello,

I am trying to incorporate the dyanmichttp C2 profile into my agent. However, I'm having some trouble getting the C2 profile to run properly. Whenever I build a payload with the dynamichttp profile and have it running I'm unable to make any requests to the C2 server through the dynamichttp profile. I can verify the profile opens port 80 on my C2 server however when I try and hit the server at port 80 I just get a "connection reset by peer" error. When I view the stdout/stderr for the C2 profile this is what I get:

[2023-06-07 21:26:37 +0000] [10] [ERROR] protocol.connection_task uncaught
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/sanic/server/protocols/http_protocol.py", line 148, in connection_task
    await self.app.dispatch(
  File "/usr/local/lib/python3.11/site-packages/sanic/signals.py", line 195, in dispatch
    return await dispatch
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sanic/signals.py", line 135, in _dispatch
    group, handlers, params = self.get(event, condition=condition)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sanic/signals.py", line 97, in get
    group, param_basket = self.find_route(
                          ^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable
Task exception was never retrieved
future: <Task finished name='Task-25' coro=<HttpProtocol.connection_task() done, defined at /usr/local/lib/python3.11/site-packages/sanic/server/protocols/http_protocol.py:139> exception=TypeError("'NoneType' object is not callable")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/sanic/server/protocols/http_protocol.py", line 177, in connection_task
    await self.app.dispatch(
  File "/usr/local/lib/python3.11/site-packages/sanic/signals.py", line 195, in dispatch
    return await dispatch
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sanic/signals.py", line 135, in _dispatch
    group, handlers, params = self.get(event, condition=condition)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sanic/signals.py", line 97, in get
    group, param_basket = self.find_route(
                          ^^^^^^^^^^^^^^^^
its-a-feature commented 1 year ago

Hey! Thanks for opening up an issue. Can you confirm you're running the latest Dynamic http profile? There was an issue a while ago with the sanic version that was pulled into it, but that was fixed by pinning the version specified in the Dockerfile.

~Now that you mention it though, I am seeing a different issue with Get requests for the profile with the apfell agent (POST messages seem to be working fine though).~ - Fixed the apfell issue

Still don't see the error you're running into.. Make sure you are pulling in the absolute latest code though

nspagnola-r7 commented 1 year ago

Hey! I was pulling from the master branch for the dyanmichttp profile which looks like it just pulls the latest version of sanic. I re-installed with the v3.0.0 branch and now all is working fine. My apologies! I appreciate the quick response.

For the error in GET requests you mentioned, was that an issue in the apfell agent code? Or should I be aware of something while handling GET requests in my agent?

its-a-feature commented 1 year ago

Ah, I didn't realize i had pushed to the v3.0.0 branch, just merged it into master. Thanks for noticing that!

It was just an issue in the apfell agent code, nothing with the dynamichttp prlfile itself