strix-agent 0.1.18__py3-none-any.whl → 0.1.19__py3-none-any.whl

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.

Potentially problematic release.


This version of strix-agent might be problematic. Click here for more details.

Files changed (40) hide show
  1. strix/agents/StrixAgent/strix_agent.py +2 -1
  2. strix/agents/StrixAgent/system_prompt.jinja +8 -10
  3. strix/agents/base_agent.py +20 -0
  4. strix/agents/state.py +18 -1
  5. strix/cli/app.py +92 -15
  6. strix/cli/main.py +3 -2
  7. strix/cli/tool_components/base_renderer.py +2 -2
  8. strix/cli/tool_components/reporting_renderer.py +2 -1
  9. strix/prompts/README.md +64 -0
  10. strix/prompts/__init__.py +1 -1
  11. strix/prompts/cloud/.gitkeep +0 -0
  12. strix/prompts/custom/.gitkeep +0 -0
  13. strix/prompts/frameworks/fastapi.jinja +142 -0
  14. strix/prompts/frameworks/nextjs.jinja +126 -0
  15. strix/prompts/protocols/graphql.jinja +215 -0
  16. strix/prompts/reconnaissance/.gitkeep +0 -0
  17. strix/prompts/technologies/firebase_firestore.jinja +177 -0
  18. strix/prompts/technologies/supabase.jinja +189 -0
  19. strix/prompts/vulnerabilities/authentication_jwt.jinja +133 -115
  20. strix/prompts/vulnerabilities/broken_function_level_authorization.jinja +146 -0
  21. strix/prompts/vulnerabilities/business_logic.jinja +146 -118
  22. strix/prompts/vulnerabilities/csrf.jinja +137 -131
  23. strix/prompts/vulnerabilities/idor.jinja +149 -118
  24. strix/prompts/vulnerabilities/insecure_file_uploads.jinja +188 -0
  25. strix/prompts/vulnerabilities/mass_assignment.jinja +141 -0
  26. strix/prompts/vulnerabilities/path_traversal_lfi_rfi.jinja +142 -0
  27. strix/prompts/vulnerabilities/race_conditions.jinja +135 -165
  28. strix/prompts/vulnerabilities/rce.jinja +128 -180
  29. strix/prompts/vulnerabilities/sql_injection.jinja +128 -192
  30. strix/prompts/vulnerabilities/ssrf.jinja +118 -151
  31. strix/prompts/vulnerabilities/xss.jinja +144 -196
  32. strix/prompts/vulnerabilities/xxe.jinja +151 -243
  33. strix/tools/agents_graph/agents_graph_actions.py +4 -3
  34. strix/tools/agents_graph/agents_graph_actions_schema.xml +10 -14
  35. strix/tools/registry.py +1 -1
  36. {strix_agent-0.1.18.dist-info → strix_agent-0.1.19.dist-info}/METADATA +52 -13
  37. {strix_agent-0.1.18.dist-info → strix_agent-0.1.19.dist-info}/RECORD +40 -27
  38. {strix_agent-0.1.18.dist-info → strix_agent-0.1.19.dist-info}/LICENSE +0 -0
  39. {strix_agent-0.1.18.dist-info → strix_agent-0.1.19.dist-info}/WHEEL +0 -0
  40. {strix_agent-0.1.18.dist-info → strix_agent-0.1.19.dist-info}/entry_points.txt +0 -0
@@ -1,143 +1,171 @@
1
1
  <business_logic_flaws_guide>
