1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-08 14:36:22 +01:00
Commit Graph

8 Commits

Author SHA1 Message Date
OJ
2f200d4fa1 Fix up POSIX to match channel changes
POSIX was out of whack with Windows as a result of the changes made
around channels. The schedular in posix was very different, and this
commit brings it into line.

Other than the obvious issues, a non-obvious issue with the changes
was that the channel was being freed up on close prior to the thread
terminating. This doesn't appear to be an issue on Windows, but was
causing crashes on close in POSIX.

The changes go quite deep. This changeset requires a lot of testing.
2013-10-22 16:43:22 +10:00
OJ
a89d79d139 Interactive channel refactor
The goals of this work are:

* To fix issue where backgrounding and re-interacting with channels wasn't
  working.
* To fix issue where closing of meterpreter was not closing off background
  prcoesses (such as cmd.exe).

The two things preventing this stuff from working were:

* When interactive channels are backgrounded their handles were destroyed
  along with the context that wraps them up. Making them interactive again
  had no impact because the handle and context were invalid. If anything,
  this made meterpreter unstable. Sometimes the session would die when
  attempting to interact with the channel again.
* When closing channels, there was no way of terminating the process that
  sat behind the scenes because no reference to the process was retained.
  Channels would close and handles would close, but no process termination
  was done.

To fix these problems:

* The interactive thread no longer terminates when backgrounded. Instead
  its put in a suspended state where it's waiting a signal from a resume
  handle that's associated with the channel's context. This means that the
  destruction of the context doesn't happen at all until the termination
  of the channel, which is exactly when it should happen anyway.
* Process handles are stored alongside the input/output handles so that
  when the time comes, the process can be terminated if required. This
  means that when the channels are closed, the code has a reference to the
  associated process which can be terminated. This is only done for
  interactive processes, non-interactive processes do not have this
  problem because meterpreter doesn't have to keep track of them.
2013-10-21 22:13:59 +10:00
James Lee
7283131279 Initial source import from metasploit-framework 2012-11-19 16:46:07 -06:00
jlee-r7
964bae0c49 Initial commit 2012-11-19 14:40:03 -08:00
Stephen Fewer
0a5c87b678 Initial commit of the multi-threaded meterpreter.
git-svn-id: file:///home/svn/framework3/trunk@7698 4d416f70-5f16-0410-b530-b9f4589650da
2009-12-04 17:37:21 +00:00
HD Moore
fa51ea5d15 Swapping in the latest patched copy of Meterpreter. See #275
git-svn-id: file:///home/svn/framework3/trunk@6357 4d416f70-5f16-0410-b530-b9f4589650da
2009-03-22 18:56:28 +00:00
HD Moore
a3fa8e90cb Swapping out old Meterpreter code for Stephen Fewer's latest patched copy
git-svn-id: file:///home/svn/framework3/trunk@6356 4d416f70-5f16-0410-b530-b9f4589650da
2009-03-22 18:55:36 +00:00
Matt Miller
736528e546 import of meterp shit
git-svn-id: file:///home/svn/incoming/trunk@2516 4d416f70-5f16-0410-b530-b9f4589650da
2005-05-24 19:08:32 +00:00