MythicAgents / Apollo

A .NET Framework 4.0 Windows Agent
BSD 3-Clause "New" or "Revised" License
439 stars 89 forks source link

Port Forward Added to Apollo #18

Closed thiagomayllart closed 2 years ago

thiagomayllart commented 3 years ago

Hello everyone,

I've added support for remote port forward. It works just like socks functionality. The whole traffic goes through the connection already established with the agent, so, if you forward an RDP/SSH/etc, it will act as a RDP through HTTP.

As mentioned, the traffic goes in a pretty similar way as the socks command: base64 string from the received bytes will be added to a dictionary in the new field of the json message (rportfwds) from/to the agent.

The rportfwd function supports multiple connections to the same port and multiple forwarded ports at the same time.

djhohnstein commented 3 years ago

Awesome! I'll have some time to review this and the other outstanding PR very soon and get it tested and integrated. I'll keep you posted. Well done!

djhohnstein commented 3 years ago

JFYI, I haven't lost sight of this. We're still discussing port forwarding and general SOCKS stuff. Thank you for continuing to update your PR!

thiagomayllart commented 3 years ago

Thank you!! No worries!! I have fixed some issues related to the order of the packets. Some packets were arriving out of order, so some protocols like RDP would present some errors since I did not consider that one HTTP response could be processed before another, causing encryption errors like. I have just added a way to sort the messages in the order they come from the socket.

djhohnstein commented 3 years ago

I'll try to get to this today 😄