2
- <title>BUSINESS LOGIC FLAWS - OUTSMARTING THE APPLICATION</title>
3
-
4
- <critical>Business logic flaws bypass all technical security controls by exploiting flawed assumptions in application workflow. Often the highest-paying vulnerabilities.</critical>
2
+ <title>BUSINESS LOGIC FLAWS</title>
3
+
4
+ <critical>Business logic flaws exploit intended functionality to violate domain invariants: move money without paying, exceed limits, retain privileges, or bypass reviews. They require a model of the business, not just payloads.</critical>
5
+
6
+ <scope>
7
+ - Financial logic: pricing, discounts, payments, refunds, credits, chargebacks
8
+ - Account lifecycle: signup, upgrade/downgrade, trial, suspension, deletion
9
+ - Authorization-by-logic: feature gates, role transitions, approval workflows
10
+ - Quotas/limits: rate/usage limits, inventory, entitlements, seat licensing
11
+ - Multi-tenant isolation: cross-organization data or action bleed
12
+ - Event-driven flows: jobs, webhooks, sagas, compensations, idempotency
13
+ </scope>
14
+
15
+ <methodology>
16
+ 1. Enumerate a state machine per critical workflow (states, transitions, pre/post-conditions). Note invariants (e.g., "refund ≤ captured amount").
17
+ 2. Build an Actor × Action × Resource matrix with at least: unauth, basic user, premium, staff/admin; identify actions per role.
18
+ 3. For each transition, test step skipping, repetition, reordering, and late mutation (modify inputs after validation but before commit).
19
+ 4. Introduce time, concurrency, and channel variance: repeat with parallel requests, different content-types, mobile/web/API/GraphQL.
20
+ 5. Validate persistence boundaries: verify that all services, queues, and jobs re-enforce invariants (no trust in upstream validation).
21
+ </methodology>
5
22
 
6
23
  <discovery_techniques>
7
- - Map complete user journeys and state transitions
8
- - Document developer assumptions
9
- - Find edge cases in workflows
10
- - Look for missing validation steps
11
- - Identify trust boundaries
24
+ <workflow_mapping>
25
+ - Derive endpoints from the UI and proxy/network logs; map hidden/undocumented API calls, especially finalize/confirm endpoints
26
+ - Identify tokens/flags: stepToken, paymentIntentId, orderStatus, reviewState, approvalId; test reuse across users/sessions
27
+ - Document invariants: conservation of value (ledger balance), uniqueness (idempotency), monotonicity (non-decreasing counters), exclusivity (one active subscription)
28
+ </workflow_mapping>
29
+
30
+ <input_surface>
31
+ - Hidden fields and client-computed totals; server must recompute on trusted sources
32
+ - Alternate encodings and shapes: arrays instead of scalars, objects with unexpected keys, null/empty/0/negative, scientific notation
33
+ - Business selectors: currency, locale, timezone, tax region; vary to trigger rounding and ruleset changes
34
+ </input_surface>
35
+
36
+ <state_time_axes>
37
+ - Replays: resubmit stale finalize/confirm requests
38
+ - Out-of-order: call finalize before verify; refund before capture; cancel after ship
39
+ - Time windows: end-of-day/month cutovers, daylight saving, grace periods, trial expiry edges
40
+ </state_time_axes>
12
41
  </discovery_techniques>
13
42
 
14
43
  <high_value_targets>
15
- <financial_workflows>
16
- - Price manipulation (negative quantities, decimal truncation)
17
- - Currency conversion abuse (buy weak, refund strong)
18
- - Discount/coupon stacking
19
- - Payment method switching after verification
20
- - Cart manipulation during checkout
21
- </financial_workflows>
22
-
23
- <account_management>
24
- - Registration race conditions (same email/username)
25
- - Account type elevation
26
- - Trial period extension
27
- - Subscription downgrade with feature retention
28
- </account_management>
29
-
30
- <authorization_flaws>
31
- - Function-level bypass (accessing admin functions as user)
32
- - Object reference manipulation
33
- - Permission inheritance bugs
34
- - Multi-tenancy isolation failures
35
- </authorization_flaws>
44
+ - Pricing/cart: price locks, quote to order, tax/shipping computation
45
+ - Discount engines: stacking, mutual exclusivity, scope (cart vs item), once-per-user enforcement
46
+ - Payments: auth/capture/void/refund sequences, partials, split tenders, chargebacks, idempotency keys
47
+ - Credits/gift cards/vouchers: issuance, redemption, reversal, expiry, transferability
48
+ - Subscriptions: proration, upgrade/downgrade, trial extension, seat counts, meter reporting
49
+ - Refunds/returns/RMAs: multi-item partials, restocking fees, return window edges
50
+ - Admin/staff operations: impersonation, manual adjustments, credit/refund issuance, account flags
51
+ - Quotas/limits: daily/monthly usage, inventory reservations, feature usage counters
36
52
  </high_value_targets>
37
53
 
38
54
  <exploitation_techniques>
