Skip to content
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

Fix timeout of duplicated sessions #16621

Merged

Conversation

sjanusz-r7
Copy link
Contributor

The PR here: #16369 allowed us to run sessions -u {session_id} on a Meterpreter session to 'duplicate' a Meterpreter session (read that as open a new Meterpreter session with a default payload that is decided by the shell_to_meterpreter.rb script).
On Python, this has resulted in the initial session waiting for the newly spawned session to exit, thus MSF Console thought the session has been timing out.

This PR:

  • Fixes the above issue by running the last call to cmd_exec in transmit_payload as non-channelized, meaning the initial session does not wait for the process to finish.
  • Adds in more possibilities to detect the Python binary on the remote machine.
  • Defaults more cmd_exec calls to non-channelized.

Verification

  • Start msfconsole -q
  • use payload/python/meterpreter/reverse_tcp
  • set your options and get a session
  • sessions -u -1 to 'upgrade'/duplicate/spawn a new session
  • Verify the initial session can still be interacted with
  • Verify that killing the initial session does not kill the new 'duplicated' session

@sjanusz-r7 sjanusz-r7 force-pushed the fix-timeout-of-duplicated-sessions branch from 46ef7c5 to fd7aedf Compare May 25, 2022 13:18
@sjanusz-r7 sjanusz-r7 force-pushed the fix-timeout-of-duplicated-sessions branch from fd7aedf to 17a37a9 Compare May 25, 2022 14:22
@adfoster-r7
Copy link
Contributor

@msjenkins-r7 retest this please

@adfoster-r7 adfoster-r7 merged commit a98f9a6 into rapid7:master May 27, 2022
@adfoster-r7 adfoster-r7 added rn-enhancement release notes enhancement rn-fix release notes fix and removed rn-enhancement release notes enhancement labels May 27, 2022
@adfoster-r7
Copy link
Contributor

adfoster-r7 commented May 27, 2022

Release Notes

Fixes a bug when running multi/manage/shell_to_meterpreter to upgrade from a Python Meterpreter session to a Native Meterpreter session would kill the original Meterpreter session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants