jm33-m0 / emp3r0r

Linux/Windows post-exploitation framework made by linux user
https://infosec.exchange/@jm33
MIT License
1.26k stars 232 forks source link

Port-Fwd target service cannot handle multiple clients #4

Closed jm33-m0 closed 4 years ago

jm33-m0 commented 4 years ago

There's still an issue: Target TCP service on agent can't send its response to correct receiver when there're more than one clients connected. All clients can send anything to target service without issue, though.

jm33-m0 commented 4 years ago

Here https://github.com/jm33-m0/emp3r0r/blob/9198b20be68a362ef2fa5e9cb2b984db698931b2/core/internal/agent/proxy.go#L105 The agent establishes one connection to target service, no matter how many connections the target can handle, therefore when multiple clients are using the port-mapping, they all get messed up.

jm33-m0 commented 4 years ago

Here CC's TCP server is concurrent https://github.com/jm33-m0/emp3r0r/blob/9198b20be68a362ef2fa5e9cb2b984db698931b2/core/internal/cc/proxy.go#L181 But on agent, it's not https://github.com/jm33-m0/emp3r0r/blob/9198b20be68a362ef2fa5e9cb2b984db698931b2/core/internal/agent/proxy.go#L183 I can't think of a better solution, so I temporarily disallow concurrency.

jm33-m0 commented 4 years ago

https://github.com/jm33-m0/emp3r0r/commit/191af4b48d62d289b96d977dc465530096d8c640 kinda fixes this issue

jm33-m0 commented 4 years ago

Now since port-fwd is finally working for single client, I am going to implement concurrency support on CC side