Commit Graph

1346 Commits (558d007d8e8d8391c7faf340fe73cc996be57dc1)

Author SHA1 Message Date
OJ 6983b0f857
Update the kiwi extension to show correct version number 2017-04-11 20:23:56 +10:00
Tim a65936452f Add android wakelock command to turn the screen on 2017-03-28 16:24:11 +08:00
Tim ef53e6a593 fix execute and kill cmd usage/help 2017-03-22 16:29:47 +08:00
William Vu 686f30e118
Land #8117, p{grep,kill} for Meterpreter <3 2017-03-21 16:37:34 -05:00
Brent Cook dd6e75986d add -l and -f flag simulation for pgrep, XXX rex handles flag opts poorly 2017-03-16 23:48:39 -05:00
Brent Cook 70bbacf7ed kill processes in reverse, allow children before parents more likely 2017-03-16 23:48:04 -05:00
Brent Cook 85f7d73d4d add pgrep as well 2017-03-16 04:14:45 -05:00
Brent Cook c9a85f58c0 add pkill command, rework to share filtering logic with ps 2017-03-16 03:57:49 -05:00
Spencer McIntyre befc5e05e5 Fix more kernel32 railgun definitions using DWORD 2017-03-14 18:42:52 -04:00
Spencer McIntyre d759c603b2 Fix more kernel32 railgun definitions using DWORD
Some railgun definitions for the kernel32 module define DWORD for the
functions return type when it should be HANDLE. This causes errors on
64-bit systems when the return value is truncated.
2017-03-14 16:58:22 -04:00
Spencer McIntyre 2d51801b01 Use native_arch for railfun multi and test it 2017-03-01 13:07:04 -05:00
Spencer McIntyre 0ebd51d224 Use native_arch for railgun sizes 2017-02-26 14:42:55 -05:00
Spencer McIntyre 3b2e5e0785 Add a new core_native_arch method for meterpreter 2017-02-26 14:22:24 -05:00
William Webb 076848e904
Land #7993, Keep sessions in progress alive 2017-02-24 16:57:47 -06:00
Pearce Barry e5d0370a94
Fixes MS-1716, keep sessions in progress alive. 2017-02-24 12:56:05 -06:00
bwatters-r7 4f839299f1
Land #7978, Add a test module for railgun API calls 2017-02-21 17:15:49 -06:00
William Webb 2a20d24c29
Land #7966, Fix 'rm' to handle multiple files 2017-02-21 13:32:19 -06:00
Spencer McIntyre 7d1fadb84f Add a test module for railgun api calls 2017-02-18 17:37:49 -05:00
Brent Cook 566bafe65d
Land #7962, Uploading files without specifying the destination closes a Meterpreter session. 2017-02-17 17:04:22 -06:00
Brent Cook 5207cb6c3a
Land #7914, send the correct exception on channel open failure 2017-02-17 17:00:30 -06:00
Brent Cook 807a27e73d clarify error handling when a channel cannot be opened 2017-02-17 16:59:09 -06:00
Rich Whitcroft 5bd38af8d6 fix rm to handle multiple files 2017-02-15 19:22:39 -05:00
Rich Whitcroft 24a4211bb9 fix upload when dest not specified 2017-02-14 22:08:49 -05:00
Brent Cook b741c8b2f7 fix typo in failure path, pointed out by rw- 2017-02-13 21:16:48 -06:00
Brent Cook 74e029f3b1
Land #7932, Fix CVE-2017-5229 2017-02-07 19:22:36 -06:00
Brent Cook 522c6dce8e
Land #7931, Fix CVE-2017-5231 and respect user's dest 2017-02-07 19:22:17 -06:00
Brent Cook 68a5d300fe minor style issues 2017-02-07 18:35:35 -06:00
Brent Cook b370dd0654 Fix CVE-2017-5229 - extapi Clipboard.parse_dump() Directory Traversal 2017-02-07 18:24:06 -06:00
Justin Steven 56cf6b129d
Fix CVE-2017-5228 2017-02-07 23:44:23 +10:00
Justin Steven cb74d3b05b
Fix CVE-2017-5231 and respect user's dest 2017-02-07 23:41:59 +10:00
Artem 9db2cdb33a Fix close session
Fix close session if remote file is permission deined
2017-02-05 02:00:05 +03:00
OJ a3cf400566
Re-set the TLV names for migration stuff 2017-01-24 07:36:56 +10:00
Jeffrey Martin 2c8cd80a2b
revert change to TLV_TYPE_MIGRATE_LEN in #7856 2017-01-23 09:23:32 -06:00
Jeffrey Martin 677d070179 make tlv enum of migrate length consistent 2017-01-23 09:19:53 -06:00
Brent Cook f61314d2d6
Land #7856, Fix incorrect translations in TLV inspection code 2017-01-22 11:08:05 -06:00
Brent Cook f69b4a330e handle Ruby 2.4 Fixnum/Bignum -> Integer deprecations 2017-01-22 10:20:03 -06:00
Brent Cook 441222c2b5 Merge remote-tracking branch 'upstream/master' into land-7787- 2017-01-22 09:44:11 -06:00
William Vu e0094897a1 Add CSV and vCard support to dump_contacts 2017-01-20 19:18:50 -06:00
OJ 7e50ce09c0
Fix TLV inspect issue 2017-01-21 09:17:20 +10:00
Brent Cook 5b2e76b981
Land #7794, Fix #7793, incorrect command name in android meterpreter extension 2017-01-11 12:38:36 -06:00
Ubuntu 6dee63d727 Incorrect command name 2017-01-06 23:58:18 +00:00
Tim eec5e88e1c
android_wakelock 2017-01-05 19:17:28 +07:00
Brent Cook 5a4abeb110 make Rex UDPSocket.send work just like the real thing 2017-01-02 09:38:26 -06:00
Brent Cook d5bc6a089f recvfrom_nonblock need flag = 0, not nil 2017-01-02 08:55:12 -06:00
Brent Cook bb684bb3b1 tcp channel fixes 2016-12-30 14:59:10 -06:00
OJ 99da91e278
Adjust golden ticket creation to force params when SYSTEM 2016-12-23 20:29:00 +10:00
OJ 894ed4957f
Add help where appropriate 2016-12-23 10:51:33 +10:00
OJ 93a280dfc1
Merge upstream/master ready for PR 2016-12-23 10:20:53 +10:00
OJ 34e3a17fda
Remove unused Kiwi TLVs 2016-12-23 09:57:57 +10:00
William Webb 5702bd6745
Land #7674, Move migration stub generation code into msf 2016-12-22 17:53:00 -06:00
OJ 4c150a10c2
Update to use new base64 flags for kiwi 2016-12-23 09:40:11 +10:00
OJ c97e6ae1e8
Handle stupid merge from OJ's upstream 2016-12-23 09:00:27 +10:00
OJ e6e2388256
SSP creds and golden tickets 2016-12-23 08:34:16 +10:00
OJ 0bca485858
Continue work on enabling kiwi functionality 2016-12-20 18:25:48 +10:00
OJ ee4caba646
Remove `terminal` and tweak `sessions`
Hopefully everyone is now happy!
2016-12-20 07:50:07 +10:00
OJ 74040c4ee6
Rename the `sess` command to `terminal`
Lots of people have been frustrated by the `sess` command as it mucks
with the autocomplete for `sessions`. This is a fair concern, especially
given that `sess` was intended to be a non-annoying shortcut.

