• Stars
    star
    301
  • Rank 138,451 (Top 3 %)
  • Language
    Swift
  • License
    BSD 3-Clause "New...
  • Created over 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A macOS enumeration tool inspired by harmjoy's Windows-based Seatbelt enumeration tool. Author: Cedric Owens

SwiftBelt

About

SwiftBelt is a macOS enumerator inspired by @harmjoy's Windows-based Seatbelt enumeration tool. SwiftBelt does not utilize any command line utilities and instead uses Swift code (leveraging the Cocoa Framework, Foundation libraries, OSAKit libraries, etc.) to perform system enumeration. This can be leveraged on the offensive side to perform enumeration once you gain access to a macOS host. I intentionally did not include any functions that cause pop-ups (ex: keychain enumeration).

Thanks Ramos04 for contributing code to look for various Objective See tools and mattreduce for contributing code for zshell history as well as azure creds.


Image

Steps

  1. Ensure swift is installed on your macOS host

  2. From a terminal cd into the SwiftBelt directory and run: "swift build" to generate the binary. The binary will be dropped in the .build/debug folder inside of the SwiftBelt folder and will be named SwiftBelt

  3. Copy to the desired host and clear the quarantine attribute ($ xattr -c SwiftBelt) and set as executable ($ chmod +x SwiftBelt)

  4. Execute

Help menu:

SwiftBelt Options:

-CheckFDA --> Check for Full Disk Access (without generating a TCC prompt to the user even if Terminal has not been granted any TCC permissions). Does this searching for TCC.db using Spotlight db API queries. Will return wither FDA has already been granted to your app context or not.

-SecurityTools --> Check for the presence of common macOS security tools (at least the ones I am familiar with)

-SystemInfo --> Check for the current execution context, TCC Accessibility access, basic system info, last boot time, idle time, info on whether the screen is currently locked or not, and environment variable info

-LockCheck --> Check for whether the screen is currently locked or not (I added this as a separate check as well as bundled it within SystemInfo)

-SearchCreds --> Search for ssh/aws/azure/gcloud creds

-Clipboard --> Dump clipboard contents

-RunningApps --> List all running apps

-ListUsers --> List local user accounts

-LaunchAgents --> List launch agents, launch daemons, and configuration profile files

-BrowserHistory --> Attempt to pull Safari, Firefox, Chrome, and Quarantine history (note as FYI: if Chrome or Firefox is actively running, the tool will not be able to read the locked database to extract info). However, the locked db can be copied elsewhere and read from.

-SlackExtract --> Check if Slack is present and if so read cookie, downloads, and workspaces info (leverages research done by Cody Thomas)

-ShellHistory --> Read shell (Bash or Zsh) history content

-Bookmarks --> Read Chrome saved bookmarks

-ChromeUsernames --> Read from ~/Library/Application Support/Google/Chrome/Default/Login Data which stores urls along with usernames for each

-UniversalAccessAuth --> Reads from /Library/Preferences/com.apple.universalaccessAuthWarning.plist to show a list of applications that the user has received authorization prompts for along with 1 (for accept) or 2 (for deny)

-StickieNotes --> Reads the contents of any open Stickie Note files on the system

-TextEditCheck --> Checks for unsaved TextEdit documents and attempts to read file contents

-JupyterCheck --> Checks for the presence of the ipython history db (which Jupyter notebook uses) and if found reads the contents (which includes python commands executed)

Usage:

To run all options:

./SwiftBelt

To specify certain options:

./SwiftBelt [option1] [option2] [option3]...

Example:

./SwiftBelt -SystemInfo -Clipboard -SecurityTools ...


Detection

Though this tool does not use any command line utilities (which are easy to detect), this tool does read from several files on the system which can be detected by any tools that leverage the Endpoint Security Framework (these file reads in particular are captured by ES_EVENT_TYPE_NOTIFY_OPEN events within ESF).

More Repositories

1

C2-JARM

A list of JARM hashes for different ssl implementations used by some C2/red team tools.
129
star
2

MacC2

python-based Mac Command and Control that uses internal API calls instead of command line utilities. Author: Cedric Owens
Python
128
star
3

