1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00
Commit Graph

1418 Commits

Author SHA1 Message Date
OJ
e6441ad2fa
Remove DLL exports from Meterpreter
Add support for loading RDI-related stuff using ordinals instead of
function names. Remove exports from the extensions/etc. This is another
step in the direction to make the DLLs less obvious.

Extensions no longer have their own name in the library metadata.
They're all "extension.dll". Metsrv is now "server.dll" and the two
non-extensions are "plugin.dll". I was going for something a little less
obvious.

This required changes to the RDI functionality.
2020-06-25 10:28:36 +10:00
OJ
d9629c46d9
Point to new changes in RDI submodule 2020-06-23 08:19:53 +10:00
OJ
aec49a7863
Final tidy up 2020-06-22 08:25:51 +10:00
OJ
ab36130546
Fix Release build def files 2020-06-22 08:25:49 +10:00
OJ
c9ca614313
Remove DLL exports from Meterpreter
Add support for loading RDI-related stuff using ordinals instead of
function names. Remove exports from the extensions/etc. This is another
step in the direction to make the DLLs less obvious.

Extensions no longer have their own name in the library metadata.
They're all "extension.dll". Metsrv is now "server.dll" and the two
non-extensions are "plugin.dll". I was going for something a little less
obvious.

This required changes to the RDI functionality.
2020-06-22 08:25:30 +10:00
Spencer McIntyre
c8312f9c73
Land #397, Change from PEM to DER for crypt TLV negotiation 2020-06-18 13:54:31 -04:00
OJ
45624d2389
Fix config generation for migration 2020-06-18 09:15:50 +10:00
OJ
c5f8f893ac
Remove the mimikatz extension
Also turn off PDB generation for the sniffer extension.
2020-06-11 08:34:17 +10:00
OJ
6419fa9e40
Fix buffer meta type values, typos and function calls 2020-06-09 10:57:44 +10:00
OJ
30f232a7fd
Adjust TLV types and fix up code to deal with new raw api 2020-06-09 10:57:44 +10:00
OJ
5fc2117325
Adjust the tlv raw function and remove some unnecessary headers 2020-06-09 10:57:43 +10:00
OJ
5c959187ea
Support pub key in DER instead of PEM
Easy change on the Windows side, we just needed to remove the code that
converts PEM to DER and off we go.
2020-06-09 10:54:28 +10:00
OJ
e9e5894eca
Updated powershell extension binding IDs 2020-05-08 17:17:25 +10:00
OJ
fad9548108
Adjust the extension and command identifiers (windows) 2020-05-04 14:04:34 +10:00
OJ
6163be1142
Updated powershell extension with appropriate command map 2020-05-01 15:41:31 +10:00
OJ
3f574e3521
Implement extendion IDs and refactor command enum
Enumeration of commands was a bit of a hack, and still resultsed in
strings (like "stdapi") to appear in binaries, and also meant that
extensions needed to identify themselves.

This code changes the way this works. Extensions no longer have a name.
Instead they have an internal ID tha maps to the command sets they
support. To enumerate extension commands, MSF will ask for a range of
commands, and if any command IDs fit within that range, they'll be
returned.

This moves us towards a nicer way of handling things across all the
meterpreters.
2020-05-01 15:36:07 +10:00
OJ
c7f7bc2fc0
Remove method strings from TLV packets
We now use ints, and hopefully this means we don't have as much obvious
stuff in the binaries!

```
$ # Before:
$ strings metsrv.x86.dll | grep core_ | wc -l
46
$ # After:
$ strings metsrv.x86.dll | grep core_ | wc -l
0
```
Big win, and it's even bigger for the likes of stdapi.

Had to fix a bunch of other stuff along the way, including a subtle
issue with the Powershell Meterp bindings.
2020-04-28 23:41:06 +10:00
OJ
e0645a8d39
Include comsuppw change for mimikatz
This was required to support upstream changes that cause clean builds
for mimikatz now.
2020-04-24 13:40:19 +10:00
OJ
4f8544cfca
Slight make tweak and removal of some verbose debug stuff 2020-04-24 13:31:34 +10:00
OJ
f54c8e2ccb
Make script tweaks, adjustments to doxygen config 2020-04-24 13:31:34 +10:00
OJ
3dbff1e401
Clean and working builds with CMake 2020-04-24 13:31:34 +10:00
OJ
0e9a231e8a
First pass of CMake support (MSVC specific ATM)
This commit includes a bunch of changes that are working towards being
able to build the Meterpreter source from CMake. Changes include:

