Commit Graph

646 Commits

Author SHA1 Message Date
adfoster-r7 b461f08ba3 Land #18980, improves basic shell help command 2024-03-20 21:27:12 +00:00
Zach Goldman c16b8e6e64 adds help command to basic shells 2024-03-20 14:18:36 -05:00
Dean Welch 689caf4bd1 Add upload/download/delete/mkdir/rmdir to smb session 2024-03-12 11:56:29 +00:00
Dean Welch 2399c2a393 Fix smb session autorun 2024-03-05 15:07:53 +00:00
cgranleese-r7 d52220cccb Fixes the create session datastore option from appearing for payloads 2024-02-22 14:58:41 +00:00
sjanusz-r7 085071da02 Convert generic SQL mixin into a class 2024-02-21 18:01:55 +00:00
sjanusz-r7 1b7c2bbaec SQL sessions consolidation 2024-02-21 16:16:14 +00:00
Dean Welch fa5c4c0193 lowercase session types 2024-02-14 15:45:34 +00:00
adfoster-r7 1794a5fbee Land #18763, Mssql session modules 2024-02-14 10:54:04 +00:00
Zach Goldman d18520adc6 update rhost and rport calls 2024-02-13 13:00:38 -06:00
cgranleese-r7 5d165466ff Move CreateSession from advanced into basic options 2024-02-12 11:35:27 +00:00
Zach Goldman 2c60780dc0 Add MSSQL session Type 2024-02-09 07:27:01 -06:00
cgranleese-r7 0e9cad6d45 Adds MySQL session type 2024-02-02 14:39:37 +00:00
sjanusz-r7 a5dcf5a2f4 Fix PostgreSQL autoruns 2024-01-22 10:47:34 +00:00
sjanusz-r7 23a9938283 Add PostgreSQL session type 2024-01-19 10:29:37 +00:00
h00die 6a851855a8 spelling fixes for lib folder 2024-01-06 15:54:49 -05:00
Dean Welch cd8cc75cf3 Add smb session type 2023-12-04 17:55:11 +00:00
Christophe De La Fuente 0d591a3136 Land #18526, Add a command to customise DNS resolution 2023-11-23 17:46:16 +01:00
Dean Welch ea41ec7a5d Fix tests leaving behind threads 2023-11-07 17:43:43 +00:00
Ashley Donaldson 7442655ab9 Override to TCP when encountering UDP-unfriendly comms 2023-11-07 15:58:45 +11:00
Dean Welch c7e0e094fa Add core session commands and test suite 2023-11-06 16:34:37 +00:00
Dean Welch 3f3531d119 Add test for command shell sessions 2023-10-31 16:35:58 +00:00
Simon Janusz faa3dd6b85 Land #18372, Fix error downloading a file from generic shell 2023-10-05 17:47:27 +01:00
h00die d64ed33cdf code spell for a bunch of modules 2023-09-24 17:42:00 -04:00
adfoster-r7 a60e048e78 Fix msfrpc hanging when updating saved command history 2023-09-15 12:42:40 +01:00
Carmix 1efb3f733f solves #18371 2023-09-15 11:36:15 +02:00
Spencer McIntyre 39382c4652 Land #17600, Add AWS Instance Connect Sessions
Implement AWS Instance Connect Sessions
2023-08-03 12:06:29 -04:00
cgranleese-r7 5756241fb3 Land #18223, Fix broken msfconsole histories when switching between shell sessions 2023-08-03 16:40:01 +01:00
Spencer McIntyre 396029a58e Fix connectivity issues
The connection needs to slowly send data to the remote end for
stability. Additionally, the `exit` command should be issued when
closing the connction so it is reset back to the logon prompt.
2023-08-01 15:04:32 -04:00
Spencer McIntyre cd70044e36 Automatically login to the serial connection 2023-08-01 15:04:32 -04:00
RageLtMan 2352ce6740 Implement AWS Instance Connect Sessions
AWS EC2 Nitro instances (and possibly others) support serial proxy
over SSH using the Instance Connect API:
https://docs.amazonaws.cn/en_us/AWSEC2/latest/UserGuide/
connect-to-serial-console.html

This process consists of sending an SSH pubkey to the serial proxy
control plane, connecting to a well-known URL with the instance ID
and port number as username, and the SSH private key as credential.
The resulting session is a "fragile" SSH context which does not
tolerate Channel-closing, requiring some special handling in Msf to
safeguard the initial Net::SSH::CommandStream.

Implement a BindAwsInstanceConnect Handler which loads an SSH key
from the local FS or generates a new one on the fly, passes the
pubkey to the InstanceConnect API, and then establishes SSH comms
with the InstanceConnect SSH proxy.

Implement a AwsInstanceConnectBind to handle resulting connetions,
derived from SshCommandShellBind, with an updated #bootstrap which
avoids meddling with the fragile CommandStream/Channel.