39
- <race_conditions>
40
- Use race conditions to:
41
- - Double-spend vouchers/credits
42
- - Bypass rate limits
43
- - Create duplicate accounts
44
- - Exploit TOCTOU vulnerabilities
45
- </race_conditions>
46
-
47
- <state_manipulation>
48
- - Skip workflow steps
49
- - Replay previous states
50
- - Force invalid state transitions
51
- - Manipulate hidden parameters
52
- </state_manipulation>
53
-
54
- <input_manipulation>
55
- - Type confusion: string where int expected
56
- - Boundary values: 0, -1, MAX_INT
57
- - Format abuse: scientific notation, Unicode
58
- - Encoding tricks: double encoding, mixed encoding
59
- </input_manipulation>
60
- </exploitation_techniques>
61
-
62
- <common_flaws>
63
- <shopping_cart>
64
- - Add items with negative price
65
- - Modify prices client-side
66
- - Apply expired coupons
67
- - Stack incompatible discounts
68
- - Change currency after price lock
69
- </shopping_cart>
70
-
71
- <payment_processing>
72
- - Complete order before payment
73
- - Partial payment acceptance
74
- - Payment replay attacks
75
- - Void after delivery
76
- - Refund more than paid
77
- </payment_processing>
78
-
79
- <user_lifecycle>
80
- - Premium features in trial
81
- - Account deletion bypasses
82
- - Privilege retention after demotion
83
- - Transfer restrictions bypass
84
- </user_lifecycle>
85
- </common_flaws>
55
+ <state_machine_abuse>
56
+ - Skip or reorder steps via direct API calls; verify server enforces preconditions on each transition
57
+ - Replay prior steps with altered parameters (e.g., swap price after approval but before capture)
58
+ - Split a single constrained action into many sub-actions under the threshold (limit slicing)
59
+ </state_machine_abuse>
60
+
61
+ <concurrency_and_idempotency>
62
+ - Parallelize identical operations to bypass atomic checks (create, apply, redeem, transfer)
63
+ - Abuse idempotency: key scoped to path but not principal → reuse other users' keys; or idempotency stored only in cache
64
+ - Message reprocessing: queue workers re-run tasks on retry without idempotent guards; cause duplicate fulfillment/refund
65
+ </concurrency_and_idempotency>
66
+
67
+ <numeric_and_currency>
68
+ - Floating point vs decimal rounding; rounding/truncation favoring attacker at boundaries
69
+ - Cross-currency arbitrage: buy in currency A, refund in B at stale rates; tax rounding per-item vs per-order
70
+ - Negative amounts, zero-price, free shipping thresholds, minimum/maximum guardrails
71
+ </numeric_and_currency>
72
+
73
+ <quotas_limits_inventory>
74
+ - Off-by-one and time-bound resets (UTC vs local); pre-warm at T-1s and post-fire at T+1s
75
+ - Reservation/hold leaks: reserve multiple, complete one, release not enforced; backorder logic inconsistencies
76
+ - Distributed counters without strong consistency enabling double-consumption
77
+ </quotas_limits_inventory>
78
+
79
+ <refunds_chargebacks>
80
+ - Double-refund: refund via UI and support tool; refund partials summing above captured amount
81
+ - Refund after benefits consumed (downloaded digital goods, shipped items) due to missing post-consumption checks
82
+ </refunds_chargebacks>
83
+
84
+ <feature_gates_and_roles>
85
+ - Feature flags enforced client-side or at edge but not in core services; toggle names guessed or fallback to default-enabled
86
+ - Role transitions leaving stale capabilities (retain premium after downgrade; retain admin endpoints after demotion)
87
+ </feature_gates_and_roles>
86
88
 
87
89
  <advanced_techniques>