* Updated `make.bat` which does the stuff that we need.
* Removed a bunch of stuff from the python extension source tree so that
  CMake generator would not include them.
* Moved a few things around in the priv extension.
* Created `CMakeFileLists.txt` for all the projects.

There are a few hacks required in things like stdapi and kiwi to ignore
files that are on disk but shouldn't be included in the build.

Initial testing indicates that sessions run, extensions load, but some
things don't work as intended. It's a start! Still much to do.
2020-04-24 13:31:16 +10:00
OJ
57eda40fc7
Fix mimikatz to build clean again
I am sad. Like.. really sad. I'm sad for so many reasons. For nearly
7 years I've worked on this god forsaken source, and for many of those
7 years I have had the ext_server_mimikatz project configured to have
warning level 3, and warnings as errors. While making changes to the
build systems in the last week or so, I've even rebuilt this on updated
toolsets on multiple platforms.

Despite all this, one thing slipped through the cracks. I have NO idea
why this warning wasn't shown in th past. Also.. how did this ever
work!? Why is it that it's only rearing its ugly head now? I honestly
don't know. Based on the code that I've had to fix in this PR, there's
no reason why this should build without warnings on any machine. Yet, it
does. It builds clean on my Windows 10 desktop with VS2013/2017/2019.
Same on most of my other virtual machines. For some reason it only
failed on this one VM after I had to fight to reproduce it when Brent
hand an issue.

The issue here was that a `string` type was being constructed from an
iterator over a `wstring` type, and hence there was an implicit
character conversion from `wchar_t` to `char`. This SHOULD be a warning,
because clearly that's not a good thing. BUT HERE WE ARE.

Anyway, we're proxying via the `_bstr_t` type now to avoid having to do
horrible manual character conversions. Given that we're in C++ land
already there's no point in working any harder. Also, this extension is
probably going to go away soon anyway, so a temporary fix that does the
job is good enough.

RIP my morning. I won't be getting that back.
2020-04-24 12:35:40 +10:00
OJ
f5313a91d0
Remove __declspec(dllexport) from the Init function in metsrv 2020-04-23 01:37:51 +10:00
OJ
24e6067b51
Update RDI, remove metsrv references/libs from extensions 2020-04-22 13:13:56 +10:00
OJ
64f6062d8b
Remove unused crap from espia
The video and audio capture things didn't do anything other than leave
artifacts on disk. So this commit removes the code that does that,
resulting in just one feature being available for this extension. Might
be worth ditching it entirely?
2020-04-22 13:06:49 +10:00
OJ
eb81e43b03
Remove the common vcxproj and all references to it 2020-04-22 13:06:49 +10:00
OJ
3a3e77942b
Fix small issue with calling convensions in x86 2020-04-22 13:06:49 +10:00
OJ
c8aa435b3c
Finally removed delay loading from the last extension: extapi 2020-04-22 13:06:49 +10:00
OJ
4cd3a29319
Remove delay loading from the kiwi extension 2020-04-22 13:06:48 +10:00
OJ
f4f6bb01d8
Remove delay loading from mimikatz 2020-04-22 13:06:48 +10:00
OJ
472a6b1f9e
Move incognito to no more delay loading 2020-04-22 13:06:48 +10:00
OJ
86a4763164
Update powershell extension to avoid delay loading 2020-04-22 13:06:48 +10:00
OJ
05d5a16fe5
Get the python extension working without delay loading 2020-04-22 13:06:47 +10:00
OJ
ce8544bd2d
Move sniffer over to metserv api 2020-04-22 13:06:47 +10:00
OJ
8565f9967e
Update lanattacks to not use delay loading of metsrv 2020-04-22 13:06:47 +10:00
OJ
f7b50df020
Update peinjectory to avoid delay loading
Also added the GetExtensionName function.
2020-04-22 13:06:47 +10:00
OJ
136a58a194
Clean comments & update winpmem to avoid delay loading
Also, added the "GetExtensionName" functions to winpmum and unhook
2020-04-22 13:06:46 +10:00
OJ
9ca881235e
Change unhook extension to remove delay loading of metsrv 2020-04-22 13:06:46 +10:00
OJ
cd18f98caf
Make espia work without delay loading metsrv 2020-04-22 13:06:46 +10:00
OJ
4ffe127f04
Begin removing the delay-load dependency
The 'common' library has been removed. The only project that actually
used it was metsrv, so the code that metsrv required from common is now
directly compiled in as part of that project.