Testing:
  Got serial console to the ttyS0 login prompt of a Nitro EC2 VM.
  Logged in using previously-known credentials.
  Verified console operations.

Notes:
  Handler keeps firing, same as the SSM session concern.
  There is a limit to the number of sessions which an instance can
hold (possibly only one).
2023-08-01 15:04:03 -04:00
adfoster-r7 449af8daa7 Fix broken msfconsole histories when switching between shell sessions 2023-07-27 16:12:57 +01:00
usiegl00 5f8767f4cf M1ssion Dyld Mettle: Aarch64 Payloads
This builds on Back from the dyld by adding the required aarch64
assembly code to enable the OSX loader to run on the m1. This enables
the use of native payloads on M1 or M2 devices that do not have Rosetta
installed.
2023-06-19 10:57:37 +02:00
Spencer McIntyre 120dc877ad Pr/collab/17430 (#41)
* Prevent using post modules with the session

It doesn't work reliably because of winpty and how the output is
mangled.

* Set the limit correctly

* Fix Linux PTY downgrade issues

* Remove filtering

The filtering implementation is incomplete and unnecessary.

Filtering is unnecessary because Linux sessions execute a stub on
session start up that uses a combiantion of stty and a fifo to emulate a
PTY-less session. Windows sessions do not need filtering because they
have been explictly marked as being incompatible with the Post API which
is confused by the extra characters.

The filtering implementation is incomplete because it does not account for
echo fragments that are split across lines. It also does not account for
all of the ANSI escape codes.

* Add module docs for enum_ssm
2023-05-22 17:11:16 -04:00
RageLtMan f929d2c90f Drop redundant shell_command in powershell.rb 2023-05-16 15:43:16 -04:00
RageLtMan 713ec6ae76 Merge branch 'master' into feature/aws_ssm_sessions 2023-05-16 14:39:37 -04:00
Spencer McIntyre e92695149d Fix linux tests, remove Windows support (#39)
* Revert "shell_command_token_base get 0th output index"

This reverts commit 3a4cb3560f.

* Correct the order of arguments to #set_term_size

* Fix paths for directory checks

The path C:\ ends with a trailing backslash which will cause bash to
wait for another line if input. This places the shell in an undesirable
state.

* Fix post module tests for Linux

* Remove the command document

This hasn't been tested and it's unclear under what conditions this
would be used.

* Fix Windows SSM sessions

---------

Co-authored-by: Spencer McIntyre <zeroSteiner@gmail.com>
2023-05-10 17:48:53 -04:00
Spencer McIntyre 2e3a2b6f6d Combine AWS SSM modules, autodetect platform 2023-04-19 18:05:50 -04:00
Spencer McIntyre a7d8bc6757 Fix sessions opening over and over again
Also make some code cleanups
2023-04-19 18:05:50 -04:00
RageLtMan 153f950f11 Add AwsSsmCommandShellBind session type
Create an AwsSsmCommandShellBind session type to provide intercept
points for shell command interactions and a wrapper class which is
used to register the new session.

Update Msf::Handler::BindAwsSsm with its own #create_session method
utilizing the new session type to provide direct control of session
initialization.

Restore standard handler attributes and thread nomenclature in an
attempt to resolve the repeating session creation when #to_handler
is called on the payloads.

Testing:
  Tested in local framework, unfortunately the recurring session
init problem appears to persist. Requesting testing on an upstream
Framework by saner folks.
2023-02-04 20:57:26 -05:00
Grant Willcox 6043d0ffba Update all links from Wiki site to new docs site. 2023-01-27 09:58:53 -06:00
Ashley Donaldson 5fd6103a70 Use boolean output of write_file for cmd_upload
Also fixed powershell upload, which failed at around 20000 bytes per command.
I believe this is related to powerfun, which seems to truncate to 20000 bytes.
2022-12-14 20:46:31 +11:00
adfoster-r7 e2d052322d Support upload and download command for powershell sessions 2022-10-26 11:48:31 +01:00
Spencer McIntyre ec4c45f145 Land #16521, Add custom stage 2022-09-08 14:44:32 -04:00
bwatters 07aa024b21 Add custom session types and minor cleanups 2022-09-07 15:43:50 -05:00
cgranleese-r7 22187537d9 Land #16861, Fix broken reverse ssh command shell 2022-09-06 11:09:48 +01:00
bcoles 3ea8ec91c7 Deprecate domain_list_gen script 2022-08-22 09:36:06 -04:00
Spencer McIntyre ee286dda1c Land #16912, Deprecate sound_recorder script 2022-08-22 09:18:29 -04:00
Grant Willcox 6d1f64d3e9 Land #16905, Deprecate panda_2007_pavsrv51 script 2022-08-17 11:38:41 -05:00
Grant Willcox 1000b351f1 Land #16909, Deprecate get_pidgin_creds script 2022-08-16 12:38:17 -05:00