MacShellSwift

Proof of concept MacOS post exploitation tool written in Swift. Designed as a POC for blue teams to build macOS detections. Author: Cedric Owens
Swift
113
star
4

Swift-Attack

Unit tests for blue teams to aid with building detections for some common macOS post exploitation methods.
Swift
101
star
5

EntitlementCheck

Scripts (python3 and Swift) for macOS to recursively check /Applications and also check /usr/local/bin, /usr/bin, and /usr/sbin for binaries with problematic/interesting entitlements. Also checks for hardened runtime enablement
Swift
90
star
6

Inject_Dylib

Swift code to programmatically perform dylib injection
Swift
49
star
7

Mod_Rewrite_Automation

Scripts to automate standing up apache2 with mod_rewrite in front of C2 servers.
Shell
47
star
8

Mythic-Macro-Generator

Python3 script to generate a macro to launch a Mythic payload. Author: Cedric Owens
Python
43
star
9

SwiftBelt-JXA

JXA implementation of some SwiftBelt functions. Author: Cedric Owens
JavaScript
42
star
10

Spotlight-Enum-Kit

JXA and swift code that can perform some macOS situational awareness without generating TCC prompts.
Swift
36
star
11

Persistent-Swift

A Swift port of some of the original PersistentJXA projects by D00MFist. Original PersistentJXA repo: https://github.com/D00MFist/PersistentJXA
Swift
31
star
12

EvilOSX_MacroGenerator

Python3 script to generate Office macros for the EvilOSX framework. Author: Cedric Owens
Python
26
star
13

JXA-Runner

Swift code to programmatically execute local or hosted JXA payloads from Terminal without using the on-disk osascript binary.
Swift
23
star
14

Presentations

Collection of Slides From My Conference Talks
21
star
15

aws_key_triage_tool

Script to automate initial triage/enumeration on a set of aws keys in an input file.
Python
20
star
16

aws-cli-notes

A combined list of helpful awscli commands from Scott Piper's flaws.cloud exercise as well as from Beau Bullock's Breaching the Cloud Training
19
star
17

Dump-Chrome-Cookies

Repo with a modified version of CookieBro and scripts to leverage it to dump Chrome cookies
JavaScript
19
star
18

Terraform_DigitalOcean_Scripts

Scripts to automate standing up C2 infra with firewall settings inside of DigitalOcean.
Shell
17
star
19

Helpful_aws-scripts

python3 scripts to help with aws triage needs
Python
17
star
20

JXA-RemoveQuarantine

JXA script based on research by Jeff Johnson on leveraging TextEdit to remove quarantine attributes on files. Jeff's original research is here: https://lapcatsoftware.com/articles/sandbox-escape.html
JavaScript
17
star
21

Dylib_Runner

Swift code to run a dylib on disk
Swift
16
star
22

C2_Cradle

Tool to download, install, and run macOS capable command & control servers (i.e., C2s with macOS payloads/clients) as docker containers from a list of options. This is helpful for automating C2 server setup.
Shell
16
star
23

docker-arsenal

Spins up a docker container with several useful tools for offensive security in macOS/cloud environments. Also installs the needed dependencies for each tool/utility during docker setup.
Dockerfile
16
star
24

keygrabber

Automation for grabbing keys from a Linux host. Useful during red team exercises to quickly help assess what access to a Linux host can lead to.
Python
16
star
25

Linode_Terraform_Scripts

Scripts to automate standing up hosts in Linode
Shell
15
star
26

macOS-browserhist-parser

Swift code to parse the quarantine history database, Chrome history database, Safari history database, and Firefox history database on macOS.
Swift
14
star
27

SimpleC2_Server

POC for a basic C2 server using the python aiohttp framework
Python
12
star
28

HELK-automation

Scripts to automate HELK server standup in Digital Ocean and filebeat on macOS to help automation of sending endpoint security logs from macOS hosts into HELK for building detections content
Shell
12
star
29

Gitlab-Searcher

python3 script that pulls gitlab data of interest using a gitlab personal access token
Python
12
star
30

Add-To-TCC-DB