88
- <business_constraint_violations>
89
- - Exceed account limits
90
- - Bypass geographic restrictions
91
- - Violate temporal constraints
92
- - Break dependency chains
93
- </business_constraint_violations>
94
-
95
- <workflow_abuse>
96
- - Parallel execution of exclusive processes
97
- - Recursive operations (infinite loops)
98
- - Asynchronous timing exploitation
99
- - Callback manipulation
100
- </workflow_abuse>
101
- </advanced_techniques>
90
+ <event_driven_sagas>
91
+ - Saga/compensation gaps: trigger compensation without original success; or execute success twice without compensation
92
+ - Outbox/Inbox patterns missing idempotency → duplicate downstream side effects
93
+ - Cron/backfill jobs operating outside request-time authorization; mutate state broadly
94
+ </event_driven_sagas>
95
+
96
+ <microservices_boundaries>
97
+ - Cross-service assumption mismatch: one service validates total, another trusts line items; alter between calls
98
+ - Header trust: internal services trusting X-Role or X-User-Id from untrusted edges
99
+ - Partial failure windows: two-phase actions where phase 1 commits without phase 2, leaving exploitable intermediate state
100
+ </microservices_boundaries>
101
+
102
+ <multi_tenant_isolation>
103
+ - Tenant-scoped counters and credits updated without tenant key in the where-clause; leak across orgs
104
+ - Admin aggregate views allowing actions that impact other tenants due to missing per-tenant enforcement
105
+ </multi_tenant_isolation>
106
+
107
+ <bypass_techniques>
108
+ - Content-type switching (json/form/multipart) to hit different code paths
109
+ - Method alternation (GET performing state change; overrides via X-HTTP-Method-Override)
110
+ - Client recomputation: totals, taxes, discounts computed on client and accepted by server
111
+ - Cache/gateway differentials: stale decisions from CDN/APIM that are not identity-aware
112
+ </bypass_techniques>
113
+
114
+ <special_contexts>
115
+ <ecommerce>
116
+ - Stack incompatible discounts via parallel apply; remove qualifying item after discount applied; retain free shipping after cart changes
117
+ - Modify shipping tier post-quote; abuse returns to keep product and refund
118
+ </ecommerce>
119
+
120
+ <banking_fintech>
121
+ - Split transfers to bypass per-transaction threshold; schedule vs instant path inconsistencies
122
+ - Exploit grace periods on holds/authorizations to withdraw again before settlement
123
+ </banking_fintech>
124
+
125
+ <saas_b2b>
126
+ - Seat licensing: race seat assignment to exceed purchased seats; stale license checks in background tasks
127
+ - Usage metering: report late or duplicate usage to avoid billing or to over-consume
128
+ </saas_b2b>
129
+ </special_contexts>
130
+
131
+ <chaining_attacks>
132
+ - Business logic + race: duplicate benefits before state updates
133
+ - Business logic + IDOR: operate on others' resources once a workflow leak reveals IDs
134
+ - Business logic + CSRF: force a victim to complete a sensitive step sequence
135
+ </chaining_attacks>
102
136
 
103
137
  <validation>
104
- To confirm business logic flaw:
105
- 1. Demonstrate financial impact
106
- 2. Show consistent reproduction
107
- 3. Prove bypass of intended restrictions
108
- 4. Document assumption violation
109
- 5. Quantify potential damage
138
+ 1. Show an invariant violation (e.g., two refunds for one charge, negative inventory, exceeding quotas).
139
+ 2. Provide side-by-side evidence for intended vs abused flows with the same principal.
140
+ 3. Demonstrate durability: the undesired state persists and is observable in authoritative sources (ledger, emails, admin views).
141
+ 4. Quantify impact per action and at scale (unit loss × feasible repetitions).
110
142
  </validation>
111
143
 
112
144
  <false_positives>
113
- NOT a business logic flaw if:
114
- - Requires technical vulnerability (SQLi, XSS)
115
- - Working as designed (bad design vulnerability)
116
- - Only affects display/UI
117
- - No security impact
118
- - Requires privileged access
145
+ - Promotional behavior explicitly allowed by policy (documented free trials, goodwill credits)
146
+ - Visual-only inconsistencies with no durable or exploitable state change
147
+ - Admin-only operations with proper audit and approvals
119
148
  </false_positives>
120
149
 
121
150
  <impact>
122
- - Financial loss (direct monetary impact)
123
- - Unauthorized access to features/data
124
- - Service disruption
125
- - Compliance violations
126
- - Reputation damage
151
+ - Direct financial loss (fraud, arbitrage, over-refunds, unpaid consumption)
152
+ - Regulatory/contractual violations (billing accuracy, consumer protection)
153
+ - Denial of inventory/services to legitimate users through resource exhaustion
154
+ - Privilege retention or unauthorized access to premium features
127
155
  </impact>
128
156
 
129
157
  <pro_tips>
