-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meterpreter Migrate #12390
Comments
I think this is a known "issue" |
I cannot find any new issue regarding the latest 5.0.50-dev and migrate please assist |
After bisecting this, it looks like a regression introduced in 47afa21 Looking at that briefly, I don't understand why? I need to dig some more, though, so I assigned this to myself. |
I have no idea how that could be the culprit either!
…On Wed, 9 Oct 2019, 04:17 Brendan, ***@***.***> wrote:
After bisecting this, it looks like a regression introduced in 47afa21
<47afa21>
Looking at that briefly, I don't understand why? I need to dig some more,
though, so I assigned this to myself.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#12390?email_source=notifications&email_token=AAAHBYFAZ5E7UORR6YRSOQLQNTFE3A5CNFSM4I5EEGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAVDVLA#issuecomment-539638444>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAHBYDN2Z6QKQ3UN4JDA5TQNTFE3ANCNFSM4I5EEGCQ>
.
|
I'll see if I have time to take a look later today.
But if that commit is responsible it may just fry the little bit of sanity
I have left.
…On Wed, 9 Oct 2019, 06:49 Brendan, ***@***.***> wrote:
I mean..... I'm hopping between commits 540e269
<540e269>
and 47afa21
<47afa21>.
The the results are consistent....
540e269
<540e269>
migrates successfully
47afa21
<47afa21>
times out, but occasionally (10%-20%) calls back after a timeout, and it is
running in the migrated process.
https://media.giphy.com/media/BcpsfmGhjAwcE/giphy.gif
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12390?email_source=notifications&email_token=AAAHBYF2XQVHYRPHTW3C47DQNTW4BA5CNFSM4I5EEGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAVSHVY#issuecomment-539698135>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAHBYGNPTF6MO4V5J7JNCDQNTW4BANCNFSM4I5EEGCQ>
.
|
OK... I feel a little better; it turns out that this might be a intermittent problem, rather than a definitive problem, which explains why bisect might have landed on this commit (though I tested it three times manually on each side, and it was repeatable manually) I set up automated testing and got these results (commit hashes listed at the top) Commit before 47afa21Commit 47afa21I am pretty sure this is a regression, as all tests fail on master... Commit a6ec513 (Current Master): |
OK.... after running a ton of tests, I think I may have found the real slim shady. Commit 760defd AKA: #11184Commit 880e597 AKA: #11176 (Preceding land)I also tested the other two lands in either direction. Everything after 760defd had complete failures, everything before had partial success. Now to figure out why the Ruby bump made the difference? |
I wonder if, for some reason, the change in version resulted in the
migration stubs being compiled incorrectly by metasm?
…On Sat, 12 Oct 2019, 05:56 Brendan, ***@***.***> wrote:
OK.... after running a ton of tests, I think I may have found the real
slim shady.
Commit 760defd
<760defd>
AKA: #11184 <#11184>
[image: image]
<https://user-images.githubusercontent.com/17987018/66680714-c04a6180-ec36-11e9-8eab-ea32ca9f36cb.png>
Commit 880e597
<880e597>
AKA: #11176 <#11176>
(Preceding land)
[image: image]
<https://user-images.githubusercontent.com/17987018/66680774-de17c680-ec36-11e9-9329-ff4bf79a4e46.png>
I also tested the other two lands in either direction. Everything after
760defd
<760defd>
had complete failures, everything before had partial success. Now to figure
out why the Ruby bump made the difference?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12390?email_source=notifications&email_token=AAAHBYE6HQMF4C53LA67DU3QODK5FA5CNFSM4I5EEGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBBBUEY#issuecomment-541202963>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHBYB2G3BMLO52ESQASXLQODK5FANCNFSM4I5EEGCQ>
.
|
Here's the log:
Though not particularly helpful, TBH. |
Yeah my guess is that the stub in the target process is busted.
Did the target process crash?
…On Sat, 12 Oct 2019, 06:11 Brendan, ***@***.***> wrote:
Here's the log:
[10/11/2019 15:10:18] [e(0)] meterpreter: Error running command migrate: Rex::TimeoutError Operation timed out.
[10/11/2019 15:10:18] [d(0)] meterpreter: Call stack:
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/packet_dispatcher.rb:177:in `send_request'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/client_core.rb:747:in `negotiate_tlv_encryption'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/client_core.rb:691:in `migrate'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb:1222:in `cmd_migrate'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:105:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:68:in `block in interact'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/shell.rb:146:in `run'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:66:in `interact'
/home/tmoose/rapid7/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:576:in `_interact'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/interactive.rb:51:in `interact'
/home/tmoose/rapid7/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb:1364:in `cmd_sessions'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/tmoose/rapid7/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:215:in `cmd_exploit'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/shell.rb:151:in `run'
/home/tmoose/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/home/tmoose/rapid7/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
./msfconsole:49:in `<main>'
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12390?email_source=notifications&email_token=AAAHBYDCXRA4X3B6WAOED6LQODMVLA5CNFSM4I5EEGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBBCX3Y#issuecomment-541207535>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHBYF3FVDQYZNASY5S5ITQODMVLANCNFSM4I5EEGCQ>
.
|
Also might be worth testing migrating with different transports given that
the stubs are different for each.
…On Sat, 12 Oct 2019, 06:11 Brendan, ***@***.***> wrote:
Here's the log:
[10/11/2019 15:10:18] [e(0)] meterpreter: Error running command migrate: Rex::TimeoutError Operation timed out.
[10/11/2019 15:10:18] [d(0)] meterpreter: Call stack:
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/packet_dispatcher.rb:177:in `send_request'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/client_core.rb:747:in `negotiate_tlv_encryption'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/client_core.rb:691:in `migrate'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb:1222:in `cmd_migrate'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:105:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:68:in `block in interact'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/shell.rb:146:in `run'
/home/tmoose/rapid7/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:66:in `interact'
/home/tmoose/rapid7/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:576:in `_interact'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/interactive.rb:51:in `interact'
/home/tmoose/rapid7/metasploit-framework/lib/msf/ui/console/command_dispatcher/core.rb:1364:in `cmd_sessions'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/tmoose/rapid7/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:215:in `cmd_exploit'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:523:in `run_command'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:474:in `block in run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `each'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:468:in `run_single'
/home/tmoose/rapid7/metasploit-framework/lib/rex/ui/text/shell.rb:151:in `run'
/home/tmoose/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/home/tmoose/rapid7/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
./msfconsole:49:in `<main>'
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12390?email_source=notifications&email_token=AAAHBYDCXRA4X3B6WAOED6LQODMVLA5CNFSM4I5EEGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBBCX3Y#issuecomment-541207535>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHBYF3FVDQYZNASY5S5ITQODMVLANCNFSM4I5EEGCQ>
.
|
The target process has never crashed. |
Interesting. Maybe the thread creation failed.
I'll try to look at this a bit later today.
…On Sat, 12 Oct 2019, 07:31 Brendan, ***@***.***> wrote:
The target process has never crashed.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12390?email_source=notifications&email_token=AAAHBYAKEE6FRMEEVN2KTT3QODWDLA5CNFSM4I5EEGC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBBIQAY#issuecomment-541231107>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHBYDBHIPWHST7MLRWGM3QODWDLANCNFSM4I5EEGCQ>
.
|
I had the EXITFUNC set to thread and this error happened. When I changed it to process it's fine. Not sure if this helps in any way tho. |
This still affects Windows 10 Enterprise (version 1903) and Metasploit 5.0.55-dev:
|
I'll try to fix this soon! |
Quick investigation shows that http-based transports are fine. Migration works as expected.
Not sure why yet. |
Definitely something strange going on with the Ruby side. I honestly don't know what it is. This is a pic of the Windows box. We can see that the TLV encryption response packet is actually going out on the wire and we get an ACK from MSF: But on the MSF side, I can see that Going to have to call on some Ruby gurus to help out with this one @wvu-r7 @bcook-r7 and whoever else is a master of the Rubies. I honestly don't know what's going on. The socket is still open, data is sent to it from Meterp, and it has been ACK'd. But as far as MSF is concerned the Does anyone know of anything that may have changed in Ruby 2.6+ that could cause this kind of behaviour? |
rv = Rex::ThreadSafe.select([ self.sock.fd ], nil, nil, PING_TIME) This is the line, in |
I changed the above line to use |
Also, FWIW, if you have a handler open and listening, exiting the current session will result in Meterp reconnecting and from there everything works fine. |
Confirmed broken in |
OK after a painful binary search, I can say that:
So I'm going to say that changes introduced in Ruby 2.5.5 are causing the problem. The thing is, it doesn't really look like anything changed in the source could have caused it. The Release Notes don't really imply much either. So I'm at a bit of a loss. HALP PLZ! |
It is interesting that the issue manifests in a case where multiple entities are working on the socket, indicating that it could be related to threading. I'd be keen to see if patching out that line in the latest ruby would result in things working. But yeah, not sure where to go from here. |
Yeah. I took a look into it the other day and I asked a few rubier people than me, and there's nothing that stuck out as obvious. |
I started taking a look at this last night, and have a working diff on Ruby 2.6.5. Looks like some assumptions about thread lifetimes need stronger guarantees; MSF might have been relying on undefined behavior for a while. |
When i try migrate on metepreter the operation timeouts and then my shell breaks.
Running in high integrate context and as system.
MSF latest version
meterpreter x64 running shellcode on Windows 10 latest build
No AV No Firewall and No EDR running
Anyone having the same issue ?
The text was updated successfully, but these errors were encountered: