@aegis-scan/skills 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 (69) hide show
  1. package/ATTRIBUTION.md +75 -0
  2. package/CHANGELOG.md +129 -0
  3. package/LICENSE +21 -0
  4. package/README.md +123 -0
  5. package/dist/bin.d.ts +3 -0
  6. package/dist/bin.d.ts.map +1 -0
  7. package/dist/bin.js +122 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/commands/info.d.ts +5 -0
  10. package/dist/commands/info.d.ts.map +1 -0
  11. package/dist/commands/info.js +75 -0
  12. package/dist/commands/info.js.map +1 -0
  13. package/dist/commands/install.d.ts +7 -0
  14. package/dist/commands/install.d.ts.map +1 -0
  15. package/dist/commands/install.js +87 -0
  16. package/dist/commands/install.js.map +1 -0
  17. package/dist/commands/list.d.ts +7 -0
  18. package/dist/commands/list.d.ts.map +1 -0
  19. package/dist/commands/list.js +82 -0
  20. package/dist/commands/list.js.map +1 -0
  21. package/dist/index.d.ts +13 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +13 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/skills-loader.d.ts +23 -0
  26. package/dist/skills-loader.d.ts.map +1 -0
  27. package/dist/skills-loader.js +213 -0
  28. package/dist/skills-loader.js.map +1 -0
  29. package/package.json +63 -0
  30. package/skills/defensive/README.md +9 -0
  31. package/skills/mitre-mapped/README.md +10 -0
  32. package/skills/offensive/snailsploit-fork/advanced-redteam/SKILL.md +148 -0
  33. package/skills/offensive/snailsploit-fork/ai-security/SKILL.md +592 -0
  34. package/skills/offensive/snailsploit-fork/basic-exploitation/SKILL.md +10783 -0
  35. package/skills/offensive/snailsploit-fork/bug-identification/SKILL.md +1256 -0
  36. package/skills/offensive/snailsploit-fork/crash-analysis/SKILL.md +12466 -0
  37. package/skills/offensive/snailsploit-fork/deserialization/SKILL.md +185 -0
  38. package/skills/offensive/snailsploit-fork/edr-evasion/SKILL.md +1806 -0
  39. package/skills/offensive/snailsploit-fork/exploit-dev-course/SKILL.md +428 -0
  40. package/skills/offensive/snailsploit-fork/exploit-development/SKILL.md +699 -0
  41. package/skills/offensive/snailsploit-fork/fast-checking/SKILL.md +487 -0
  42. package/skills/offensive/snailsploit-fork/file-upload/SKILL.md +822 -0
  43. package/skills/offensive/snailsploit-fork/fuzzing/SKILL.md +340 -0
  44. package/skills/offensive/snailsploit-fork/fuzzing-course/SKILL.md +2105 -0
  45. package/skills/offensive/snailsploit-fork/graphql/SKILL.md +209 -0
  46. package/skills/offensive/snailsploit-fork/idor/SKILL.md +608 -0
  47. package/skills/offensive/snailsploit-fork/initial-access/SKILL.md +1528 -0
  48. package/skills/offensive/snailsploit-fork/jwt/SKILL.md +276 -0
  49. package/skills/offensive/snailsploit-fork/keylogger-arch/SKILL.md +197 -0
  50. package/skills/offensive/snailsploit-fork/mitigations/SKILL.md +1351 -0
  51. package/skills/offensive/snailsploit-fork/oauth/SKILL.md +366 -0
  52. package/skills/offensive/snailsploit-fork/open-redirect/SKILL.md +487 -0
  53. package/skills/offensive/snailsploit-fork/osint/SKILL.md +399 -0
  54. package/skills/offensive/snailsploit-fork/osint-methodology/SKILL.md +434 -0
  55. package/skills/offensive/snailsploit-fork/parameter-pollution/SKILL.md +595 -0
  56. package/skills/offensive/snailsploit-fork/race-condition/SKILL.md +881 -0
  57. package/skills/offensive/snailsploit-fork/rce/SKILL.md +1069 -0
  58. package/skills/offensive/snailsploit-fork/request-smuggling/SKILL.md +773 -0
  59. package/skills/offensive/snailsploit-fork/shellcode/SKILL.md +477 -0
  60. package/skills/offensive/snailsploit-fork/sqli/SKILL.md +372 -0
  61. package/skills/offensive/snailsploit-fork/ssrf/SKILL.md +830 -0
  62. package/skills/offensive/snailsploit-fork/ssti/SKILL.md +349 -0
  63. package/skills/offensive/snailsploit-fork/vuln-classes/SKILL.md +1229 -0
  64. package/skills/offensive/snailsploit-fork/waf-bypass/SKILL.md +820 -0
  65. package/skills/offensive/snailsploit-fork/windows-boundaries/SKILL.md +15153 -0
  66. package/skills/offensive/snailsploit-fork/windows-mitigations/SKILL.md +14546 -0
  67. package/skills/offensive/snailsploit-fork/xss/SKILL.md +784 -0
  68. package/skills/offensive/snailsploit-fork/xxe/SKILL.md +996 -0
  69. package/skills/ops/README.md +6 -0