This commit changes the `sess` command so that it is instead called
`terminal`. I couldn't think of a better option that didn't already
clash with another name or meaning. At least `terminal` is something
that doesn't clash, doesn't muck with any existin autocomplete rules,
and is in some way another name for the existing sessions.

Feedback appreciated!
2016-12-19 17:05:04 +10:00
OJ 609c8da772
Re-add wifi support, start work on kerberos stuff 2016-12-10 11:20:16 +10:00
Artem 9a7c0eb7b6 Fix cloe file 2016-12-08 21:28:39 +03:00
OJ d0696a09ad
Move migration stub generation into MSF
This code adds support for transport-specific migration stubs to be
generated in MSF rather than having them hard-coded in Meterpreter.
2016-12-08 16:01:13 +10:00
OJ 50b0c9ef5e
Add tspkg support and fix parsing a little 2016-12-07 15:06:08 +10:00
OJ 7d316cb3e6
Begin work on parsing mimikatz output and handling more cmds 2016-12-07 15:06:08 +10:00
OJ 8f4621f424
Initial work to support the new kiwi extension 2016-12-07 15:05:02 +10:00
Brent Cook b4a2a6ed60 Merge remote-tracking branch 'upstream/master' into land-7625- 2016-12-06 06:23:32 -06:00
Tim 8f3fab4b1b
fix sleep and transport on android 2016-11-30 21:59:01 +08:00
Tim 468bf4696f
stdapi_fs_file_copy 2016-11-29 13:56:27 +08:00
Brent Cook 16b5f40dae Revert "Rework XOR code to make more sense"
This reverts commit 699a8e91d2.
2016-11-20 19:09:45 -06:00
Brent Cook f313389be4 Merge remote-tracking branch 'upstream/master' into land-7507-uuid-arch 2016-11-20 19:08:56 -06:00
Brent Cook 5490fda0ae Merge remote-tracking branch 'upstream/master' into land-7261 2016-11-14 16:49:28 -06:00
OJ 7773d90da4
Update railgun to use arch to check for 64 bit 2016-10-29 14:26:06 +10:00
OJ 57eabda5dc
Merge upstream/master 2016-10-29 13:54:31 +10:00
OJ 8b97183924
Update UUID to match detected platform, fail exploit on invalid session 2016-10-29 13:45:28 +10:00
OJ bf7e7ae4be
Fix silly mistake with resetting arch in sysinfo 2016-10-29 08:32:32 +10:00
OJ d201c5bccc
Force x86_64 to change over to x64 in sysinfo, tidy arch checks 2016-10-29 06:49:35 +10:00
OJ 1d617ae389
Implement first pass of architecture/platform refactor 2016-10-28 07:16:05 +10:00
OJ 786600bd09
Remove the unused binary_suffix var 2016-10-18 16:15:00 +10:00
Tim 67d07a715c
add android_hide_app_icon 2016-10-17 19:02:48 +08:00
Tim 5fad8d8efa
prefix android commands with android_ 2016-10-15 23:57:20 +08:00
OJ 022830634b
Rejig platform to use windows instead of win32/win64 2016-10-14 10:10:04 +10:00
Brent Cook 0d5a23b865 Merge branch 'master' into land-7423-localtime 2016-10-10 23:54:38 -05:00
OJ 699a8e91d2
Rework XOR code to make more sense 2016-10-10 13:38:08 +10:00
OJ e139a1ee8f
Land #7383: Rebase/Fix + SSL stager support for python 2016-10-10 13:06:09 +10:00
William Vu a89607bbdb Prefer keyword argument 2016-10-04 23:14:14 -05:00
Brent Cook b7ea465855 refresh sysinfo when explicitly requested on a session 2016-10-04 22:06:06 -05:00
OJ a4efa77878
Support driver list, adjust capcom exploit
This commit adds MSF-side support for listing currently loaded drivers
on the machine that Meterpreter is running on. It doesn't add a UI-level
command at this point, as I didn't see the need for it. It is, however,
possible to enumerate drivers on the target using the client API.

