Enterprise-Grade macOS Security Hardening, Baseline Drift & Audit Engine
Zero dependencies β’ Pure native Zsh/Bash β’ 54 CIS/NIST security controls β’ OASIS SARIF v2.1.0 β’ Liquid Glass HTML5
Live terminal audit across all 4 security domains, weighted Hardening Index, category posture breakdown, high-priority remediation actions, and instant single-file Liquid Glass HTML5 report export. Pure native Zsh execution with zero external dependencies.
macharden is an enterprise-grade security audit, posture assessment, and automated hardening scanner engineered specifically for macOS (macOS 12 Monterey through macOS 15 Sequoia and macOS 26/27+, natively supporting both Apple Silicon and Intel architectures).
Unlike generic Unix scanners that treat macOS as a generic BSD derivative, macharden deeply inspects Apple's proprietary security subsystems:
- System Integrity Protection (SIP) & Authenticated Root (
csrutil) - FileVault 2 XTS-AES disk encryption (
fdesetup) - Gatekeeper code signing and notarization assessments (
spctl) - Application Firewall configuration, stealth mode & interpreter exceptions (
socketfilterfw) - OpenBSM Auditing & ACL immutability: Audit daemon status (
com.apple.auditd),/etc/security/audit_controlpermissions, and/var/auditdirectory & trail ACL stripping (CIS 3.1β3.5 / NIST AU-9 / NIST mSCP) - Keychain inactivity lock timeouts & core dump restrictions
- BPF raw packet capture permissions (
/dev/bpf*andaccess_bpfgroup) - LaunchAgents & LaunchDaemons binary integrity & signature verification
- Secrets scanning: Plaintext API tokens in shell startup profiles (
~/.zshrc,~/.bashrc), shell history (.zsh_history), exposed.envfiles, and cloud credential stores (~/.aws/credentials,~/.kube/config,~/.docker/config.json) - Privilege escalation & persistence: Insecure
$PATHhijacking vectors, sudoersNOPASSWDentries, login items, cron jobs, periodic scripts, and SSHauthorized_keysbackdoors
| Capability | Description |
|---|---|
| β‘ Zero Dependencies | Written in pure, native Zsh/Bash. Requires no Homebrew, Python libraries, Ruby, Gems, or Node.js runtimes. |
| π― 54 Audited Controls | Comprehensive security coverage across 4 domains: System Hardening (21), Network (12), Secrets (11), and Persistence (10). |
| π Hardening Index (0β100%) | Objective, mathematically weighted scoring formula with letter grades (A+ to F) and category-level posture bars. |
| π Baseline Drift & Diff Engine | Historical security tracking (--diff <baseline.json>). Detects regressions and security posture decay between scans. |
| πͺ CI/CD Quality Gate | Seamless DevSecOps integration via --fail-on-regression (exit code 2) and --min-score <N> (exit code 1). |
| π‘οΈ OASIS SARIF v2.1.0 | Native integration with GitHub Advanced Security (Code Scanning tab), GitLab SAST, DefectDojo, and SIEM pipelines. |
| π Liquid Glass HTML5 Dashboard | Standalone, single-file interactive dashboard with zero external CDN dependencies, search, filters, and Dark/Light modes. |
| π Bilingual (EN / TR) | Complete native English and Turkish language support across Terminal, HTML dashboard, Markdown reports, and SARIF tags. |
| π§ Risk-Aware Remediation | Only explicitly typed [EXEC] actions can run; [GUIDE] items stay manual. Includes interactive remediation (--fix), dry-run preview, executable playbooks, and rollback. |
| ποΈ Tailored Baselines | Lynis-style profiles support skipped controls plus mSCP-style organization-defined values (ODVs), so user-impacting policy is never silently imposed. |
| π Regulatory Compliance | Direct control mapping to CIS Apple macOS Benchmark, NIST SP 800-53 Rev 5, and MITRE ATT&CK Matrix for macOS. |
Security engineers and Mac administrators often ask why they should choose macharden over generic Unix scanners or heavyweight compliance suites:
| Feature / Capability | π‘οΈ macharden | Lynis | Apple mSCP | CIS-CAT Pro |
|---|---|---|---|---|
| Runtime Dependencies | Zero (Native Zsh/Bash) | Python / Perl plugins | Python, Ruby, Git | Java Runtime (JRE 11+) |
| macOS First & Architecture | macOS 12β15+ (Apple Silicon & Intel) | Linux-first (generic BSD checks) | macOS only | Cross-platform |
| Native Security Subsystems | Deep (SIP, FileVault, BPF, OpenBSM, Launchd) | Basic Unix file permissions | MDM Configuration Profiles | Benchmark XML rules |
| Interactive HTML5 Dashboard | Yes (Liquid Glass, 0 CDN, Dark/Light) | No (Text / Paid Enterprise) | No (Static AsciiDoc/HTML) | Basic HTML table |
| GitHub Security SARIF v2.1.0 | Native out-of-the-box | Third-party converters | No | Commercial add-on |
| Historical Drift & CI/CD Gate | Built-in (--diff, --fail-on-regression) |
Manual log comparisons | No | Enterprise server |
| Remediation & Rollback | Yes (--fix, --dry-run, --undo) |
Suggestion text only | Script generation (MDM) | Bash scripts (often risky) |
| Multi-Language Support | English & Turkish (Native i18n) | English only | English only | English only |
| Execution Speed | Sub-second (~0.8s for 54 controls) | 10β30 seconds | Minutes (profile compile) | 2β5 minutes |
| Licensing | MIT (100% Free & Open Source) | GPLv3 / Enterprise Paywall | Public Domain | Commercial / Paid CIS Membership |
Generate an interactive, single-file HTML5 security dashboard with zero external CDN links, zero web fonts, and zero tracking:
macharden -f html -o report.html && open report.html- Interactive Filtering: Filter findings in real time by Domain (Hardening, Network, Secrets, Persistence), Status (Pass, Warn, Fail), Severity (Critical, High, Medium, Low), or Regulatory Framework (CIS, NIST, MITRE).
- Keyboard Shortcuts:
/: Instant search bar focusL: Instant language toggle (English β Turkish) without page reloadT: Theme toggle (Dark Glass β Light Mode)Esc: Close modals / clear search
- Remediation Playbook Modal: In-browser interactive drawer displaying the exact shell commands needed to remediate findings, with one-click copy and script download.
- Export Actions: Export directly from the browser to Markdown, JSON, OASIS SARIF, or Print-optimized PDF.
brew install jankesec/tap/machardenRun an immediate, read-only security audit in your terminal without cloning:
curl -fsSL https://raw.githubusercontent.com/jankesec/macharden/main/bin/macharden | zsh# Clone repository
git clone https://github.com/jankesec/macharden.git
cd macharden
# Execute full 54-control security audit
./bin/macharden# Install binary, shell autocompletions (Zsh & Bash), and UNIX man page
make install
# Or install individual components:
make install-completions # Zsh (_macharden) & Bash autocompletions
make install-man # UNIX manual page (man macharden)(Installs binary to /usr/local/bin or ~/.local/bin, completions to Zsh/Bash site-functions, and manual page to share/man/man1/macharden.1)
Copy examples/macharden.prf and select values that match the Mac's role and threat model:
profile-name=Developer Workstation
machine-role=workstation
# Explicitly retain normal login-keychain behavior:
keychain-timeout=none
keychain-lock-on-sleep=no
# Or require a reviewed 15-minute policy (never auto-applied):
# keychain-timeout=900
# keychain-lock-on-sleep=yes
skip-test=HARD-08macharden --profile ./developer.prfKeychain timeout changes are guidance-only because they can cause recurring password prompts. The Keychain check evaluates the selected baseline while leaving this user-impacting choice to the operator.
- User Guide β installation, first audit, profiles, reports, remediation review, drift detection, scheduled scans, privacy, and troubleshooting.
- Architecture β runtime flow, scoring model, trust boundaries, remediation contract, and upstream reference provenance.
- Manual Page β complete command and option reference for
man macharden. - Changelog β release history and notable security, privacy, and usability changes.
Prevent security regressions across developer laptops and macOS CI runners with historical baseline tracking:
# 1. Establish an initial baseline snapshot on a hardened system:
macharden -f json -o baseline.json
# 2. Run future scans and inspect drift deltas:
macharden --diff baseline.json
# 3. Enforce CI/CD security gate (fails with exit code 2 if security degrades):
macharden --diff baseline.json --fail-on-regression======================================================================
BASELINE DRIFT & SECURITY DIFF
======================================================================
Baseline Scan : 2026-09-01 10:00:00 UTC (Host: macos-workstation)
Current Scan : 2026-09-12 12:00:00 UTC (Host: macos-workstation)
Baseline Score: 85.0% (B+)
Current Score : 79.5% (C+)
Score Drift : -5.5% [βΌ REGRESSED]
Regressions : 2 new failing/warning check(s)
Remediations : 1 previously failed check(s) resolved
βΆ Security Regressions (Action Required):
[FAIL] HARD-02 FileVault Full Disk Encryption (was PASS)
[WARN] NET-03 Firewall Permissive Exceptions (was PASS)
βΆ Remediated Checks (Resolved):
[PASS] SEC-01 Plaintext API Keys in Shell Profiles (was FAIL)
Add macharden to your repository's .github/workflows/security.yml to automatically audit macOS runner environments and upload findings to the GitHub Security tab:
name: macOS Security Hardening Audit
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 * * 1' # Weekly scan
jobs:
audit:
name: Audit macOS Security Posture
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install macharden
run: |
git clone https://github.com/jankesec/macharden.git ~/.macharden-tool
echo "$HOME/.macharden-tool/bin" >> $GITHUB_PATH
- name: Run macharden Audit Scan
run: |
macharden -f sarif -o macharden-results.sarif -q || true
- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: macharden-results.sarif
category: macharden-macosGenerate rich, purpose-built reports for security engineers, executive leadership, and automated pipelines:
# Liquid Glass HTML5 Dashboard (zero CDN dependencies, bilingual with 'L' key):
macharden -f html -o report.html && open report.html
# OASIS SARIF v2.1.0 for GitHub Code Scanning / Advanced Security:
macharden -f sarif -o report.sarif
# GitHub-flavored Markdown for pull requests and issue trackers:
macharden -f markdown -o report.md
# Machine-readable JSON for SIEM / Splunk / Elastic ingestion:
macharden -f json -o report.jsonmacharden - macOS Security Hardening & Audit Scanner (v1.4.0)
Usage:
macharden [options]
Core Options:
-h, --help Display usage information and exit
-v, --version Print version information (v1.4.0)
-c, --category <name> Run category: hardening, network, secrets, persistence, all
-f, --format <format> Output format: term, markdown, json, html, sarif (default: term)
-o, --output <file> Save audit report to file (auto-detects format from extension)
-q, --quiet Minimal output, display executive summary only
-l, --lang <en|tr> Interface language (English or Turkish; default: en)
--no-color Disable ANSI terminal color output
Baseline & Quality Gates:
--diff <baseline.json> Compare audit against historical baseline snapshot
--fail-on-regression Exit with code 2 if security posture has regressed
--min-score <0-100> Exit with code 1 if Hardening Index is below threshold
--fail-on-warn Treat warnings as failures in exit status
Remediation & Safety:
--fix Interactively prompt and apply remediation fixes
--dry-run Preview remediation commands without executing them
--undo Rollback previous automated remediation actions
--generate-fix [file] Generate automated remediation shell script without applying
Filtering & Continuous Monitoring:
--skip-test <id>[,id...] Skip specific check IDs (e.g. --skip-test HARD-08,PERS-04)
--profile <file> Load skip-test configurations from profile
--compliance <framework> Filter report by regulatory framework (cis, nist, mitre, all)
--daemon-install [sched] Install background LaunchAgent (daily, weekly, monthly, on-login)
--daemon-uninstall Unload and remove background scan LaunchAgent
--daemon-status Inspect background daemon status and recent logs
--alert Trigger native macOS notification on critical findings
macharden evaluates 54 security controls mapped to authoritative benchmarks:
| Β Β Β Β CheckΒ IDΒ Β Β Β | Control Title | CIS Benchmark | NIST 800-53 | MITRE ATT&CK | Weight |
|---|---|---|---|---|---|
HARDβ01 |
System Integrity Protection (SIP) | CIS 5.1.2 | SI-7 | T1562.001 | 10 |
HARDβ02 |
FileVault 2 Full Disk Encryption | CIS 2.5.1 | SC-28 | T1552.001 | 10 |
HARDβ03 |
Gatekeeper Code Assessment Verification | CIS 5.2.1 | CM-6 | T1204.002 | 10 |
HARDβ04 |
Screen Saver Lock & Delay | CIS 2.3.1 | AC-11 | T1056.002 | 7 |
HARDβ05 |
Guest Account Status | CIS 5.7 | AC-2 | T1078.003 | 6 |
HARDβ06 |
Automatic Software Updates | CIS 1.2 | SI-2 | T1190 | 6 |
HARDβ07 |
Remote Sharing Services Attack Surface | CIS 2.2.1 | AC-3 | T1021.002 | 7 |
HARDβ08 |
Firmware Password / Recovery Lock | CIS 2.5.2 | IA-2 | T1542.001 | 8 |
HARDβ09 |
Secure Boot & Authenticated Root | CIS 5.1.1 | SI-7 | T1542.001 | 8 |
HARDβ10 |
Automatic Login Disabled | CIS 5.8 | IA-2 | T1078.003 | 6 |
HARDβ11 |
Bluetooth File Sharing Exposure | CIS 2.1.2 | AC-18 | T1011 | 5 |
HARDβ12 |
Home Directory Permissions ($HOME 700) |
CIS 5.1.4 | AC-6 | T1083 | 6 |
HARDβ13 |
Network Time Synchronization (NTP) | CIS 1.1 | AU-8 | T1070.006 | 5 |
HARDβ14 |
Built-in Malware Protection (XProtect/MRT) | CIS 2.4.1 | SI-3 | T1562.001 | 6 |
HARDβ15 |
USB Restricted Mode | CIS 2.4.4 | MP-7 | T1091 | 5 |
HARDβ16 |
Apple Diagnostic & Telemetry Sharing | CIS 2.6.1 | AU-12 | T1020 | 4 |
HARDβ17 |
AirDrop Discoverability Exposure | CIS 2.1.1 | AC-18 | T1011 | 6 |
HARDβ18 |
OpenBSM Security Auditing Daemon Status | CIS 3.1 | AU-12 | T1562.001 | 8 |
HARDβ19 |
Audit Control Configuration Ownership & Permissions | CIS 3.2 | AU-9 | T1565.001 | 7 |
HARDβ20 |
Audit Log Files & Directory ACL Immutability | CIS 3.5 | AU-9 | T1070 | 9 |
HARDβ21 |
Audit Trail Event Flags & Retention Policy | CIS 3.4 | AU-11 | T1562.001 | 6 |
| Β Β Β Β CheckΒ IDΒ Β Β Β | Control Title | CIS Benchmark | NIST 800-53 | MITRE ATT&CK | Weight |
|---|---|---|---|---|---|
NETβ01 |
Application Firewall Global State | CIS 2.4.2 | SC-7 | T1562.004 | 8 |
NETβ02 |
Firewall Stealth Mode | CIS 2.4.3 | SC-7 | T1046 | 5 |
NETβ03 |
Dangerous Firewall Interpreter Exceptions | CIS 2.4.2 | CM-7 | T1059.006 | 8 |
NETβ04 |
BPF Packet Capture Permissions (/dev/bpf*) |
CIS 5.1.5 | AC-6 | T1040 | 7 |
NETβ05 |
/etc/hosts Loopback Integrity |
CIS 5.1.3 | SC-20 | T1565.001 | 9 |
NETβ06 |
Listening Wildcard TCP Services (0.0.0.0) |
CIS 2.2.2 | SC-7 | T1043 | 6 |
NETβ07 |
AirDrop Radio Service State | CIS 2.1.1 | AC-18 | T1011 | 6 |
NETβ08 |
Internet Sharing & NAT Daemons | CIS 2.2.3 | AC-4 | T1090 | 7 |
NETβ09 |
Application Firewall Logging Mode | CIS 2.4.2 | AU-2 | T1562.004 | 4 |
NETβ10 |
IP Forwarding Routing Subsystem | CIS 2.2.4 | SC-7 | T1090 | 7 |
NETβ11 |
Promiscuous Network Interfaces | CIS 2.4.5 | AU-12 | T1040 | 6 |
NETβ12 |
Wi-Fi Open Network Auto-Join | CIS 2.1.3 | AC-18 | T1040 | 6 |
| Β Β Β Β CheckΒ IDΒ Β Β Β | Control Title | CIS Benchmark | NIST 800-53 | MITRE ATT&CK | Weight |
|---|---|---|---|---|---|
SECβ01 |
Plaintext API Keys in Shell Profiles | CIS 5.1.6 | IA-5 | T1552.001 | 9 |
SECβ02 |
Exposed World-Readable .env Files |
CIS 5.1.7 | SC-28 | T1552.001 | 6 |
SECβ03 |
Keychain Inactivity Lock Timeout | CIS 2.3.2 | AC-11 | T1555.001 | 5 |
SECβ04 |
Kernel Crash Core Dumps (kern.coredump) |
CIS 5.5 | SC-28 | T1005 | 5 |
SECβ05 |
SSH Keys and Config File Permissions | CIS 5.1.8 | AC-6 | T1552.004 | 7 |
SECβ06 |
Unencrypted SSH Private Keys | CIS 5.1.9 | IA-5 | T1552.004 | 8 |
SECβ07 |
Secrets Leaked in Shell History Files | CIS 5.1.10 | IA-5 | T1552.003 | 7 |
SECβ08 |
SSH Daemon Configuration Hardening | CIS 5.2.2 | AC-3 | T1021.004 | 7 |
SECβ09 |
Suspicious Shell History Symlink Targets | CIS 5.1.11 | SI-4 | T1070.003 | 5 |
SECβ10 |
Insecure & World-Writable $PATH Directories |
CIS 5.1.12 | CM-6 | T1574.007 | 7 |
SECβ11 |
Cloud & API Credentials Permissions (.aws, .kube, .docker) |
CIS 5.1.13 | AC-6 | T1552.001 | 8 |
| Β Β Β Β CheckΒ IDΒ Β Β Β | Control Title | CIS Benchmark | NIST 800-53 | MITRE ATT&CK | Weight |
|---|---|---|---|---|---|
PERSβ01 |
User & System LaunchAgents Integrity | CIS 5.3.1 | CM-6 | T1543.001 | 7 |
PERSβ02 |
System LaunchDaemons Review & Signature | CIS 5.3.2 | CM-6 | T1543.004 | 7 |
PERSβ03 |
Scheduled Cron Jobs Inspection | CIS 5.3.3 | CM-6 | T1053.003 | 6 |
PERSβ04 |
macOS Login Items Persistence | CIS 5.3.4 | CM-6 | T1547.015 | 5 |
PERSβ05 |
SSH authorized_keys Backdoor Audit |
CIS 5.3.5 | AC-3 | T1098.004 | 7 |
PERSβ06 |
Sudoers NOPASSWD Privilege Escalation |
CIS 5.4 | AC-6 | T1548.003 | 8 |
PERSβ07 |
Privileged Helper Tools Integrity | CIS 5.3.6 | SI-7 | T1543.004 | 6 |
PERSβ08 |
CUPS Printer Sharing Remote Vector | CIS 2.2.5 | CM-7 | T1021 | 5 |
PERSβ09 |
Sudo Authentication Ticket Timeout | CIS 5.4.1 | AC-11 | T1548.003 | 5 |
PERSβ10 |
Periodic Maintenance Scripts (/etc/periodic) |
CIS 5.3.7 | SI-4 | T1053.003 | 7 |
macharden/
βββ bin/
β βββ macharden # Unified CLI executable & scanner entrypoint
βββ lib/
β βββ audit_hardening.sh # 21 macOS system & kernel hardening checks
β βββ audit_network.sh # 12 network, socket & packet capture checks
β βββ audit_secrets.sh # 11 secret leak, cloud credential & PATH checks
β βββ audit_persistence.sh # 10 persistence, launchd & cron checks
β βββ compliance.sh # CIS, NIST, and MITRE posture calculators
β βββ diff.sh # Historical baseline drift & regression engine
β βββ engine.sh # Weighted scoring formula & check registry
β βββ i18n.sh # Localization runtime (English & Turkish)
β βββ monitor.sh # Continuous LaunchAgent daemon & alerting
β βββ remediate.sh # Remediation playbook, dry-run & rollback engine
β βββ report.sh # Terminal & Markdown executive report generators
β βββ report_html.sh # Liquid Glass single-file HTML5 dashboard
β βββ report_sarif.sh # OASIS SARIF v2.1.0 generator (GitHub Code Scanning)
β βββ ui.sh # ANSI terminal engine, progress bars & score boxes
βββ data/
β βββ compliance_mappings.json # 54 controls mapped to CIS, NIST, MITRE & docs
β βββ locales/
β βββ tr.json # Authentic Turkish cybersecurity terminology
βββ assets/
β βββ demo.gif # Privacy-safe terminal + dashboard demo
β βββ demo.tape # Reproducible VHS terminal capture source
β βββ dashboard.png # High-resolution HTML5 dashboard preview
βββ completions/
β βββ macharden.zsh # Native Zsh completion definition
β βββ macharden.bash # Native Bash completion definition
βββ docs/
β βββ ARCHITECTURE.md # Runtime, scoring, safety & provenance design
β βββ USER-GUIDE.md # Installation and operational usage guide
β βββ macharden.1 # Standard UNIX manual page (groff man format)
βββ scripts/
β βββ demo_fixture.sh # Deterministic synthetic demo data
β βββ generate_demo_gif.py # High-fidelity GIF rendering pipeline
βββ launchd/
β βββ com.macharden.daemon.plist # Launchd template for background audits
βββ tests/
β βββ test_runner.sh # Master test suite runner
β βββ test_checks.sh # Unit tests, schema verifiers & CLI tests
β βββ test_mocks.sh # Mocked system checks validation
βββ .github/
β βββ workflows/ci.yml # Cross-platform GitHub Actions CI pipeline
βββ Makefile # Unified build, test, lint, and install targets
βββ LICENSE # MIT License
βββ SECURITY.md # Vulnerability reporting & responsible disclosure policy
macharden is verified continuously on every pull request and commit across dual-platform GitHub Actions runners:
| Test Gate / Verification | Runner Platform | Standard & Tooling | Result |
|---|---|---|---|
| Cross-Platform Syntax Validation | macOS 14/15 & Ubuntu 24.04 | All 36 shell scripts validated with zsh -n and bash -n |
36 / 36 Passing |
| Static Shell Analysis | macOS 14/15 & Ubuntu 24.04 | ShellCheck linting across binary, libraries, and tests | 0 Errors |
| Automated Unit Tests | macOS 14/15 & Ubuntu 24.04 | 301 unit tests covering engine scoring, parsers, and reports | 301 / 301 Passing |
| Mocked System Audit Logic | macOS 14/15 & Ubuntu 24.04 | Mocked system checks verifying real audit branch behavior | 8 / 8 Passing |
| JSON & SARIF Validation | macOS 14/15 & Ubuntu 24.04 | Schema validation via python3 -m json.tool & SARIF 2.1.0 spec |
Verified |
| Embedded In-Browser JavaScript | macOS 14/15 & Ubuntu 24.04 | Client-side dashboard scripts validated with node -c |
Verified |
| Air-Gapped Privacy Invariant | macOS 14/15 & Ubuntu 24.04 | Zero external CDN links, zero web fonts, zero tracking | Verified (0 links) |
# Execute local test suite:
make testIf you find macharden valuable for securing your Mac, your fleet, or your enterprise endpoints, please consider starring the repository! It helps the project reach more security engineers and macOS defenders.
macharden is researched and developed by Sevban DΓΆnmez for enterprise endpoint defense, defensive telemetry auditing, and system security research.
Author : Sevban DΓΆnmez (@jankesec)
Role : Senior Cyber Security Consultant Β· Red Team & Offensive Security Researcher
Research Portal : https://jankesec.com
GitHub : https://github.com/jankesec
PGP Fingerprint : FF0A 7D83 6751 CCE3 F9CC F574 FCF8 39FB 7F00 4626
GPG Key ID : 5FDB257F4AAE8C3F
This tool is designed and distributed exclusively for authorized security audits, endpoint hardening, defensive posture assessment, and academic research. Applying automated remediation commands may alter system preferences, firewall configurations, and background services. Always review generated remediation scripts before applying them in mission-critical production environments. The author assumes no liability for unintended configuration changes or service disruption.
Distributed under the MIT License. See LICENSE for complete terms.

