Closed OJ closed 9 years ago
Test PASSED. Refer to this link for build results (access rights to CI server needed): https://ci.metasploit.com//job/GPR-MeterpreterWin/186/ Test PASSED.
I have a few more things to test, but want to merge this (plus a couple of minor tweaks) so I can test with new bins as well.
Thanks @bcook-r7. I apologise in advance, because the next couple of PRs are probably going to trample on a lot of this stuff.
Hey ho, gotta be done!
Thanks mate.
This PR contains a stack of code that is another stepping stone towards totally resilient and stable shells. The goal of this work is to allow Meterpreter to "recover" communications in the event of network failures or disconnects.
All of the HTTP related timeouts are now available in TCP comms too (
session expiry
,comms timeout
,retry total
andretry wait
). These can all be set/get on the fly as well so that the tester/attacker has fully control. This also means that session expiry can be extended (which we weren't able to do before).The code includes:
To be clear, the word "recovery" in this case means "restarting communications in the way it was done previously". That means it'll callback again if it's reverse, or it'll bind again if it's bind. If https is required, that's what it it'll be.
This work relies on new bind stagers which are still WIP in the MSF repo. The MSF side of this PR can be found here: https://github.com/rapid7/metasploit-framework/pull/5214
In essence you should be able to kill off comms (or MSF totally). Restart MSF, and have things "just work".
NOTE: This change means that TCP payloads behave like HTTP in that calling
exit -y
no longer kills off communications. If you want sessions to die, you have to tell them! (or wait for them to expire).POSIX has an issue where the timeouts can't be patched by MSF on the fly because the strings that are used for replacement aren't visible due to gzip compression. This is something I'll be getting help from Brent on. For now they have "sane defaults" and they can be modified on the fly.
Keen eyes and critique needed.
Sample run:
Windows x64:
POSIX:
Timeout extension:
Verification
sessions -K
orexit
from within the Meterpreter prompt. You'll need the MSF side of this PR to make all this work.