Commit Graph

16492 Commits

Author SHA1 Message Date
James Lee 9d86a49c51 Land #6692, udp socket abstraction 2016-03-25 13:05:10 -05:00
f7b053223a9e 629bc00696 Use MSXML decoder instead 2016-03-25 22:52:16 +09:00
Brent Cook 242ea8d9cd Merge branch 'master' into land-6691- 2016-03-24 22:19:57 -05:00
OJ ce8a6f57a0 Added powershell_import support 2016-03-25 12:17:03 +10:00
Brendan Watters 18604c3d44 Land #6705, Rectify MSF_CFGROOT_CONFIG comment 2016-03-24 18:21:05 -05:00
wchen-r7 57984706b8 Resolve merge conflict with Gemfile 2016-03-24 18:13:31 -05:00
James Lee dfa518b492 Whitespace 2016-03-24 15:21:03 -05:00
James Lee 0073a8f40e Wrap comments at 78, style 2016-03-24 15:20:43 -05:00
Gregory Mikeska 7bd6d0c696 Merge branch 'master' into staging/rails-upgrade 2016-03-24 12:55:05 -05:00
Till Maas 7f002128ad Rectify MSF_CFGROOT_CONFIG comment
Also remove reference to feature request that does not seem to be
available anymore.
2016-03-23 22:23:30 +01:00
James Lee 6388578ee6 Style fixes 2016-03-23 16:15:46 -05:00
James Lee 98355c397c Clean up some variable names 2016-03-23 15:07:00 -05:00
James Lee 685d8fc588 Use 2.x symbol literal syntax 2016-03-23 15:06:35 -05:00
James Lee effee42e2f Raise a better exception for WSAEADDRINUSE 2016-03-23 13:15:38 -05:00
Louis Sato 0c19d89655 add more space for deprecation message 2016-03-23 11:39:42 -05:00
Metasploit e7b0c60e5c Bump version of framework to 4.11.18 2016-03-23 07:55:29 -07:00
Adam Cammack 866c4718b0 Fix OptPort validation
Allow a port value of 0 and don't reject empty values if the option is
not required.
2016-03-22 23:01:18 -05:00
Adam Cammack ec3a0a108d Change OptPort to inherit from OptInt
Fixes the normalize and validate methods.
2016-03-22 19:25:51 -05:00
Adam Cammack 22df7c0071 Fix datastore to validate options w/o a default
Options without a default were not pulled into the `@options` hash and
therefore were not used to validate options on assignment.

I am not entirely sure how this fix works, since it would seem that
non-override options would not get pulled in if an option was first set
in the global datastore. However, a previous value does not get
overridden and new values are validated. Anything further is merely
speculation on my part.
2016-03-22 19:12:53 -05:00
Adam Cammack 5c163960ed Fix datastore to not freeze options on the default 2016-03-22 19:07:58 -05:00
William Vu 0c7cf2924c Land #6686, Android dump_* -o fixes 2016-03-21 12:21:47 -05:00
RageLtMan c871ceea0a Implement consistent socket abstraction
In current nomenclature, Rex Sockets are objects created by calls
to Rex::Socket::<Transport>.create and Rex::Socket.create_...
When the LocalHost or Comm parameters are set to remotely routed
addresses (currently via Meterpreter sessions), Rex will create a
Channel which will abstract communications with the remote end of
the session. These channel based abstractions are called pivots,
and present in three separate flavors:
1 - TcpClientChannel, a fully abstracted, selectable Socket.
2 - TcpServerChannel, a virtual Channel which distributes client
channels.
3 - UdpChannel, a virtual Channel which provides common methods for
UDP socket operations, but is not a full (selectable) abstraction.

Unfortunately this differentiation results in inconsistent returns
from the aforementioned socket creation calls, as the call chain
creates parameters and supplies them to the create method on the
comm object referenced in the params. The comm object may be a
channel, and produce a virtual representation of a socket with
functional methods analogous to Sockets, but without a kernel FD.

This commit begins the work of ensuring that all calls for socket
creation return selectable Rex::Socket objects with semantics
familiar to Ruby developers who have not read into the details of
Rex::Socket and Rex::Post.

-----

Summary of changes:

Convert Rex::IO::StreamAbstraction to SocketAbstraction and use
the new mixin in StreamAbstraction and DatagramAbstraction. This
approach allows for common methods to reuse the abstraction data
flow, while initializing separate types of socket obects and an
optional monitor as needed.

In the Rex::Post::Meterpreter namespace, extract common methods
from Stream to a SocketAbstraction mixin, include that mixin in
Stream, and add Datagram with the dio_write handler override
exported from the current implementation of UdpChannel, also using
the mixin. This relies on the Rex::IO work above to implement the
proper type of socket abstraction to the Channel descendants.