Also, the capcom exploit is updated so that it no longer checks for the
existence of the capcom.sys file in a fixed location on disk. Instead,
it enumerates the currently loaded drivers using the new driver listing
function, and if found it checks to make sure the MD5 of the target file
is the same as the one that is expected. The has is used instead of file
version information because the capcom driver doesn't have any version
information in it.
2016-10-04 11:27:20 +10:00
OJ 3469104f7a
Add localtime command support 2016-10-03 15:18:37 +10:00
William Vu 039357a714
Land #7387, checksum command for Meterpreter 2016-10-02 21:35:34 -05:00
Spencer McIntyre 8e09b172f6 Add a meterpreter checksum command 2016-10-01 14:29:35 -04:00
Brent Cook 6241e48b34
Land #7350, add 'sess' command for direct session switching support 2016-09-29 23:18:53 -05:00
Brent Cook 49ed02a203 fix packet parsing when there is partial data 2016-09-29 17:21:59 -05:00
OJ af4b1cf48f
Add the `sess` command to MSF and Meterp shells
This new command is a simpler shortcut that allows for moving around sessions much faster from within the console.

* From inside MSF, `sess <id>` is shorthand for `sessions -i <id>`
* From inside Meterp, `sess <id>` is shorthand for `background; sessions -i <id>`

