@cyberstrike-io/cyberstrike 1.1.14 → 1.1.15-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: macos-postexploit
3
+ description: macOS post-exploitation for credential harvesting, DTrace monitoring, TCC bypass, and stealth operations via native tools
4
+ category: post-exploitation
5
+ tags: [macos, post-exploitation, credential-access, defense-evasion, keychain, dtrace, tcc, xprotect, gatekeeper]
6
+ tech_stack: [macos, python, dtrace, security-cli, osascript]
7
+ cwe_ids: [CWE-269, CWE-522, CWE-693, CWE-312]
8
+ chains_with: [T1555.001, T1056.001, T1059.004, T1562.001, T1070.002, T1553.001]
9
+ prerequisites: [T1068, T1548]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # macOS Post-Exploitation Methodology
14
+
15
+ macOS post-exploitation uses native tools (`security`, `dtrace`, `xattr`, `log`), Python with PyObjC/Quartz frameworks, and direct SQLite access for credential extraction. After gaining root or user-level access on a macOS target, these tools provide credential harvesting, runtime monitoring, and operational security capabilities.
16
+
17
+ ## Prerequisites
18
+
19
+ Before deploying machook tools, verify:
20
+
21
+ 1. **Root access** — most operations require root (except `xprotect_check`, `gatekeeper_bypass` for user-owned files, `ssh_keys` for current user)
22
+ 2. **SIP status** — DTrace tools require SIP disabled (`csrutil disable` from Recovery Mode)
23
+ 3. **Python3** — available via Xcode CLT or Homebrew
24
+ 4. **PyObjC** — required for `keylog_mac` (CGEventTap); install via `pip3 install pyobjc-framework-Quartz`
25
+
26
+ ```bash
27
+ # Quick prerequisite check
28
+ csrutil status # SIP status (DTrace needs disabled)
29
+ sw_vers # macOS version
30
+ security list-keychains # available keychains
31
+ python3 -c "import Quartz; print('OK')" # PyObjC for keylogging
32
+ ls /Library/Apple/System/Library/CoreServices/XProtect.bundle # XProtect present
33
+ ```
34
+
35
+ ## Kill Chain Phases
36
+
37
+ ### Phase 1 — Situational Awareness (First 60 seconds)
38
+
39
+ Understand the defensive landscape before deploying hooks.
40
+
41
+ | Action | Command | Purpose |
42
+ |--------|---------|---------|
43
+ | Check XProtect | `machook xprotect_check` | Enumerate XProtect/MRT signatures to know what triggers detection |
44
+ | Check SIP | `csrutil status` | Determine if DTrace monitoring is available |
45
+ | SSH keys | `machook ssh_keys` | Find SSH private keys — often leads to lateral movement |
46
+ | Keychain list | `security list-keychains` | See available keychains before dumping |
47
+
48
+ ### Phase 2 — Credential Harvesting
49
+
50
+ Extract credentials from macOS-specific stores.
51
+
52
+ | Action | Command | Purpose |
53
+ |--------|---------|---------|
54
+ | Keychain dump | `machook keychain_dump` | Extract all passwords from login/system Keychain via `security` command |
55
+ | Browser creds | `machook chrome_creds` | Extract Chrome/Safari saved passwords and cookies with AES decryption |
56
+ | SSH keys | `machook ssh_keys` | Find private keys for all users — id_rsa, id_ed25519, etc. |
57
+ | TCC bypass | `machook tcc_bypass` | Bypass TCC to access camera, microphone, files without user consent |
58
+ | Keystroke capture | `machook keylog_mac --duration 120` | Log keystrokes via CGEventTap with application context |
59
+
60
+ **Keychain extraction** uses the macOS `security` command to enumerate and dump keychain items. Root access allows dumping without per-item authorization prompts. The login keychain contains WiFi passwords, website credentials, certificates, and application tokens.
61
+
62
+ **Chrome credential extraction** copies the locked Login Data SQLite database, retrieves the Safe Storage key from Keychain, derives the AES decryption key via PBKDF2, and decrypts each stored password. Safari passwords are stored in Keychain and extracted via `security find-internet-password`.
63
+
64
+ **TCC bypass** targets the TCC.db database (`~/Library/Application Support/com.apple.TCC/TCC.db`) to grant access to protected resources without user consent dialogs.
65
+
66
+ ### Phase 3 — Monitoring (SIP disabled required)
67
+
68
+ DTrace provides kernel-level visibility into the target system.
69
+
70
+ | Action | Command | Purpose |
71
+ |--------|---------|---------|
72
+ | Process monitoring | `machook dtrace_exec --duration 60` | Trace all process executions — detect cron, security scans, admin activity |
73
+ | Network monitoring | `machook dtrace_net --duration 60` | Monitor all network connections — identify internal services, C2 |
74
+ | File monitoring | `machook dtrace_file --duration 60` | Monitor file access — detect what admin tools read/write |
75
+
76
+ ### Phase 4 — Stealth
77
+
78
+ Reduce the forensic footprint.
79
+
80
+ | Action | Command | Purpose |
81
+ |--------|---------|---------|
82
+ | Gatekeeper bypass | `machook gatekeeper_bypass --path /path` | Remove quarantine xattr to allow unsigned tool execution |
83
+ | Clear logs | `machook log_clear` | Clear unified logging, ASL, audit logs, crash reports, shell history |
84
+
85
+ ### Phase 5 — Cleanup (MANDATORY)
86
+
87
+ Always run cleanup before exiting a target.
88
+
89
+ ```
90
+ machook cleanup_mac
91
+ ```
92
+
93
+ The cleanup tool:
94
+ 1. Finds and removes LaunchAgents/LaunchDaemons matching CyberStrike patterns
95
+ 2. Kills any running DTrace or machook-related processes
96
+ 3. Removes temporary files and copied databases
97
+ 4. Clears machook-specific entries from shell history
98
+
99
+ ## Detection Considerations
100
+
101
+ macOS post-exploitation tools are detectable by:
102
+ - **Endpoint Security Framework (ESF)** — EDR agents using `es_new_client()` for process/file/auth events
103
+ - **Unified Logging** — `log show --predicate 'process == "security"'` for Keychain access
104
+ - **TCC audit** — TCC access logged in Console.app, `tccutil` events visible
105
+ - **SIP** — When enabled, blocks DTrace system-wide tracing and TCC.db modification
106
+ - **XProtect** — Scans downloaded executables against YARA rules
107
+ - **Gatekeeper** — Checks code signing and quarantine attributes
108
+ - **CrowdStrike Falcon / Jamf Protect** — macOS-specific EDR detects suspicious `security` command usage and CGEventTap creation
109
+
110
+ ## Program Reference
111
+
112
+ | Program | Technique | MITRE ATT&CK |
113
+ |---------|-----------|---------------|
114
+ | keychain_dump | macOS Keychain extraction via security CLI | T1555.001 — Keychain |
115
+ | chrome_creds | Browser credential decryption (Chrome/Safari) | T1555.003 — Credentials from Web Browsers |
116
+ | ssh_keys | SSH private key discovery and exfiltration | T1552.004 — Private Keys |
117
+ | tcc_bypass | TCC database manipulation for resource access | T1548 — Abuse Elevation Control Mechanism |
118
+ | keylog_mac | Keystroke capture via CGEventTap | T1056.001 — Keylogging |
119
+ | dtrace_exec | Process execution tracing via DTrace | T1057 — Process Discovery |
120
+ | dtrace_net | Network connection tracing via DTrace | T1049 — System Network Connections Discovery |
121
+ | dtrace_file | File access tracing via DTrace | T1083 — File and Directory Discovery |
122
+ | xprotect_check | XProtect/MRT signature enumeration | T1518.001 — Security Software Discovery |
123
+ | gatekeeper_bypass | Quarantine xattr removal | T1553.001 — Gatekeeper Bypass |
124
+ | log_clear | Unified log, ASL, and audit log clearing | T1070.002 — Clear Linux or Mac System Logs |
125
+ | cleanup_mac | Artifact removal and process cleanup | T1070 — Indicator Removal |
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: windows-postexploit
3
+ description: Windows userland post-exploitation for credential harvesting, monitoring, AMSI/ETW bypass, and stealth operations
4
+ category: post-exploitation
5
+ tags: [windows, post-exploitation, credential-access, defense-evasion, lsass, dpapi, etw, amsi, sam, keylogging]
6
+ tech_stack: [windows, powershell, python, ctypes, win32api]
7
+ cwe_ids: [CWE-269, CWE-522, CWE-693, CWE-312]
8
+ chains_with: [T1003, T1003.001, T1003.002, T1056.001, T1059.001, T1562.001, T1562.006, T1070.001, T1555, T1555.003]
9
+ prerequisites: [T1068, T1548.002]
10
+ version: "1.0"
11
+ ---
12
+
13
+ # Windows Post-Exploitation Methodology
14
+
15
+ Windows post-exploitation uses userland APIs (no kernel driver signing needed) for credential harvesting, monitoring, and stealth. After gaining Administrator access on a Windows target, these tools provide comprehensive credential extraction and operational security capabilities.
16
+
17
+ ## Prerequisites
18
+
19
+ Before deploying winhook tools, verify:
20
+
21
+ 1. **Administrator access** — most operations require elevated privileges
22
+ 2. **OS version** — Windows 10/11 or Server 2016+ for ETW features
23
+ 3. **PowerShell** — available natively on all modern Windows
24
+ 4. **Python3** — required for ctypes-based tools (ETW, keylogging, DPAPI, clipboard)
25
+ 5. **AV/EDR status** — run `amsi_bypass` and `etw_blind` first if Defender/EDR is active
26
+
27
+ ```powershell
28
+ # Quick prerequisite check
29
+ whoami /priv # verify SeDebugPrivilege
30
+ Get-MpComputerStatus | Select RealTimeProtectionEnabled # Defender status
31
+ Get-Process lsass # verify LSASS accessible
32
+ reg query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v RunAsPPL # PPL status
33
+ ```
34
+
35
+ ## Kill Chain Phases
36
+
37
+ ### Phase 1 — AV/EDR Evasion (First priority)
38
+
39
+ Neutralize monitoring before performing credential operations.
40
+
41
+ | Action | Command | Purpose |
42
+ |--------|---------|---------|
43
+ | Bypass AMSI | `winhook amsi_bypass` | Patch AmsiScanBuffer to allow undetected PowerShell execution |
44
+ | Blind ETW | `winhook etw_blind` | Patch EtwEventWrite to prevent EDR from receiving telemetry |
45
+ | Exclude paths | `winhook defender_exclude --path C:\Tools` | Add Defender exclusion for tool staging directory |
46
+
47
+ ### Phase 2 — Credential Harvesting
48
+
49
+ Extract credentials from multiple sources.
50
+
51
+ | Action | Command | Purpose |
52
+ |--------|---------|---------|
53
+ | LSASS dump | `winhook lsass_dump` | Dump LSASS memory for NTLM hashes, Kerberos tickets, plaintext passwords |
54
+ | SAM extraction | `winhook sam_dump` | Extract registry hives for offline cracking with secretsdump/hashcat |
55
+ | DPAPI secrets | `winhook dpapi_extract` | Decrypt browser passwords, WiFi keys, Windows Vault credentials |
56
+ | Credential phishing | `winhook credential_prompt` | Spawn fake Windows credential dialog to capture user password |
57
+ | Keystroke capture | `winhook keylog_win --duration 120` | Log keystrokes with active window context |
58
+ | Clipboard monitoring | `winhook clipboard_sniff --duration 60` | Capture copied passwords, tokens, and sensitive data |
59
+
60
+ **LSASS dumping** uses either `comsvcs.dll MiniDump` (default, uses a signed Windows DLL) or direct `MiniDumpWriteDump` from `dbghelp.dll`. The comsvcs method is preferred as it uses a Microsoft-signed binary.
61
+
62
+ **DPAPI decryption** calls `CryptUnprotectData` from `crypt32.dll` to decrypt Chrome/Edge Login Data, WiFi passwords, and Windows Credential Vault entries. No additional tools needed — uses the current user's DPAPI master key.
63
+
64
+ **SAM extraction** uses `reg save` to dump SAM, SYSTEM, and SECURITY hives. These can be processed offline with `impacket-secretsdump -sam SAM -system SYSTEM -security SECURITY LOCAL`.
65
+
66
+ ### Phase 3 — Monitoring
67
+
68
+ Understand the target environment and detect defensive measures.
69
+
70
+ | Action | Command | Purpose |
71
+ |--------|---------|---------|
72
+ | Process monitoring | `winhook etw_process --duration 60` | Track process creation via ETW — detect security tools, scheduled tasks |
73
+ | Network monitoring | `winhook etw_network --duration 60` | Track connections via ETW — identify C2 channels, internal services |
74
+
75
+ ### Phase 4 — Cleanup (MANDATORY)
76
+
77
+ Always run cleanup before exiting a target.
78
+
79
+ ```
80
+ winhook cleanup_win
81
+ ```
82
+
83
+ The cleanup tool:
84
+ 1. Clears Security, System, Application, and PowerShell event logs
85
+ 2. Removes temporary files matching CyberStrike patterns
86
+ 3. Removes any Defender exclusions that were added
87
+ 4. Reports on AMSI/ETW patches (require process restart to fully restore)
88
+
89
+ ## Detection Considerations
90
+
91
+ Windows post-exploitation tools are detectable by:
92
+ - **Sysmon** — Event IDs 1 (process create), 10 (process access for LSASS), 13 (registry)
93
+ - **Windows Event Log** — Event ID 4688 (process creation), 4624/4625 (logon), 1102 (log cleared)
94
+ - **EDR** — LSASS access monitoring, credential prompt anomaly detection
95
+ - **PPL (Protected Process Light)** — LSASS PPL blocks direct memory dumps (check RunAsPPL registry key)
96
+ - **Credential Guard** — Isolates LSASS in virtualization-based security (blocks comsvcs/minidump)
97
+
98
+ ## Program Reference
99
+
100
+ | Program | Technique | MITRE ATT&CK |
101
+ |---------|-----------|---------------|
102
+ | lsass_dump | LSASS memory dump via MiniDumpWriteDump | T1003.001 — LSASS Memory |
103
+ | sam_dump | Registry hive extraction (SAM/SYSTEM/SECURITY) | T1003.002 — Security Account Manager |
104
+ | dpapi_extract | DPAPI secret decryption via CryptUnprotectData | T1555.003 — Credentials from Web Browsers |
105
+ | credential_prompt | Fake credential dialog via CredUI | T1056.002 — GUI Input Capture |
106
+ | keylog_win | Keystroke capture via SetWindowsHookEx | T1056.001 — Keylogging |
107
+ | etw_process | Process monitoring via ETW provider | T1057 — Process Discovery |
108
+ | etw_network | Network monitoring via ETW provider | T1049 — System Network Connections Discovery |
109
+ | clipboard_sniff | Clipboard monitoring via Win32 API | T1115 — Clipboard Data |
110
+ | amsi_bypass | AMSI patching in memory | T1562.001 — Disable or Modify Tools |
111
+ | etw_blind | ETW patching to blind EDR | T1562.006 — Indicator Blocking |
112
+ | defender_exclude | Windows Defender exclusion management | T1562.001 — Disable or Modify Tools |
113
+ | cleanup_win | Event log clearing and artifact removal | T1070.001 — Clear Windows Event Logs |