130
- 1. Think like a malicious user, not a developer
131
- 2. Question every assumption
132
- 3. Test boundary conditions obsessively
133
- 4. Combine multiple small issues
134
- 5. Focus on money flows
135
- 6. Check state machines thoroughly
136
- 7. Abuse features, don't break them
137
- 8. Document business impact clearly
138
- 9. Test integration points
139
- 10. Time is often a factor - exploit it
158
+ 1. Start from invariants and ledgers, not UI—prove conservation of value breaks.
159
+ 2. Test with time and concurrency; many bugs only appear under pressure.
160
+ 3. Recompute totals server-side; never accept client math—flag when you observe otherwise.
161
+ 4. Treat idempotency and retries as first-class: verify key scope and persistence.
162
+ 5. Probe background workers and webhooks separately; they often skip auth and rule checks.
163
+ 6. Validate role/feature gates at the service that mutates state, not only at the edge.
164
+ 7. Explore end-of-period edges (month-end, trial end, DST) for rounding and window issues.
165
+ 8. Use minimal, auditable PoCs that demonstrate durable state change and exact loss.
166
+ 9. Chain with authorization tests (IDOR/Function-level access) to magnify impact.
167
+ 10. When in doubt, map the state machine; gaps appear where transitions lack server-side guards.
140
168
  </pro_tips>
141
169
 
142
- <remember>Business logic flaws are about understanding and exploiting the application's rules, not breaking them with technical attacks. The best findings come from deep understanding of the business domain.</remember>
170
+ <remember>Business logic security is the enforcement of domain invariants under adversarial sequencing, timing, and inputs. If any step trusts the client or prior steps, expect abuse.</remember>
143
171
  </business_logic_flaws_guide>
@@ -1,168 +1,174 @@
1
1
  <csrf_vulnerability_guide>
2
- <title>CROSS-SITE REQUEST FORGERY (CSRF) - ADVANCED EXPLOITATION</title>
2
+ <title>CROSS-SITE REQUEST FORGERY (CSRF)</title>
3
3
 
4
- <critical>CSRF forces authenticated users to execute unwanted actions, exploiting the trust a site has in the user's browser.</critical>
4
+ <critical>CSRF abuses ambient authority (cookies, HTTP auth) across origins. Do not rely on CORS alone; enforce non-replayable tokens and strict origin checks for every state change.</critical>
5
+
6
+ <scope>
7
+ - Web apps with cookie-based sessions and HTTP auth
8
+ - JSON/REST, GraphQL (GET/persisted queries), file upload endpoints
9
+ - Authentication flows: login/logout, password/email change, MFA toggles
10
+ - OAuth/OIDC: authorize, token, logout, disconnect/connect
11
+ </scope>
12
+
13
+ <methodology>
14
+ 1. Inventory all state-changing endpoints (including admin/staff) and note method, content-type, and whether they are reachable via top-level navigation or simple requests (no preflight).
15
+ 2. For each, determine session model (cookies with SameSite attrs, custom headers, tokens) and whether server enforces anti-CSRF tokens and Origin/Referer.
16
+ 3. Attempt preflightless delivery (form POST, text/plain, multipart/form-data) and top-level GET navigation.
17
+ 4. Validate across browsers; behavior differs by SameSite and navigation context.
18
+ </methodology>
5
19
 
6
20
  <high_value_targets>
7
- - Password/email change forms
8
- - Money transfer/payment functions
9
- - Account deletion/deactivation
10
- - Permission/role changes
11
- - API key generation/regeneration
12
- - OAuth connection/disconnection
13
- - 2FA enable/disable
14
- - Privacy settings modification
15
- - Admin functions
16
- - File uploads/deletions
21
+ - Credentials and profile changes (email/password/phone)
22
+ - Payment and money movement, subscription/plan changes
23
+ - API key/secret generation, PAT rotation, SSH keys
24
+ - 2FA/TOTP enable/disable; backup codes; device trust
25
+ - OAuth connect/disconnect; logout; account deletion
26
+ - Admin/staff actions and impersonation flows
27
+ - File uploads/deletes; access control changes
17
28
  </high_value_targets>
18
29
 
19
30
  <discovery_techniques>