The common folder now contains files that are importanta cross all of
the projects, with a primary focus on the new "API" style function. What
this means is that MetSrv has an API that it exposes through a function
pointer that is passed to the extension when it's initialised. This
pointer references a structure with all the API functions wired in. This
means that:

* Extensions don't need to know anything about metsrv at compile time.
* The delay loading code can be removed, which was one of the last
  instances of "metsrv.dll" as a string.
* Metsrv.dll no longer exports any functions.

More to come.
2020-04-22 13:06:40 +10:00
OJ
1fb386c93b
Remove metcli and bare extension projects 2020-04-22 13:01:26 +10:00
OJ
fef2c54b91
Change README to point to existing Choco package for VS2013 2020-04-22 07:17:10 +10:00
OJ
fda53ff14b
Update readme to reference vsconfig files 2020-04-21 20:18:04 +10:00
OJ
429c5f4bd8
Add VS configurations to the source to make it easy to install tools 2020-04-21 19:57:57 +10:00
OJ
42e833c8fa
Update readme slightly 2020-04-21 19:24:23 +10:00
OJ
6df6bc9c56
Update install and build instructions in the README
This now shows how to install various VS versions correctly from
scratch.
2020-04-21 18:14:18 +10:00
OJ
5ab1d39776
Slight makefile tweak 2020-04-21 10:21:51 +10:00
OJ
23b7a7b9ad
Finalise support for building on all the toolsets. 2020-04-21 09:37:11 +10:00
OJ
f8154f8e04
Finalise support for VS2013/VS2017/VS2019 & v120_xp/v141_xp
These changes allow us to build across multiple toolsets and VS
versions.
2020-04-21 08:10:42 +10:00
OJ
74c9c79892
Enable multie-CPU builds
Added /MP for parallel builds, and removed precompiled headers as /Yc
isn't compat with /MP.

Not enabled for the Powershell extension because of it's .NET-ness.
2020-04-16 15:30:17 +10:00
OJ
dbe13941c3
Update mimikatz code to avoid warnings 2020-04-16 11:06:59 +10:00
OJ
124a3a7c0c
Updated deps to include new LibreSSL stuff 2020-04-16 10:59:21 +10:00
OJ
f27e09e85f
Update deps, remove unused folder 2020-04-15 14:32:01 +10:00
OJ
8f5d4bef01
Replace OpenSSL with LibreSSL in the Python extension
This was a bit of a pain, but was well worth it. Had to add a couple of
hacks to make it all work, but this is a nicer solution than having to
depend on OpenSSL and its horrendous build experience.
2020-04-15 13:43:50 +10:00
OJ
306e2f9399
Update the bare template 2020-04-14 20:13:02 +10:00
OJ
3809651b79
Fix a slight issue with the old Mimikatz extension 2020-04-14 14:42:10 +10:00
OJ
ef721b1f3c
Update make file and dependencies 2020-04-14 14:24:30 +10:00
OJ
1aea69806a
Update sniffer SDK libs 2020-04-14 14:09:12 +10:00
OJ
078a3e960f
Finalise 'Release' build for both x86 and x64 _clean_
Still need to fix dependencies and whatnot as well.
2020-04-14 13:18:25 +10:00
OJ
1a6bb89845
Update to build against new libs, remove hacks to make things work 2020-04-14 12:40:02 +10:00
OJ
443bfca952
Update JPEG lib to build with VS2019 toolset 141_xp 2020-04-14 12:29:59 +10:00
OJ
712268fab7
Get Python extension building clean
Warnings as errors, builds clean. Had to do some horrible hacks:
1) Include custom implementation of a lib function just so we could
   link against stuff built with older VS.