@@ -0,0 +1,366 @@
1
+ <!-- aegis-local: forked 2026-04-23 from SnailSploit/Claude-Red@c74d53e2938b59f111572e0819265a1e73029393; attribution preserved, see ATTRIBUTION.md -->
2
+
3
+ # SKILL: OAuth Security Testing
4
+
5
+ ## Metadata
6
+ - **Skill Name**: oauth-attacks
7
+ - **Folder**: offensive-oauth
8
+ - **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/oauth.md
9
+
10
+ ## Description
11
+ OAuth 2.0 attack checklist: authorization code interception, redirect_uri bypass, CSRF on OAuth flow, state parameter abuse, open redirector chaining, token leakage via Referer, PKCE bypass, and scope escalation. Use when testing OAuth implementations in web apps or bug bounty.
12
+
13
+ ## Trigger Phrases
14
+ Use this skill when the conversation involves any of:
15
+ `OAuth, OAuth 2.0, authorization code, redirect_uri bypass, OAuth CSRF, state parameter, PKCE bypass, scope escalation, token leakage, open redirector, OAuth attack`
16
+
17
+ ## Instructions for Claude
18
+
19
+ When this skill is active:
20
+ 1. Load and apply the full methodology below as your operational checklist
21
+ 2. Follow steps in order unless the user specifies otherwise
22
+ 3. For each technique, consider applicability to the current target/context
23
+ 4. Track which checklist items have been completed
24
+ 5. Suggest next steps based on findings
25
+
26
+ ---
27
+
28
+ ## Full Methodology
29
+
30
+ # OAuth Security Testing
31
+
32
+ ## Shortcut
33
+
34
+ - Check for improper redirect validation (open redirects)
35
+ - Test state parameter manipulation/absence
36
+ - Manipulate OAuth flows to bypass authentication
37
+ - Try URL path traversal in redirect_uri
38
+ - Hunt for client secret leakage in source code/repos
39
+ - Look for improper scope validation
40
+
41
+ ## Mechanisms
42
+
43
+ - **OAuth 2.0** authorizes limited access to resources via tokens; pair with **OIDC** for identity.
44
+ - **Core Flows**:
45
+ - Authorization Code (with PKCE for public clients)
46
+ - Client Credentials (service-to-service)
47
+ - Avoid Implicit and ROPC where possible
48
+ - **Key Components**:
49
+ - Resource Owner (user)
50
+ - Client (third-party app)
51
+ - Authorization Server (issues tokens)
52
+ - Resource Server (hosts protected resources)
53
+ - Tokens (access and refresh)
54
+ - **Hardening Extensions**:
55
+ - PAR (Pushed Authorization Requests), JAR (Request Objects), JARM (JWT-secured responses)
56
+ - Sender‑constrained tokens (DPoP, mTLS)
57
+ - `private_key_jwt` or mTLS client authentication for confidential clients
58
+
59
+ ### OAuth/OIDC Considerations
60
+
61
+ - **PKCE everywhere**: Even with confidential clients/native apps; `code_verifier` must be required and validated.
62
+ - **Nonce/state binding**: For OIDC, ensure `nonce` is present and matched; `state` should be unguessable and tied to session.
63
+ - **`redirect_uri` exact match**: Enforce exact string match against pre-registered allowlist; no wildcards/path traversal.
64
+ - **`aud`/`azp`/`iss` enforcement**: Validate tokens strictly, including clock skew and JWKS `kid` rotation behavior.
65
+ - **Front-channel logout/login CSRF**: Validate logout CSRF; defend forced login to attacker accounts.
66
+ - **ID Token vs Access Token**: APIs must not accept ID tokens; check `token_type` and audience.
67
+ - **Device Code & CIBA**: Validate polling rate limits, code expiry, and binding of device/user codes.
68
+ - **Refresh Token Rotation**: Enforce reuse detection and global invalidation chains.
69
+ - **PAR/JAR/JARM**: Use to pin exact redirect_uri and inputs and to protect front-channel parameters.
70
+
71
+ ### OAuth 2.1 Updates
72
+
73
+ - **Implicit Flow Deprecated**: Authorization servers should not support `response_type=token`
74
+ - **Password Grant Deprecated**: ROPC (Resource Owner Password Credentials) considered insecure
75
+ - **PKCE Mandatory**: Required for all OAuth clients including confidential clients
76
+ - **Exact Redirect URI Matching**: No more substring or prefix matching allowed
77
+ - **Refresh Token Sender Constraint**: Refresh tokens should be sender-constrained via DPoP or mTLS
78
+
79
+ ### Financial-grade API (FAPI) Security
80
+
81
+ #### FAPI 1.0 Advanced Profile
82
+
83
+ - **Signed Request Objects (JAR)**: Authorization requests as signed JWTs
84
+ - **Hybrid Flow**: Uses `response_type=code id_token` for additional security
85
+ - **MTLS Client Authentication**: Certificate-bound tokens
86
+ - **JARM**: JWT-secured authorization response mode
87
+ - **Request Object Encryption**: Sensitive parameters encrypted
88
+
89
+ #### FAPI 2.0 Security Profile
90
+
91
+ - **Pushed Authorization Requests (PAR)**: POST request parameters to dedicated endpoint
92
+ - **DPoP (Demonstrating Proof-of-Possession)**: Token bound to client's key pair
93
+ - **Client Authentication**: `private_key_jwt` or MTLS required
94
+ - **Grant Management**: Rich authorization requests and grant management API
95
+
96
+ ```mermaid
97
+ graph TD
98
+ User[Resource Owner] -->|Initiates flow| Client
99
+ Client -->|Authorization Request| AuthServer[Authorization Server]
100
+ AuthServer -->|Authentication| User
101
+ User -->|Approves access| AuthServer
102
+ AuthServer -->|Authorization Code| Client
103
+ Client -->|Code + Client Secret| AuthServer
104
+ AuthServer -->|Access Token| Client
105
+ Client -->|Access Token| ResourceServer[Resource Server]
106
+ ResourceServer -->|Protected Resource| Client
107
+
108
+ style User fill:#b7b,stroke:#333,color:#333
109
+ style Client fill:#aae,stroke:#333,color:#333
110
+ style AuthServer fill:#9f9,stroke:#333,color:#333
111
+ style ResourceServer fill:#e9a,stroke:#333,color:#333
112
+ ```
113
+
114
+ ## Hunt
115
+
116
+ - Intercept OAuth flows with proxy (Burp/ZAP)
117
+ - Manipulate redirect_uri parameters
118
+ - Remove/tamper state parameter
119
+ - Test PKCE implementations
120
+ - Inspect token handling in browsers
121
+ - Check for client secret leakage
122
+ - Analyze scope handling logic
123
+ - Test account linking/unlinking
124
+ - Review token validation procedures
125
+ - Examine refresh token security
126
+
127
+ #### Native/Mobile
128
+
129
+ - Verify App Links/Universal Links to prevent hijacking callbacks.
130
+ - Ensure OAuth proxy components in mobile apps validate issuer and JWKS; do not ship client secrets in binaries.
131
+
132
+ #### SPA/Browser
133
+
134
+ - Use Authorization Code + PKCE; avoid Implicit/Hybrid unless justified.
135
+ - Store tokens in memory; if cookies are used, set `__Host-` prefix with `HttpOnly; Secure; SameSite`.
136
+
137
+ ### Authorization Code Flow
138
+
139
+ - Initial authorization request has `response_type=code`
140
+ - Request format: `/authorization?client_id=12345&redirect_uri=https://client-app.com/callback&response_type=code&scope=openid%20profile&state=ae13d489bd00e3c24`
141
+ - Callback contains authorization code: `/callback?code=a1b2c3d4e5f6g7h8&state=ae13d489bd00e3c24`
142
+ - More secure, backend exchanges code for tokens
143
+
144
+ ```mermaid
145
+ sequenceDiagram
146
+ participant User
147
+ participant Client
148
+ participant AuthServer as Authorization Server
149
+ participant API as Resource Server
150
+
151
+ User->>Client: 1. Click "Login with Service"
152
+ Client->>AuthServer: 2. Authorization Request (response_type=code)
153
+ AuthServer->>User: 3. Login & Consent
154
+ User->>AuthServer: 4. Approves Access
155
+ AuthServer->>Client: 5. Redirect with Authorization Code
156
+ Client->>AuthServer: 6. Token Request (code + client_secret)
157
+ AuthServer->>Client: 7. Access & Refresh Tokens
158
+ Client->>API: 8. API Request + Access Token
159
+ API->>Client: 9. Protected Resource
160
+ ```
161
+
162
+ ### Implicit Flow
163
+
164
+ - Initial authorization request has `response_type=token`
165
+ - Request format: `/authorization?client_id=12345&redirect_uri=https://client-app.com/callback&response_type=token&scope=openid%20profile&state=ae13d489bd00e3c24`
166
+ - Access token returned directly in URL fragment: `/callback#access_token=z0y9x8w7v6u5&token_type=Bearer&expires_in=5000&scope=openid%20profile&state=ae13d489bd00e3c24`
167
+ - Higher vulnerability potential due to frontend token handling
168
+
169
+ ```mermaid
170
+ sequenceDiagram
171
+ participant User
172
+ participant Client as Client (Browser)
173
+ participant AuthServer as Authorization Server
174
+ participant API as Resource Server
175
+
176
+ User->>Client: 1. Click "Login with Service"
177
+ Client->>AuthServer: 2. Authorization Request (response_type=token)
178
+ AuthServer->>User: 3. Login & Consent
179
+ User->>AuthServer: 4. Approves Access
180
+ AuthServer->>Client: 5. Redirect with Access Token in Fragment
181
+ Note over Client: Token stored in browser
182
+ Client->>API: 6. API Request + Access Token
183
+ API->>Client: 7. Protected Resource
184
+ ```
185
+
186
+ ## Vulnerabilities
187
+
188
+ - **Improper redirect_uri validation**
189
+ - Open redirects
190
+ - Subdomain/path validation bypass
191
+ - **CSRF attacks** (missing/improper state parameter)
192
+ - **Token leakage** (URL fragments in referrer headers)
193
+ - **Scope elevation** (improper authorization)
194
+ - **Account takeover** via improper linking/unlinking
195
+ - **JWT vulnerabilities** (weak signatures, lack of validation)
196
+ - **Client secret exposure** in source/git repositories
197
+ - **Authorization bypass** in misconfigured implementations
198
+ - **Session fixation** attacks
199
+ - **Access token theft** via XSS/Man-in-the-Middle
200
+
201
+ #### Authorization Code Injection / Code Substitution
202
+
203
+ - Attacker injects victim authorization code into attacker session to bind victim account. Mitigate with state-nonce binding and PKCE.
204
+
205
+ #### Method 1: Auth Bypass in OAuth Implicit Flow
206
+
207
+ - Locate POST request containing user info (email, username) and access token
208
+ - In implicit flow, servers often don't properly validate access tokens
209
+ - Try changing user parameters (email, username) while keeping the token
210
+ - Potentially impersonate other users if server trusts client-provided identifiers
211
+
212
+ #### Method 2: Forced Profile Linking
213
+
214
+ - Target OAuth profile linking functionality
215
+ - Check for missing `state` parameter in auth requests
216
+ - Create CSRF attack by copying auth URL before code/token use
217
+ - Deliver as direct link or embedded iframe to victim
218
+ - Can link attacker's social media to victim's account
219
+
220
+ #### Method 3: Account Hijacking via redirect_uri
221
+
222
+ - Identify authorization request with redirect_uri parameter
223
+ - Test redirect_uri manipulation (external domains or open redirects)
224
+ - Modify redirect_uri to attacker-controlled endpoint (webhook)
225
+ - Deliver modified auth URL to victim to capture their authorization code
226
+ - Use stolen code to complete OAuth flow and access victim's account
227
+
228
+ ## Methodologies
229
+
230
+ - **Tools**:
231
+ - Burp Suite (OAuth Scanner extension)
232
+ - OWASP ZAP
233
+ - OAuth 2.0 Threat Model Toolkit
234
+ - Postman for API testing
235
+ - JWT_Tool for token analysis
236
+ - OAuthSecurity Cheatsheet Scanner
237
+ - **Techniques**:
238
+ - Flow manipulation
239
+ - Parameter tampering
240
+ - Token analysis
241
+ - Replay attacks
242
+ - Social engineering (phishing for tokens)
243
+ - DPoP proof validation testing
244
+ - MTLS certificate validation testing
245
+ - PAR endpoint exploitation
246
+ - Token exchange flow testing
247
+
248
+ ## Chaining and Escalation
249
+
250
+ ### OAuth → Full Account Takeover
251
+
252
+ 1. **Open Redirect → Authorization Code Theft**:
253
+ - Discover open redirect on trusted domain
254
+ - Craft OAuth flow with redirect_uri pointing to open redirect
255
+ - Victim clicks malicious link, completes OAuth flow
256
+ - Authorization code redirected through open redirect to attacker
257
+ - Attacker exchanges code for access token
258
+
259
+ 2. **CSRF → Account Linking Attack**:
260
+ - Initiate OAuth flow to link social account
261
+ - Capture authorization callback URL before code is used
262
+ - Deliver URL to victim via CSRF
263
+ - Victim's account linked to attacker's social account
264
+ - Attacker logs in with social account to access victim's account
265
+
266
+ 3. **XSS → Token Theft**:
267
+ - Find XSS vulnerability on application
268
+ - Inject script to steal access tokens from localStorage
269
+ - Use stolen tokens to access victim's API resources
270
+ - If refresh tokens stolen, maintain persistent access
271
+
272
+ ### OAuth → Lateral Movement
273
+
274
+ 1. **Token Exchange → Service Impersonation**:
275
+ - Obtain low-privilege access token
276
+ - Use RFC 8693 token exchange to request token for different service
277
+ - Weak validation allows unauthorized service access
278
+ - Move laterally across microservices
279
+
280
+ 2. **Scope Elevation → Privilege Escalation**:
281
+ - Obtain token with limited scope
282
+ - Manipulate refresh token exchange to request broader scopes
283
+ - Weak scope validation grants elevated permissions
284
+ - Access privileged API endpoints
285
+
286
+ 3. **IdP Confusion → Cross-Tenant Access**:
287
+ - Multi-tenant application with multiple IdPs
288
+ - Obtain authorization code from Tenant A's IdP
289
+ - Exchange code at Tenant B's token endpoint
290
+ - Weak issuer validation grants cross-tenant access
291
+
292
+ ### OAuth → Backend Exploitation
293
+
294
+ 1. **JWT Algorithm Confusion → Signature Bypass**:
295
+ - Obtain valid JWT access token
296
+ - Change algorithm from RS256 to HS256
297
+ - Sign token with public key (treating it as HMAC secret)
298
+ - Backend fails to validate algorithm properly
299
+ - Forge arbitrary tokens for privilege escalation
300
+
301
+ 2. **SSRF via redirect_uri → Internal Service Access**:
302
+ - OAuth provider allows internal redirect_uri
303
+ - Set redirect_uri to internal service (http://169.254.169.254)
304
+ - Authorization response sent to internal service
305
+ - Use to access cloud metadata or internal APIs
306
+
307
+ 3. **Token Replay → Session Hijacking**:
308
+ - Capture access token via network sniffing or logs
309
+ - Token not properly bound to client (no DPoP/MTLS)
310
+ - Replay token from attacker's system
311
+ - Hijack victim's session and access resources
312
+
313
+ ## Remediation Recommendations
314
+
315
+ ### OAuth 2.1 / Modern Implementation
316
+
317
+ - **Implement OAuth 2.1**: Adopt latest security recommendations
318
+ - Deprecate Implicit and Password grants
319
+ - Require PKCE for all clients (public and confidential)
320
+ - Enforce exact redirect_uri matching
321
+ - Implement refresh token rotation with reuse detection
322
+
323
+ - **Enforce state parameter**: Always required, cryptographically random, single-use
324
+ - **Validate token claims strictly**:
325
+ - `aud` (audience): Must match resource server
326
+ - `iss` (issuer): Verify against known issuers
327
+ - `exp` (expiration): Enforce with clock skew tolerance (max 60s)
328
+ - `nbf` (not before): Validate if present
329
+
330
+ - **Secure token storage**:
331
+ - Never use localStorage (XSS vulnerable)
332
+ - Use httpOnly cookies with `__Host-` prefix or memory-only storage
333
+ - Set proper cookie flags: `HttpOnly; Secure; SameSite=Strict`
334
+
335
+ ### Advanced Security Features
336
+
337
+ - **Implement PAR (Pushed Authorization Requests)**: POST parameters to `/par` endpoint
338
+ - **Use DPoP (Demonstrating Proof-of-Possession)**: Bind access tokens to client's public key
339
+ - **Implement MTLS for confidential clients**: Certificate-bound access tokens
340
+ - **Use JAR (JWT-secured Authorization Request)**: Sign authorization request parameters
341
+ - **Consider JARM (JWT-secured Authorization Response)**: Signed authorization responses
342
+
343
+ ### Token Management
344
+
345
+ - **Short-lived access tokens**: 5-15 minutes maximum
346
+ - **Refresh token rotation**: Issue new refresh token on each use
347
+ - **Refresh token reuse detection**: Revoke entire token family on reuse
348
+ - **Token binding**: Use DPoP or MTLS to bind tokens to clients
349
+
350
+ ### Standards and Compliance
351
+
352
+ - Follow **OAuth 2.1** (draft) guidance
353
+ - Implement **FAPI** if dealing with financial data
354
+ - Follow **RFC 6819** OAuth threat model
355
+ - Adopt **RFC 8252** for native apps
356
+ - Consider **RFC 8693** for secure token exchange
357
+ - Implement **RFC 9449** for DPoP
358
+
359
+ ### Regular Security Practices
360
+
361
+ - Rotate signing keys regularly (every 6-12 months)
362
+ - Implement JWKS with short TTL (< 1 hour)
363
+ - Pin trusted issuers in client configuration
364
+ - Conduct regular OAuth security audits
365
+ - Keep libraries and dependencies updated
366
+