A JXA script that leverages sqlite3 API calls to add items to the user's TCC database at: ~/Library/Application Support/com.apple.TCC/TCC.db
JavaScript
11
star
31

Rolling_Op_Metrics

Skeleton spreadsheet to track rolling red team operation metrics.
11
star
32

ioreg-and-sysctl-examples

Examples of programmatically interacting with ioreg and sysctl to query system info
Swift
9
star
33

Jenkins_Hunter_CSharp

C# implementation of my original Jenkins Hunter script (orig in python). It uses threading to search for unauthenticated Jenkins instances on ports 8080, 80, and 443. Author: Cedric Owens
C#
9
star
34

JXA-Firefox

JXA Scripts for extracting data from Firefox
JavaScript
8
star
35

zshrc-persist-JXA

JXA script to add a macho binary to ~/.zshrc for persistence
JavaScript
8
star
36

PICT-Swift

A Swift (and slightly modified) version of Thomas Reed's PICT (Post Infection Collection Toolkit)
Swift
8
star
37

GoBelt

Golang programmatically invoking my SwiftBelt-JXA macOS system enumerator project (Golang running SwiftBelt-JXA via cgo)
Go
8
star
38

AV_Enum_JXA

JXA code to enumerate security software on a macOS host
JavaScript
7
star
39

LocalAdminChecker

Threaded C# code that uses wmic to quickly check a host's /24 subnet for other hosts the current user has local admin access to. Author: Cedric Owens
C#
7
star
40

SSH-Password-Sprayer

python3 script to spray a username and password against a network range. Author: Cedric Owens
Python
7
star
41

okta-sprayer

Python3 Script to perform a password spray against an okta instance
Python
6
star
42

Metadata_URLs

List of some cloud metadata URLs that return interesting info
6
star
43

dns-TXT-exfil-test

Simple client/server in golang to help with testing data exfil detections over DNS TXT records
Go
5
star
44

find_chrome_tab

For those of us with too many Chrome tabs open on macOS 😳...this is a simple applescript to search all tab titles and urls across all Chrome browser windows for a match string and if found it sets that as the active tab. 😎
5
star
45

kube-unauth-exec-hunter

Python3 script to check a subnet range for kubernetes nodes allowing system:anonymous API command access. Author: Cedric Owens
Python
5
star
46

PhishDifficultyScorer

python3 script that rates the difficulty of a given phishing exercise. Author: Cedric Owens
Python
5
star
47

gitleaks-wrapper

Simple wrapper around gitleaks to enumerate publicly facing repos belonging to an org and then run gitleaks against each in search of exposed secrets/keys.
Python
5
star
48

JAMF_Runner

A wrapper around the on disk jamf binary (for JAMF managed macOS hosts). Useful for unit testing detections of offensive jamf host-based commands.
Swift
5
star
49

JenkinsHunter

python3 script that searches a network range for instances of unauthenticated Jenkins hosts. Author: Cedric Owens
Python
4
star
50

dns-exfil-test

Go
4
star
51

chromedp-remotedebugger-example

An example of how to use chromedp to run Chrome headless with the remote debugger port programmatically (is still a wrapper around the Chrome binary)
Go
4
star
52

SituationalAwarenessTool

C# tool that uses .net to provide situational awareness on a Windows host.
C#
4
star
53

modified-tcc-clickjack

modified version of Ron Masas's TCC-Clickjack Swift project
Swift
3
star
54

Page-Finder

python3 script that searches a network range for hosts hosting interesting pages that an attacker can leverage. Author: Cedric Owens
Python
3
star
55

pritunl-vpn-setup-automation

Bash + terraform scripts to automate standing up pritunl VPN servers.
Shell
2
star
56

AD-Threaded-Port-Sweeper

C# Code to dump all AD computers and then quickly sweep for a given port.
C#
2
star
57

DGA-test

simple code to help with DGA nxdomain response testing
Go
1
star
58

http-uri-test

Go
1
star
59

SlackXtract

Swift code to extract available slack information from macOS hosts. Automates steps identified in Cody Thomas' post: https://posts.specterops.io/abusing-slack-for-offensive-operations-2343237b9282
Swift
1
star