2) Include legacy symbols for old io for the same reason.
2020-04-14 12:13:30 +10:00
OJ
100ffd6d5b
First round of VS2019 changes 2020-04-14 10:28:08 +10:00
Brent Cook
2e9943af8d
Land #385, enhance Windows extapi support for window enumeration
Merge remote-tracking branch 'upstream/pr/385' into upstream-master
2020-04-08 06:04:41 -05:00
Brent Cook
49b117838a
Land #384, don't modify stageless config block in place 2020-04-07 17:15:33 -05:00
Brent Cook
bf8950ebe9 remove unneeded checks before free, one being an impossible scenario 2020-04-07 17:15:03 -05:00
cn-kali-team
6d7740cc72 Process Unicode support 2020-04-05 11:53:22 +08:00
cn-kali-team
451a094269 Process Unicode support 2020-04-05 11:53:16 +08:00
cn-kali-team
25f770dcb3 Process Unicode support 2020-04-05 11:53:06 +08:00
cn-kali-team
a8df9b3604 Process Unicode support 2020-04-05 11:52:08 +08:00
bwatters
903620268f
Land #377, Reducing permissions requested for sys_steal_token
Merge branch 'land-377' into upstream-master
2020-04-02 08:37:42 -05:00
cn-kali-team
348aa69f68 Add window class name filter,Unicode Support etc. 2020-03-27 22:12:37 +08:00
cn-kali-team
443b6f2f23 add window class name filter 2020-03-27 22:12:04 +08:00
OJ
8b4d65de47
Fix stageless config block memory protection
I found an edge case where stageless payloads did not work when they
were embedded in .NET applications. The reason for this is because the
configuration block is stored alongside the code in stageless payloads
and hence is loaded into memory as part of the section when it's mapped.
This section, in native world, remains RWX, and hence we don't have a
problem reading from and writing to it. We write to it for various
reasons, such as when the session guid changes.

In .NET land, this section is mapped as RX instead of RWX. This means
that when we try to write to it, the program segfaults due to an access
violation.

This code modifies the loading of the configuration so that instead of
maintaining a pointer to the original configuration, it instead creates
a copy of it on the heap. I preferred this fix over marking the memory
as RWX, which obviously stands out a bit more.
2020-03-17 13:15:31 +10:00
Spencer McIntyre
03ddbd773e Send addrinfo when opening a channel in Windows 2020-02-24 18:40:12 -05:00
Justin Bui
bad3ef7df4
Update config.c
Reduced permissions from ALL_ACCESS to the minimum access needed.
2020-02-12 20:18:18 -08:00
Francesco Soncina
b35cc0ac70
add support for PPID spoofing
fix #373
2019-12-17 00:57:49 +01:00
Brent Cook
363a90be11
Land #370, update kiwi to latest mimikatz release 2019-12-06 09:34:15 -06:00
Brent Cook
c3624d73b2 bump to kiwi 2.2.0-20191125 2019-12-06 09:28:19 -06:00
Brent Cook
188fef721e
Land #366, fix unhook extension logic around clr.dll 2019-12-05 17:02:55 -06:00
Brent Cook
03491bfa9b
Land #361, add hidpi and multi-desktop support to espia screengrab extension 2019-12-05 16:51:39 -06:00
Brent Cook
81a4d8ad96
Land #360, fix crypt key memory leak 2019-12-05 16:50:29 -06:00
OJ
d2f7bfd420
Update to kiwi 2.2.0-20190813 2019-11-17 13:14:07 +10:00
Francesco Soncina
b527e76abd
fix: syntax error 2019-11-07 17:19:16 +01:00
Francesco Soncina
e386835042
fix: exclude clr.dll from being unhooked
see https://github.com/rapid7/metasploit-framework/issues/12549
2019-11-07 17:11:02 +01:00
Tim W
a74dedca56 fix espia screenshot 2019-10-22 23:51:21 +08:00
max3raza
71762fe778 fix for memory leak 2019-09-09 22:20:17 +03:00
plowsec
389e71df32 Fix address truncation occurring in x64 Windows processes. 2019-09-06 14:50:13 +02:00
bwatters
f6808dde30
Land #352, add windows keyevent api
Merge branch 'land-352' into upstream-master
2019-09-03 16:39:51 -05:00
Tim W
6253af16c8 use MapVirtualKey 2019-07-31 13:16:28 +08:00
bwatters
db171fb83a
Those should be usigned ints, not unsigned longs. 2019-07-23 10:21:21 -05:00
bwatters
509c1936a3
Update OS names to be more generic in kernel versions 10.0.x 2019-07-23 08:17:06 -05:00
Tim W
d95d827c8e add windows mouse doubleclick 2019-06-20 15:26:07 +08:00
Tim W
ab53c872fa fix windows move and click 2019-06-19 12:42:11 +08:00
Tim W
a29110ca5c add windows keyevent api 2019-06-17 12:36:55 +08:00
Brent Cook
dfb79b11cd
Land #343, update ReflectiveDLLInjection subproject 2019-06-01 19:53:13 -05:00
Tim W
48171ecc48 fix crash in keyboard_send on windows 2019-05-31 06:55:02 +08:00
Tim W
d2e9834ed0 update ReflectiveDLLInjection subproject 2019-05-16 14:04:23 +08:00
Tim W
16213667b7 add mouse api for windows 2019-05-13 02:32:27 +08:00