20
- <token_analysis>
21
- Common token names: csrf_token, csrftoken, _csrf, authenticity_token, __RequestVerificationToken, X-CSRF-TOKEN
22
-
23
- Check if tokens are:
24
- - Actually validated (remove and test)
25
- - Tied to user session
26
- - Reusable across requests
27
- - Present in GET requests
28
- - Predictable or static
29
- </token_analysis>
30
-
31
- <http_methods>
32
- - Test if POST endpoints accept GET
33
- - Try method override headers: _method, X-HTTP-Method-Override
34
- - Check if PUT/DELETE lack protection
35
- </http_methods>
31
+ <session_and_cookies>
32
+ - Inspect cookies: HttpOnly, Secure, SameSite (Strict/Lax/None). Note that Lax allows cookies on top-level cross-site GET; None requires Secure.
33
+ - Determine if Authorization headers or bearer tokens are used (generally not CSRF-prone) versus cookies (CSRF-prone).
34
+ </session_and_cookies>
35
+
36
+ <token_and_header_checks>
37
+ - Locate anti-CSRF tokens (hidden inputs, meta tags, custom headers). Test removal, reuse across requests, reuse across sessions, and binding to method/path.
38
+ - Verify server checks Origin and/or Referer on state changes; test null/missing and cross-origin values.
39
+ </token_and_header_checks>
40
+
41
+ <method_and_content_types>
42
+ - Confirm whether GET, HEAD, or OPTIONS perform state changes.
43
+ - Try simple content-types to avoid preflight: application/x-www-form-urlencoded, multipart/form-data, text/plain.
44
+ - Probe parsers that auto-coerce text/plain or form-encoded bodies into JSON.
45
+ </method_and_content_types>
46
+
47
+ <cors_profile>
48
+ - Identify Access-Control-Allow-Origin and -Credentials. Overly permissive CORS is not a CSRF fix and can turn CSRF into data exfiltration.
49
+ - Test per-endpoint CORS differences; preflight vs simple request behavior can diverge.
50
+ </cors_profile>
36
51
  </discovery_techniques>
37
52
 
38
53
  <exploitation_techniques>
39
- <basic_forms>
40
- HTML form auto-submit:
41
- <form action="https://target.com/transfer" method="POST">
42
- <input name="amount" value="1000">
43
- <input name="to" value="attacker">
44
- </form>
45
- <script>document.forms[0].submit()</script>
46
- </basic_forms>
54
+ <navigation_csrf>
55
+ - Auto-submitting form to target origin; works when cookies are sent and no token/origin checks are enforced.
56
+ - Top-level GET navigation can trigger state if server misuses GET or links actions to GET callbacks.
57
+ </navigation_csrf>
58
+
59
+ <simple_ct_csrf>
60
+ - application/x-www-form-urlencoded and multipart/form-data POSTs do not require preflight; prefer these encodings.
61
+ - text/plain form bodies can slip through validators and be parsed server-side.
62
+ </simple_ct_csrf>
47
63
 
48
64
  <json_csrf>
49
- For JSON endpoints:
50
- <form enctype="text/plain" action="https://target.com/api">
51
- <input name='{% raw %}{"amount":1000,"to":"attacker","ignore":"{% endraw %}' value='"}'>
52
- </form>
65
+ - If server parses JSON from text/plain or form-encoded bodies, craft parameters to reconstruct JSON server-side.
66
+ - Some frameworks accept JSON keys via form fields (e.g., {% raw %}data[foo]=bar{% endraw %}) or treat duplicate keys leniently.
53
67
  </json_csrf>
54
68
 
55
- <multipart_csrf>
56
- For file uploads:
57
- Use XMLHttpRequest with credentials
58
- Generate multipart/form-data boundaries
59
- </multipart_csrf>
60
- </exploitation_techniques>
69
+ <login_logout_csrf>
70
+ - Force logout to clear CSRF tokens, then chain login CSRF to bind victim to attacker’s account.
71
+ - Login CSRF: submit attacker credentials to victim’s browser; later actions occur under attacker’s account.
72
+ </login_logout_csrf>
61
73
 