In the latter case, if the session being switched to is the same id, then no swiching happens.
2016-09-22 16:09:59 +10:00
Brent Cook 52d0840a79
Land #7276, fix clipboard tlv usage 2016-09-22 00:47:18 -05:00
Brent Cook 022ab74f30
See #7089, add some stray fixups 2016-09-15 18:50:00 -05:00
Brent Cook 6686e91ffe
fixup some leftover debug and whitespace issues 2016-09-15 18:39:08 -05:00
Brent Cook 50fc3b10f8
Land #7086, Add 'continue' and 'tries' wget-like options to meterpreter 'download' 2016-09-15 17:48:21 -05:00
David Maloney 43942e6029 refactor pem parser to use the rex-socket gem version
use rex-socket's pem aprser instead of the old one we used
to have in rex::parser

MS-1715
2016-09-07 11:38:27 -05:00
OJ ab6ffcc725
Add tspkg support and fix parsing a little 2016-09-07 02:04:54 +10:00
OJ dd977c0c28
Begin work on parsing mimikatz output and handling more cmds 2016-09-07 01:41:35 +10:00
Tim f75b5569e5
fix android clipboard tlv usage 2016-09-05 17:24:32 +01:00
Danil Bazin bfabb3877c @void-in suggestions styles 2016-08-31 14:00:35 +02:00
Danil Bazin 39407dda95 Winpmem meterpreter extension 2016-08-31 11:46:15 +02:00
caye efdf7c4c00
Clipboard now sets 'recursive' download option in new way. Improved download_file compatibility 2016-08-27 01:44:04 +00:00
caye 3545c5f8db
Rebase after #7125. Changed tries to -l. Added 'opts' for all download options 2016-08-27 00:55:16 +00:00
David Maloney 95b82219a3
Land #7233, ssh over L# pivot
this lands egypt's fix for using Net::SSH over L# pivots
2016-08-23 14:12:54 -05:00
James Lee bcf0062d47
Make SocketInterface things be Rex::Sockets 2016-08-22 14:17:00 -05:00
William Vu 3d4d7aae14 Add ps -c to show child processes of current shell 2016-08-18 19:23:21 -05:00
David Maloney eb73a6914d
replace old rex::ui::text::table refs
everywhere we called the class we have now rewritten it
to use the new namespace