In Rex::Post::Meterpreter::Extensions::Stdapi::Net, convert the
UdpChannel to inherit from the Rex::Post::Meterpreter::Datagram
class, implementing only the send method at this tier. Convert
create_udp_channel to return the local socket side of the datagram
abstraction presented analogous to the TcpClientChannel approach
used before.

-----

Notes and intricacies:

In order to implement recvfrom on the UDP abstraction, a shim layer
has been put in place to forward the sockaddr information from the
remote peer to the local UDP socketpair in the abstraction. This
information takes up buffer space in the UDP socket, and in order
to maintain compatibility with consumers, the dio_write_handler
pushes the data buffer, and in a separate send call, he sockaddr
information from the remote socket. On the abstraction side, the
recvfrom_nonblock call of the real UDPSocket has been overriden
via the mixed in module to call the real method twice, once for
the data buffer, and once for the packed sockaddr data. The Rex
level consumer for recvfrom calls the underlying nonblock method
and expects this exact set of returns (as opposed to what standard
library UDPSocket.recvfrom returns, which is a data buffer and an
Array of sockaddr data).

-----

Testing:
  Local and lab testing only so far.
  Test RC script to be added in GH comments.

-----

Issues:
  Currently, sendto on a remote socket does not appear to honor
LocalPort which causes DNS responses (#6611) to come from the
wrong port to remote clients being serviced over a pivot socket.
2016-03-21 03:32:52 -04:00
OJ 80e0bbeb68 Add the interactive shell prompt with sessions 2016-03-21 15:44:20 +10:00
Metasploit 6e12e74e02 Bump version of framework to 4.11.17 2016-03-18 14:12:18 -07:00
Adam Cammack 67b9d053ec Land #6679, remove unreachable sanity checks 2016-03-18 11:25:51 -05:00
Brent Cook 9219efa512 remove unreachable ruby 1.x check 2016-03-18 11:16:44 -05:00
James Lee 1375600780 Land #6644, datastore validation on assignment 2016-03-17 11:16:12 -05:00
Brent Cook df2d0f7826 Indicate that output options take parameters 2016-03-17 11:13:34 -05:00
Brent Cook 1790f039c3 Land #6684, remove obsolete warn_about_rubies 2016-03-17 08:26:57 -05:00
William Vu 59a55dec5b Land #6676, new Postgres fingerprints 2016-03-16 16:32:10 -05:00
Adam Cammack 32fe9ae55d Remove dead version check in db_manager.rb
The check appears to have been orphaned in the db_manager refactor, but
I can't track down the exact commit.
2016-03-16 15:24:55 -05:00
James Lee 79c36c4f53 RPORT should be an OptPort 2016-03-16 14:13:19 -05:00
James Lee c21bad78e8 Fix some more String defaults 2016-03-16 14:13:18 -05:00
James Lee a878926f31 Remove unused datastore option 2016-03-16 14:13:17 -05:00
William Vu adb275520b Land #6680, old SVN code deletion 2016-03-16 10:15:06 -05:00
Brent Cook 44e1fefa2e when normalizing a string type, ensure we have a string first 2016-03-16 06:44:36 -05:00
Brent Cook 5a72f2df16 remove subversion support 2016-03-15 22:00:32 -05:00
Brent Cook 63263773d1 simplify sanity checks for Ruby 1.x 2016-03-15 21:55:25 -05:00
Brent Cook 3b6a3374ae prefer explicit defaults to implicit 2016-03-15 20:58:14 -05:00
Brent Cook 87074c0638 Land #6651, add android sqlite_query option, update metasploit-payloads 2016-03-15 18:27:49 -05:00
Brent Cook 257c8f4058 handle a sqlite table being empty 2016-03-15 18:26:38 -05:00
Adam Cammack 05f585157d Land #6646, add SSL SNI and unify SSLVersion opts 2016-03-15 16:35:22 -05:00
David Maloney 3cbc5684e1 iadd some preuath fps for postgres 9.4
the preauth fingerprinting for postgres is somewhat
unmaintainable, but due to a specific customer request
i have added these two FPs for 9.4.1-5

MS-1102
2016-03-15 14:50:07 -05:00
Brent Cook 654590911b Enforce integrity of datastore options on assignment 2016-03-15 14:00:32 -05:00
OJ d8c850aaf0 Add support for the execution of single powershell commands 2016-03-14 17:13:12 +10:00
OJ f8f61e8d83 Basic shell of the MSF Powershell extension functionality 2016-03-14 12:55:58 +10:00
HD Moore 42689df6b3 Fix a stack trace with `set PAYLOAD in msf>` context 2016-03-13 14:56:54 -05:00
Christian Mehlmauer 4f09246c78 reenable module loader warnings 2016-03-13 20:04:05 +01:00
Brent Cook dabe5c8465 Land #6655, use MetasploitModule as module class name 2016-03-13 13:48:31 -05:00
Metasploit e059f42094 Bump version of framework to 4.11.16 2016-03-11 14:17:28 -08:00