Commit Graph

999 Commits

Author SHA1 Message Date
bwatters-r7 2db93c9051 Land #12002, Feature/reverse ssh
Merge branch 'land-12002' into upstream-master
2020-02-21 09:17:51 -06:00
bwatters-r7 1aa412ccc0 add some of bcoles suggested fixes 2020-02-19 13:52:38 -05:00
Spencer McIntyre d829f2ab43 Fix getsockname usage in the SOCKS5 server 2020-02-11 21:53:36 -06:00
dwelch-r7 560475ebff Land #12733, Add support for repeated key in vars_post 2020-01-27 10:36:06 +00:00
Onur ER a45e4b6d37 Update lib/rex/proto/http/client_request.rb
Co-Authored-By: acammack-r7 <adam_cammack@rapid7.com>
2019-12-19 20:43:30 +03:00
Onur ER b29523fc2a Added Array Handling
Handle the repeated key query string 
https://github.com/rapid7/metasploit-framework/pull/12704#discussion_r357748834
2019-12-16 22:01:32 +03:00
William Vu ce656a850a Update raw_headers 2019-10-31 12:16:31 -05:00
William Vu 866a1c9bed Fix Boolean validation to match our idiom 2019-10-31 11:29:43 -05:00
William Vu b9baa80823 Refactor to use config hash and new option 2019-10-31 11:11:43 -05:00
William Vu b268feda73 Allow partial response due to timeout 2019-10-29 21:25:21 -05:00
Spencer McIntyre db53adf2a1 Fix the require_signing attribute 2019-10-02 20:22:51 -04:00
RageLtMan 21dd5f438d Address some of @bcoles comments 2019-09-15 01:14:04 -04:00
RageLtMan d00d5fbff9 Address review comments by Hirura
@hirura noticed two bugs: a typo, and a mistake creating an empty
RequestHandler object since the underlying library already does
this when it does not have a RequestHandler assigned for the
request type.

Fix typo for #1
Remove the RequestHandler assignments in #2 and related opt merge.

Testing:
  None yet
2019-06-25 18:27:57 -04:00
William Vu 77395749da s/infinite/indefinite/ 2019-06-25 01:00:08 -05:00
William Vu b49fa29a7f Allow true zero-second timeout in send_request_*
Also fixes a bogus response when timeout is nil.
2019-06-24 12:07:24 -05:00
RageLtMan c339662fed SshCommandSession and Ruby Payloads
Implement a command-only session type over the HrrRbSsh client
Connection Channels' file descriptors, adjust from base command
session to deal with the separate reader/writer IOs. Technically,
a TTY session works out of the box here as well.

Implement a pair of showcase Ruby payloads using net/ssh to call
back to the handler, create a shell channel, and loop piping I/O
between framework session and client via the Ruby backtick exec.

Next Steps:
  Command payloads need to be written for every major interpreted
language as well as some sort of bashism a la openssl_double if
it comes to that, but preferably single socket implementation.

Testing:
  Very minimal, needs a good run through by the community and R7
2019-06-23 05:20:04 -04:00
RageLtMan f0b24339fe Implement Rex::Proto::Ssh::Server scaffold
Create the Rex::Proto::Ssh namespace and implement hrr_rb_ssh
objects in the Rex namespace with Rex' sockets stack, permissive
default connection options to accept any authentication, ACLs for
port forwarding, and a modified Connection #initialize method for
simplified instantiation.

The actual Rex::Proto::Ssh::Server object follow standard Rex
semantics for services to permit use in handlers, exploits, and
auxiliary modules in the same manner as the Http::Server is used
today.

This work is far from complete - the HrrRbSsh low-level objects
should be decomposed into Rex' pattern as they currently depend
heavily on their own Procs and Threads internally which use the
parent Connection object's attributes to look up which Proc should
be called in response to a Channel or Authentication request. This
is a bit difficult to do piecemeal given the intertwined data and
execution dependency inside of HrrRbSsh.

Next steps:
1. Create handler and reverse_ssh command session payloads
1a. POSIX systems generally have SSH already
1b. Windows Powershell is likely able to hotload SSH libs as a
pre-stager.
1c. Other interpreted runtimes usually have client-ssh libraries
2. Implement options parsing, handling, etc for user-customizable
functionality from the Msf namespace.
3. Use libssh2 to permit mettle use of the SSH transport.
3a. Bother @OJ about doing the same for Windows Meterpreter.
3b. Bother @zeroSteiner to implement SSH transport for PyMeterp.
3c. Ask @timwr and @mihi how viable this is for Android/Java.
3d. See if @OJ will do this for CLR-meterp on a livestream.
4. Write a post module which runs this SSH server from a mettle
session using the compromised hosts's own host keys and passwd
file for "valid" authentication while logging and MITMing the
entire command stream remotely - help folks shake off some of the
complacency around "secure shells."
5. Write a plugin which will permit sharing of the entire console
context, specific acquired sessions, or TCP forwards with the
pugin's SSH clients based on the credentials used to connect.
6. Further decompose the server code into Rex to permit writing
client fuzzers, loggers, and other tooling to test the posture of
SSH client implementations.
7. Work to implement SSH client functionality in HrrRbSsh and
convert the rest of Rex/Msf to use this library instead only.
8. Rewrite and import MetaSsh into Metasploit proper using the
new Rex::Proto::Ssh code.