62
- <bypass_techniques>
63
- <token_bypasses>
64
- - Null token: remove parameter entirely
65
- - Empty token: csrf_token=
66
- - Token from own account: use your valid token
67
- - Token fixation: force known token value
68
- - Method interchange: GET token used for POST
69
- </token_bypasses>
70
-
71
- <header_bypasses>
72
- - Referer bypass: use data: URI, about:blank
73
- - Origin bypass: null origin via sandboxed iframe
74
- - CORS misconfigurations
75
- </header_bypasses>
76
-
77
- <content_type_tricks>
78
- - Change multipart to application/x-www-form-urlencoded
79
- - Use text/plain for JSON endpoints
80
- - Exploit parsers that accept multiple formats
81
- </content_type_tricks>
82
- </bypass_techniques>
74
+ <oauth_oidc_flows>
75
+ - Abuse authorize/logout endpoints reachable via GET or form POST without origin checks; exploit relaxed SameSite on top-level navigations.
76
+ - Open redirects or loose redirect_uri validation can chain with CSRF to force unintended authorizations.
77
+ </oauth_oidc_flows>
78
+
79
+ <file_and_action_endpoints>
80
+ - File upload/delete often lack token checks; forge multipart requests to modify storage.
81
+ - Admin actions exposed as simple POST links are frequently CSRFable.
82
+ </file_and_action_endpoints>
83
+ </exploitation_techniques>
83
84
 
84
85
  <advanced_techniques>
85
- <subdomain_csrf>
86
- - XSS on subdomain = CSRF on main domain
87
- - Cookie scope abuse (domain=.example.com)
88
- - Subdomain takeover for CSRF
89
- </subdomain_csrf>
90
-
91
- <csrf_login>
92
- - Force victim to login as attacker
93
- - Plant backdoors in victim's account
94
- - Access victim's future data
95
- </csrf_login>
96
-
97
- <csrf_logout>
98
- - Force logout → login CSRF → account takeover
99
- </csrf_logout>
100
-
101
- <double_submit_csrf>
102
- If using double-submit cookies:
103
- - Set cookie via XSS/subdomain
104
- - Cookie injection via header injection
105
- - Cookie tossing attacks
106
- </double_submit_csrf>
107
- </advanced_techniques>
86
+ <samesite_nuance>
87
+ - Lax-by-default cookies are sent on top-level cross-site GET but not POST; exploit GET state changes and GET-based confirmation steps.
88
+ - Legacy or nonstandard clients may ignore SameSite; validate across browsers/devices.
89
+ </samesite_nuance>
108
90
 
109
- <special_contexts>
110
- <websocket_csrf>
111
- - Cross-origin WebSocket hijacking
112
- - Steal tokens from WebSocket messages
113
- </websocket_csrf>
91
+ <origin_referer_obfuscation>
92
+ - Sandbox/iframes can produce null Origin; some frameworks incorrectly accept null.
93
+ - about:blank/data: URLs alter Referer; ensure server requires explicit Origin/Referer match.
94
+ </origin_referer_obfuscation>
95
+
96
+ <method_override>
97
+ - Backends honoring _method or X-HTTP-Method-Override may allow destructive actions through a simple POST.
98
+ </method_override>
114
99
 
115
100
  <graphql_csrf>
116
- - GET requests with query parameter
117
- - Batched mutations
118
- - Subscription abuse
101
+ - If queries/mutations are allowed via GET or persisted queries, exploit top-level navigation with encoded payloads.
102
+ - Batched operations may hide mutations within a nominally safe request.
119
103
  </graphql_csrf>
120
104
 
121
- <api_csrf>
122
- - Bearer tokens in URL parameters
123
- - API keys in GET requests
124
- - Insecure CORS policies
125
- </api_csrf>
105
+ <websocket_csrf>
106
+ - Browsers send cookies on WebSocket handshake; enforce Origin checks server-side. Without them, cross-site pages can open authenticated sockets and issue actions.
107
+ </websocket_csrf>
108
+ </advanced_techniques>
109
+
110
+ <bypass_techniques>
111
+ <token_weaknesses>
112
+ - Accepting missing/empty tokens; tokens not tied to session, user, or path; tokens reused indefinitely; tokens in GET.
113
+ - Double-submit cookie without Secure/HttpOnly, or with predictable token sources.
114
+ </token_weaknesses>
115
+
116
+ <content_type_switching>
117
+ - Switch between form, multipart, and text/plain to reach different code paths and validators.
118
+ - Use duplicate keys and array shapes to confuse parsers.
119
+ </content_type_switching>
120
+
121
+ <header_manipulation>
122
+ - Strip Referer via meta refresh or navigate from about:blank; test null Origin acceptance.
123
+ - Leverage misconfigured CORS to add custom headers that servers mistakenly treat as CSRF tokens.
124
+ </header_manipulation>
125
+ </bypass_techniques>
126
+
127
+ <special_contexts>
128
+ <mobile_spa>
129
+ - Deep links and embedded WebViews may auto-send cookies; trigger actions via crafted intents/links.
130
+ - SPAs that rely solely on bearer tokens are less CSRF-prone, but hybrid apps mixing cookies and APIs can still be vulnerable.
131
+ </mobile_spa>
132
+
133
+ <integrations>
134
+ - Webhooks and back-office tools sometimes expose state-changing GETs intended for staff; confirm CSRF defenses there too.
135
+ </integrations>
126
136
  </special_contexts>