MS-1875
2016-08-10 13:30:09 -05:00
OJ f9a7d34089
Initial work to support the new kiwi extension 2016-08-02 19:12:24 +10:00
William Vu 4c12c2f6c5 Improve Meterpreter ps -A experience
This allows us to use "x64" instead of "x86_64" in ps -A.
2016-07-31 17:19:57 -07:00
Brent Cook 3987c2c0d8 cache sysinfo (we use it a lot, it will not change) 2016-07-27 08:49:19 -05:00
Brent Cook 9cb4880747 allow process architecture to be a string (allow more than x86) 2016-07-27 08:49:19 -05:00
William Vu bebff786b7 Add timestamping to downloaded files 2016-07-25 17:18:27 -05:00
caye ed8fec255e
Fixed dir download. Retry when no network even at the download start 2016-07-12 23:05:50 +00:00
caye a6e92034bf
Added glob to dir_files.entries search - thanks @OJ 2016-07-11 06:22:28 +00:00
caye 3c2f0e814e
'Continue' and 'tries' wget-like options for meterpreter 'download' 2016-07-10 16:24:36 +00:00
David Maloney 6072697126
continued 2016-06-22 14:54:00 -05:00
OJ 60f81a69ea Remove the pfservice close call on shutdown 2016-05-03 12:03:37 +10:00
OJ d136844d3b Add error handling around double-bind of ports 2016-05-03 10:42:41 +10:00
OJ c15a2e8787
Merge branch 'upstream/master' into reverse-port-forward
Signed-off-by: OJ <oj@buffered.io>
2016-04-26 09:48:40 +10:00
Brent Cook 12a47b7fab prefer && 2016-04-24 11:56:32 -04:00
Brent Cook 194a84c793 Modify stdapi so it also uses exist? over exists? for ruby parity
Also add an alias for backward compatibility.
2016-04-23 17:31:22 -04:00
William Vu 7f8491149f Fix minor whitespace issues 2016-04-22 17:18:10 -05:00
OJ 540409e735 Add `resolve` to the meterpreter command line
I'm aware that this already exists as a post module, but there's nothing more annoying than having to bail out of Meterpreter, use the right module, set up the host list, etc all to just fire off a one-liner.

So this commit adds the command directly to Meterpreter's command line so that you don't have to do all that. This doesn't support specifying a file with the hosts in it (the post module does that). This is intended for quick resolution of particular hosts quickly.
2016-04-22 13:21:19 +10:00
Brent Cook 57ab974737 File.exists? must die 2016-04-21 00:47:07 -04:00
OJ b95267997d Fix LURI support for stageless, transport add/change and code tidies 2016-04-18 08:24:41 -05:00
OJ 5c2e5398ad Fix issue with flushing rev port forwards 2016-04-11 10:41:12 +10:00
OJ 866cb5a23b Fix usage of lport/rport while tracking rev forwards 2016-04-06 16:36:41 +10:00
OJ 6d504316ae Add MSF-side support for reverse port forwards
This includes changes to the portfwd command so that the output is
nicer, things are easier to use, and users have the ability to create
reverse port forwards.
2016-04-06 15:38:39 +10:00
Brent Cook 3d995546d9 check for true before empty string 2016-04-01 21:30:11 -05:00
OJ 2a9f813bcd Don't interpreter blank string as error 2016-04-01 09:53:25 +10:00
OJ 9f299f4f0c
Merge branch 'upstream/master' into powershell-meterpreter-bindings 2016-04-01 09:32:32 +10:00
James Lee 9d86a49c51
Land #6692, udp socket abstraction 2016-03-25 13:05:10 -05: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
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
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
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
Brent Cook df2d0f7826 Indicate that output options take parameters 2016-03-17 11:13:34 -05:00
Brent Cook 257c8f4058 handle a sqlite table being empty 2016-03-15 18:26:38 -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
Tim dfd51a7032 Merge branch 'master' into android_sqlite_read 2016-03-10 01:46:30 +00:00
Tim 5e83b2de51
remove extra new line 2016-03-07 23:17:45 +00:00
Tim f6c06bedfe
fix e.g output 2016-03-07 23:15:05 +00:00
William Vu 3e0f8d67c9 Use #strip to more correctly simulate #blank?
See f900d9cf26.
2016-03-07 13:14:37 -06:00
Brent Cook 289f43bb80
Land #4848, remove some reliance on rails libraries from rex 2016-03-07 07:38:30 -06:00