Commit Graph

4671 Commits

Author SHA1 Message Date
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
Tim W 809a990ab8 add mouse doubleclick 2019-06-20 15:21:41 +08:00
Tim W 48d29e532e add keyevent api 2019-06-20 13:54:13 +08:00
Chris Higgins ceba93e84e Land #11904, fix meterpreter screenshot dll upload 2019-06-17 23:36:29 -05:00
Tim W 3338401708 fix #11975, fix meterpreter shell command on android 2019-06-14 06:01:53 +08:00
Adam Cammack 1f6d61dde8 Land #11965, Add secure Meterpreter command
The command will force or renegotiate TLV encryption on the for the
current session.
2019-06-13 14:20:50 -05:00
William Vu bcee6f0dc2 Join full path nicely 2019-06-13 10:30:36 -05:00
William Vu 8e6fbcb4b5 Concatenate path and name in Meterpreter pgrep -lf 2019-06-12 19:13:02 -05:00
OJ 0e0edeb372 Add a secure command to renegotiate TLV encryption
This gives us the ability to force TLV encryption if for some reason
it's not already in place, and it means we can renegotiate a new key on
the fly if we want to.
2019-06-11 08:26:33 +10:00
Wei Chen 5c97c2fa19 Land #11951, Add meterpreter > screenshare command 2019-06-10 13:25:27 -05:00
William Vu dd101a0469 Add nil check
Just in case.
2019-06-07 00:16:44 -05:00
William Vu 53ea7e577f Add sanitized new XML format 2019-06-07 00:07:50 -05:00
William Vu 40eeae541b Fix style 2019-06-06 23:38:41 -05:00
Jeffrey Martin f646a973a7 Update retina imports to better handle parsing 2019-06-06 19:13:06 -05:00
Tim W 49ce878497 refactor html code into separate module 2019-06-06 13:39:53 +08: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
Wei Chen 17170e2152 Land #11937, make content-length header optional 2019-06-03 18:56:27 -05:00
Brent Cook 3cf375c05c if there is no content, don't include content length 2019-06-02 13:27:11 -05:00
Tim W 103afc6568 fix screenshare 2019-06-02 00:16:13 +08:00
Brent Cook 53557cc92e replace trivial usage of expand_path with getenv
expand_path is not implemented consistently across platforms and
sessions, which leads to confusing behavior. In places where we have trivial
single variable expansions, this changes modules and library code to just use
getenv.

We'll look at the rest individually to see if they can also be reimplemented in
terms of getenv.
2019-05-31 17:44:35 -05:00
Jake Blank 933cf25efb add live remote screensharing/monitoring 2019-05-31 05:26:38 +08:00
Tim W abbefab5c0 add meterpreter mouse command 2019-05-13 17:06:03 +08:00
Tim W 7ec67fb91f add meterpreter keyboard_send command 2019-05-11 16:49:01 +08:00
Jacob Robles 39aae367a5 Land #11765, Update NUUO mixin, move code to Rex 2019-04-25 09:35:47 -05:00
Jacob Robles f3a820b475 Remove protocol option
Only tcp is supported for the mixin.
2019-04-24 14:24:30 -05:00
William Vu a790e9076a Land #11766, handling of spaces in tab completion 2019-04-24 13:24:16 -05:00
Spencer McIntyre dfa37a9fb0 Fix a bug when the unbalanced quote is the end 2019-04-24 14:02:18 -04:00
Spencer McIntyre 2a0e3690db Close unbalanced quotes when tab completing 2019-04-24 11:01:23 -04:00
Spencer McIntyre 92e945ff46 Implement a custom shellsplit method 2019-04-24 10:55:02 -04: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
Spencer McIntyre 0e612045d3 Honor strings ending in slash space 2019-04-22 15:08:11 -04: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
Tim W 31eab90c74 fix mettle cmd_exec 2019-04-18 15:30:26 +08:00
Jacob Robles 028890ec51 Move ncs mixin code to rex 2019-04-12 15:12:09 -05:00
Tim W 7b09947551 Land #11675, add android app api commands 2019-04-12 23:21:00 +08:00
Tim W 6e9698f13b use print_error for errors 2019-04-12 23:20:43 +08: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
Tim W 52fdc4aab1 more cleanup 2019-04-08 18:11:45 +08:00
Tim W ed2dea1158 fix whitespace 2019-04-08 16:54:29 +08:00
CorrM 92855dfc1b remove whitespace 2019-04-04 19:38:14 -04:00
CorrM fc638e521b Add root version for (app_install, app_uninstall). improve code syntax
[-] Add root param to `app_install`
[-] Add root param to `app_uninstall`
[-] improve `cmd_` functions syntax
2019-04-04 00:54:25 -04:00
CorrM 2ef2e65424 Ready 2019-04-02 18:06:56 -04:00
CorrM 3923c20bb8 appapi first commit 2019-04-02 06:35:23 -04:00