127
137
 
138
+ <chaining_attacks>
139
+ - CSRF + IDOR: force actions on other users' resources once references are known.
140
+ - CSRF + Clickjacking: guide user interactions to bypass UI confirmations.
141
+ - CSRF + OAuth mix-up: bind victim sessions to unintended clients.
142
+ </chaining_attacks>
143
+
128
144
  <validation>
129
- To confirm CSRF:
130
- 1. Create working proof-of-concept
131
- 2. Test across browsers
132
- 3. Verify action completes successfully
133
- 4. No user interaction required (beyond visiting page)
134
- 5. Works with active session
145
+ 1. Demonstrate a cross-origin page that triggers a state change without user interaction beyond visiting.
146
+ 2. Show that removing the anti-CSRF control (token/header) is accepted, or that Origin/Referer are not verified.
147
+ 3. Prove behavior across at least two browsers or contexts (top-level nav vs XHR/fetch).
148
+ 4. Provide before/after state evidence for the same account.
149
+ 5. If defenses exist, show the exact condition under which they are bypassed (content-type, method override, null Origin).
135
150
  </validation>
136
151
 
137
152
  <false_positives>
138
- NOT CSRF if:
139
- - Requires valid CSRF token
140
- - SameSite cookies properly configured
141
- - Proper origin/referer validation
142
- - User interaction required
143
- - Only affects non-sensitive actions
153
+ - Token verification present and required; Origin/Referer enforced consistently.
154
+ - No cookies sent on cross-site requests (SameSite=Strict, no HTTP auth) and no state change via simple requests.
155
+ - Only idempotent, non-sensitive operations affected.
144
156
  </false_positives>
145
157
 
146
158
  <impact>
147
- - Account takeover
148
- - Financial loss
149
- - Data modification/deletion
150
- - Privilege escalation
151
- - Privacy violations
159
+ - Account state changes (email/password/MFA), session hijacking via login CSRF, financial operations, administrative actions.
160
+ - Durable authorization changes (role/permission flips, key rotations) and data loss.
152
161
  </impact>
153
162
 
154
163
  <pro_tips>
155
- 1. Check all state-changing operations
156
- 2. Test file upload endpoints
157
- 3. Look for token disclosure in URLs
158
- 4. Chain with XSS for token theft
159
- 5. Check mobile API endpoints
160
- 6. Test CORS configurations
161
- 7. Verify SameSite cookie settings
162
- 8. Look for method override possibilities
163
- 9. Test WebSocket endpoints
164
- 10. Document clear attack scenario
164
+ 1. Prefer preflightless vectors (form-encoded, multipart, text/plain) and top-level GET if available.
165
+ 2. Test login/logout, OAuth connect/disconnect, and account linking first.
166
+ 3. Validate Origin/Referer behavior explicitly; do not assume frameworks enforce them.
167
+ 4. Toggle SameSite and observe differences across navigation vs XHR.
168
+ 5. For GraphQL, attempt GET queries or persisted queries that carry mutations.
169
+ 6. Always try method overrides and parser differentials.
170
+ 7. Combine with clickjacking when visual confirmations block CSRF.
165
171
  </pro_tips>
166
172
 
167
- <remember>Modern CSRF requires creativity - look for token leaks, chain with other vulnerabilities, and focus on high-impact actions. SameSite cookies are not always properly configured.</remember>
173
+ <remember>CSRF is eliminated only when state changes require a secret the attacker cannot supply and the server verifies the caller’s origin. Tokens and Origin checks must hold across methods, content-types, and transports.</remember>
168
174
  </csrf_vulnerability_guide>