-----

Huge thanks to @hirura for writing HrrRbSsh. I've spent countless
hours on and off working to implement server-side semantics in
net/ssh years ago and it was becoming a pretty full rewrite due
to the ordering of server/client req/resp messages and who sent
what to whom. This library is a much much cleaner implementation
and provides full, modern SSH servers in pure Ruby.
2019-06-22 20:06:15 -04:00
Brent Cook e5a4c2d341 Make auto_cl more selective based on HTTP method
According to https://tools.ietf.org/html/rfc7230#section-3.3.2, a zero content-length is valid for some kinds of HTTP methods.

Instead of implicitly disabling auto_cl if there is no actual content, disable auto_cl default for HTTP methods where semantics of the message do not anticipate any content. This can still be overridden by a caller if it still wants to add an empty content-length for HTTP methods where it does not normally make sense (e.g. if it exploits a bug.)
2019-06-04 04:04:08 -05:00
Brent Cook 3cf375c05c if there is no content, don't include content length 2019-06-02 13:27:11 -05:00
Jacob Robles f3a820b475 Remove protocol option
Only tcp is supported for the mixin.
2019-04-24 14:24:30 -05:00
Jacob Robles aba88243d7 Add nuuo resposne string 2019-04-23 10:47:40 -05:00
Jacob Robles 80a68de17d Keep response status 2019-04-23 06:27:12 -05:00
Jacob Robles a7d02d49d8 Update mixin and client for response 2019-04-19 14:24:37 -05:00
Jacob Robles e85147a5f2 Add nuuo response
Parse server responses
2019-04-19 14:23:53 -05:00
Jacob Robles 7b807d4dce Add nuuo client rex and spec 2019-04-19 06:28:56 -05:00
Jacob Robles f0dfc82803 Add nuuo client request rex and spec 2019-04-19 06:26:41 -05:00
Jacob Robles 028890ec51 Move ncs mixin code to rex 2019-04-12 15:12:09 -05:00
Jacob Robles 4777fb7618 Update syntax to match 2019-04-09 20:05:00 -05:00
Jacob Robles ee23a1557e Fix duplicate host header 2019-04-09 09:08:34 -05:00
Marian Gawron 91da35070d updated smb-client to make it working again after being bugged for some time 2019-01-25 12:47:18 +01:00
Shelby Pace 34ae9c38f9 added WebEx modules, arch check 2018-10-23 15:51:23 -05:00
Matthew Kienow df18e354e1 Add bind_busybox_telnetd payload, misc cleanup 2018-08-23 15:23:39 -04:00
Matthew Kienow c0c3e12c74 WIP - hp officejet pro exploit, enhance PJL lib 2018-08-23 14:53:54 -04:00
UserExistsError d5ed70417b bind_named_pipe payload for ruby_smb 2018-07-17 17:46:10 -06:00
Brent Cook 0b9bc8c24a Land #10241, don't call print_error from rex context, use elog instead 2018-07-05 17:28:10 -05:00
Jacob Robles 7dc87e1a9e Increase read depth for smb pipes 2018-07-03 16:06:42 -05:00
Brent Cook af43b6ca17 don't call print_error from rex context, use elog instead 2018-07-02 15:19:19 -05:00
Brent Cook 3b228b0abd avoid stack overflow on too many empty pipe reads in a row 2018-06-29 17:48:39 -05:00
Jacob Robles a8c6835c64 Handle STATUS_PIPE_EMPTY error 2018-06-28 12:15:43 -05:00
Brent Cook 2792d5fb27 call delete implementation from ruby_smb 2018-06-28 12:15:43 -05:00
Brent Cook c06f13b33e remove superfluous sleeps, simplify logic 2018-06-28 12:15:42 -05:00
Brent Cook 4b767efd6c remove evasion logic from dcerpc read path 2018-06-28 12:15:42 -05:00
Jacob Robles 2fd0d797ac psexec smb2 support 2018-06-25 15:06:23 -05:00
William Vu c3c6bc19da Land #10059, CVE-2018-1111 exploit 2018-06-12 15:02:06 -05:00
Spencer McIntyre da2666581b Alter the socks5 bind request handling 2018-05-26 19:51:14 -04:00
Spencer McIntyre c85cc9ad9e Refactor SOCKS5 TcpRelay and add packet tests 2018-05-26 13:46:00 -04:00
Spencer McIntyre a21cc9c5bc Refactor core dispatch methods and error handling 2018-05-25 20:14:03 -04:00
Spencer McIntyre 49341fc87d Add credential authentication support to socks5 2018-05-25 20:14:03 -04:00
Spencer McIntyre 9b5ae34896 Drop udp associate support and cleanup logging 2018-05-25 20:14:03 -04:00
Spencer McIntyre 1de5a464e7 Fix reply status codes and domainname addresses 2018-05-25 20:14:03 -04:00