strix-agent 0.4.0__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.
- strix/__init__.py +0 -0
- strix/agents/StrixAgent/__init__.py +4 -0
- strix/agents/StrixAgent/strix_agent.py +89 -0
- strix/agents/StrixAgent/system_prompt.jinja +404 -0
- strix/agents/__init__.py +10 -0
- strix/agents/base_agent.py +518 -0
- strix/agents/state.py +163 -0
- strix/interface/__init__.py +4 -0
- strix/interface/assets/tui_styles.tcss +694 -0
- strix/interface/cli.py +230 -0
- strix/interface/main.py +500 -0
- strix/interface/tool_components/__init__.py +39 -0
- strix/interface/tool_components/agents_graph_renderer.py +123 -0
- strix/interface/tool_components/base_renderer.py +62 -0
- strix/interface/tool_components/browser_renderer.py +120 -0
- strix/interface/tool_components/file_edit_renderer.py +99 -0
- strix/interface/tool_components/finish_renderer.py +31 -0
- strix/interface/tool_components/notes_renderer.py +108 -0
- strix/interface/tool_components/proxy_renderer.py +255 -0
- strix/interface/tool_components/python_renderer.py +34 -0
- strix/interface/tool_components/registry.py +72 -0
- strix/interface/tool_components/reporting_renderer.py +53 -0
- strix/interface/tool_components/scan_info_renderer.py +64 -0
- strix/interface/tool_components/terminal_renderer.py +131 -0
- strix/interface/tool_components/thinking_renderer.py +29 -0
- strix/interface/tool_components/user_message_renderer.py +43 -0
- strix/interface/tool_components/web_search_renderer.py +28 -0
- strix/interface/tui.py +1274 -0
- strix/interface/utils.py +559 -0
- strix/llm/__init__.py +15 -0
- strix/llm/config.py +20 -0
- strix/llm/llm.py +465 -0
- strix/llm/memory_compressor.py +212 -0
- strix/llm/request_queue.py +87 -0
- strix/llm/utils.py +87 -0
- strix/prompts/README.md +64 -0
- strix/prompts/__init__.py +109 -0
- strix/prompts/cloud/.gitkeep +0 -0
- strix/prompts/coordination/root_agent.jinja +41 -0
- strix/prompts/custom/.gitkeep +0 -0
- strix/prompts/frameworks/fastapi.jinja +142 -0
- strix/prompts/frameworks/nextjs.jinja +126 -0
- strix/prompts/protocols/graphql.jinja +215 -0
- strix/prompts/reconnaissance/.gitkeep +0 -0
- strix/prompts/technologies/firebase_firestore.jinja +177 -0
- strix/prompts/technologies/supabase.jinja +189 -0
- strix/prompts/vulnerabilities/authentication_jwt.jinja +147 -0
- strix/prompts/vulnerabilities/broken_function_level_authorization.jinja +146 -0
- strix/prompts/vulnerabilities/business_logic.jinja +171 -0
- strix/prompts/vulnerabilities/csrf.jinja +174 -0
- strix/prompts/vulnerabilities/idor.jinja +195 -0
- strix/prompts/vulnerabilities/information_disclosure.jinja +222 -0
- strix/prompts/vulnerabilities/insecure_file_uploads.jinja +188 -0
- strix/prompts/vulnerabilities/mass_assignment.jinja +141 -0
- strix/prompts/vulnerabilities/open_redirect.jinja +177 -0
- strix/prompts/vulnerabilities/path_traversal_lfi_rfi.jinja +142 -0
- strix/prompts/vulnerabilities/race_conditions.jinja +164 -0
- strix/prompts/vulnerabilities/rce.jinja +154 -0
- strix/prompts/vulnerabilities/sql_injection.jinja +151 -0
- strix/prompts/vulnerabilities/ssrf.jinja +135 -0
- strix/prompts/vulnerabilities/subdomain_takeover.jinja +155 -0
- strix/prompts/vulnerabilities/xss.jinja +169 -0
- strix/prompts/vulnerabilities/xxe.jinja +184 -0
- strix/runtime/__init__.py +19 -0
- strix/runtime/docker_runtime.py +399 -0
- strix/runtime/runtime.py +29 -0
- strix/runtime/tool_server.py +205 -0
- strix/telemetry/__init__.py +4 -0
- strix/telemetry/tracer.py +337 -0
- strix/tools/__init__.py +64 -0
- strix/tools/agents_graph/__init__.py +16 -0
- strix/tools/agents_graph/agents_graph_actions.py +621 -0
- strix/tools/agents_graph/agents_graph_actions_schema.xml +226 -0
- strix/tools/argument_parser.py +121 -0
- strix/tools/browser/__init__.py +4 -0
- strix/tools/browser/browser_actions.py +236 -0
- strix/tools/browser/browser_actions_schema.xml +183 -0
- strix/tools/browser/browser_instance.py +533 -0
- strix/tools/browser/tab_manager.py +342 -0
- strix/tools/executor.py +305 -0
- strix/tools/file_edit/__init__.py +4 -0
- strix/tools/file_edit/file_edit_actions.py +141 -0
- strix/tools/file_edit/file_edit_actions_schema.xml +128 -0
- strix/tools/finish/__init__.py +4 -0
- strix/tools/finish/finish_actions.py +174 -0
- strix/tools/finish/finish_actions_schema.xml +45 -0
- strix/tools/notes/__init__.py +14 -0
- strix/tools/notes/notes_actions.py +191 -0
- strix/tools/notes/notes_actions_schema.xml +150 -0
- strix/tools/proxy/__init__.py +20 -0
- strix/tools/proxy/proxy_actions.py +101 -0
- strix/tools/proxy/proxy_actions_schema.xml +267 -0
- strix/tools/proxy/proxy_manager.py +785 -0
- strix/tools/python/__init__.py +4 -0
- strix/tools/python/python_actions.py +47 -0
- strix/tools/python/python_actions_schema.xml +131 -0
- strix/tools/python/python_instance.py +172 -0
- strix/tools/python/python_manager.py +131 -0
- strix/tools/registry.py +196 -0
- strix/tools/reporting/__init__.py +6 -0
- strix/tools/reporting/reporting_actions.py +63 -0
- strix/tools/reporting/reporting_actions_schema.xml +30 -0
- strix/tools/terminal/__init__.py +4 -0
- strix/tools/terminal/terminal_actions.py +35 -0
- strix/tools/terminal/terminal_actions_schema.xml +146 -0
- strix/tools/terminal/terminal_manager.py +151 -0
- strix/tools/terminal/terminal_session.py +447 -0
- strix/tools/thinking/__init__.py +4 -0
- strix/tools/thinking/thinking_actions.py +18 -0
- strix/tools/thinking/thinking_actions_schema.xml +52 -0
- strix/tools/web_search/__init__.py +4 -0
- strix/tools/web_search/web_search_actions.py +80 -0
- strix/tools/web_search/web_search_actions_schema.xml +83 -0
- strix_agent-0.4.0.dist-info/LICENSE +201 -0
- strix_agent-0.4.0.dist-info/METADATA +282 -0
- strix_agent-0.4.0.dist-info/RECORD +118 -0
- strix_agent-0.4.0.dist-info/WHEEL +4 -0
- strix_agent-0.4.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<mass_assignment_guide>
|
|
2
|
+
<title>MASS ASSIGNMENT</title>
|
|
3
|
+
|
|
4
|
+
<critical>Mass assignment binds client-supplied fields directly into models/DTOs without field-level allowlists. It commonly leads to privilege escalation, ownership changes, and unauthorized state transitions in modern APIs and GraphQL.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- REST/JSON, GraphQL inputs, form-encoded and multipart bodies
|
|
8
|
+
- Model binding in controllers/resolvers; ORM create/update helpers
|
|
9
|
+
- Writable nested relations, sparse/patch updates, bulk endpoints
|
|
10
|
+
</scope>
|
|
11
|
+
|
|
12
|
+
<methodology>
|
|
13
|
+
1. Identify create/update endpoints and GraphQL mutations. Capture full server responses to observe returned fields.
|
|
14
|
+
2. Build a candidate list of sensitive attributes per resource: role/isAdmin/permissions, ownerId/accountId/tenantId, status/state, plan/price, limits/quotas, feature flags, verification flags, balance/credits.
|
|
15
|
+
3. Inject candidates alongside legitimate updates across transports and encodings; compare before/after state and diffs across roles.
|
|
16
|
+
4. Repeat with nested objects, arrays, and alternative shapes (dot/bracket notation, duplicate keys) and in batch operations.
|
|
17
|
+
</methodology>
|
|
18
|
+
|
|
19
|
+
<discovery_techniques>
|
|
20
|
+
<surface_map>
|
|
21
|
+
- Controllers with automatic binding (e.g., request.json → model); GraphQL input types mirroring models; admin/staff tools exposed via API
|
|
22
|
+
- OpenAPI/GraphQL schemas: uncover hidden fields or enums; SDKs often reveal writable fields
|
|
23
|
+
- Client bundles and mobile apps: inspect forms and mutation payloads for field names
|
|
24
|
+
</surface_map>
|
|
25
|
+
|
|
26
|
+
<parameter_strategies>
|
|
27
|
+
- Flat fields: isAdmin, role, roles[], permissions[], status, plan, tier, premium, verified, emailVerified
|
|
28
|
+
- Ownership/tenancy: userId, ownerId, accountId, organizationId, tenantId, workspaceId
|
|
29
|
+
- Limits/quotas: usageLimit, seatCount, maxProjects, creditBalance
|
|
30
|
+
- Feature flags/gates: features, flags, betaAccess, allowImpersonation
|
|
31
|
+
- Billing: price, amount, currency, prorate, nextInvoice, trialEnd
|
|
32
|
+
</parameter_strategies>
|
|
33
|
+
|
|
34
|
+
<shape_variants>
|
|
35
|
+
- Alternate shapes: arrays vs scalars; nested JSON; objects under unexpected keys
|
|
36
|
+
- Dot/bracket paths: profile.role, profile[role], settings[roles][]
|
|
37
|
+
- Duplicate keys and precedence: {"role":"user","role":"admin"}
|
|
38
|
+
- Sparse/patch formats: JSON Patch/JSON Merge Patch; try adding forbidden paths or replacing protected fields
|
|
39
|
+
</shape_variants>
|
|
40
|
+
|
|
41
|
+
<encodings_and_channels>
|
|
42
|
+
- Content-types: application/json, application/x-www-form-urlencoded, multipart/form-data, text/plain (JSON via server coercion)
|
|
43
|
+
- GraphQL: add suspicious fields to input objects; overfetch response to detect changes
|
|
44
|
+
- Batch/bulk: arrays of objects; verify per-item allowlists not skipped
|
|
45
|
+
</encodings_and_channels>
|
|
46
|
+
|
|
47
|
+
<exploitation_techniques>
|
|
48
|
+
<privilege_escalation>
|
|
49
|
+
- Set role/isAdmin/permissions during signup/profile update; toggle admin/staff flags where exposed
|
|
50
|
+
</privilege_escalation>
|
|
51
|
+
|
|
52
|
+
<ownership_takeover>
|
|
53
|
+
- Change ownerId/accountId/tenantId to seize resources; move objects across users/tenants
|
|
54
|
+
</ownership_takeover>
|
|
55
|
+
|
|
56
|
+
<feature_gate_bypass>
|
|
57
|
+
- Enable premium/beta/feature flags via flags/features fields; raise limits/seatCount/quotas
|
|
58
|
+
</feature_gate_bypass>
|
|
59
|
+
|
|
60
|
+
<billing_and_entitlements>
|
|
61
|
+
- Modify plan/price/prorate/trialEnd or creditBalance; bypass server recomputation
|
|
62
|
+
</billing_and_entitlements>
|
|
63
|
+
|
|
64
|
+
<nested_and_relation_writes>
|
|
65
|
+
- Writable nested serializers or ORM relations allow creating or linking related objects beyond caller’s scope (e.g., attach to another user’s org)
|
|
66
|
+
</nested_and_relation_writes>
|
|
67
|
+
|
|
68
|
+
<advanced_techniques>
|
|
69
|
+
<graphQL_specific>
|
|
70
|
+
- Field-level authz missing on input types: attempt forbidden fields in mutation inputs; combine with aliasing/batching to compare effects
|
|
71
|
+
- Use fragments to overfetch changed fields immediately after mutation
|
|
72
|
+
</graphQL_specific>
|
|
73
|
+
|
|
74
|
+
<orm_framework_edges>
|
|
75
|
+
- Rails: strong parameters misconfig or deep nesting via accepts_nested_attributes_for
|
|
76
|
+
- Laravel: $fillable/$guarded misuses; guarded=[] opens all; casts mutating hidden fields
|
|
77
|
+
- Django REST Framework: writable nested serializer, read_only/extra_kwargs gaps, partial updates
|
|
78
|
+
- Mongoose/Prisma: schema paths not filtered; select:false doesn’t prevent writes; upsert defaults
|
|
79
|
+
</orm_framework_edges>
|
|
80
|
+
|
|
81
|
+
<parser_and_validator_gaps>
|
|
82
|
+
- Validators run post-bind and do not cover extra fields; unknown fields silently dropped in response but persisted underneath
|
|
83
|
+
- Inconsistent allowlists between mobile/web/gateway; alt encodings bypass validation pipeline
|
|
84
|
+
</parser_and_validator_gaps>
|
|
85
|
+
|
|
86
|
+
<bypass_techniques>
|
|
87
|
+
<content_type_switching>
|
|
88
|
+
- Switch JSON ↔ form-encoded ↔ multipart ↔ text/plain; some code paths only validate one
|
|
89
|
+
</content_type_switching>
|
|
90
|
+
|
|
91
|
+
<key_path_variants>
|
|
92
|
+
- Dot/bracket/object re-shaping to reach nested fields through different binders
|
|
93
|
+
</key_path_variants>
|
|
94
|
+
|
|
95
|
+
<batch_paths>
|
|
96
|
+
- Per-item checks skipped in bulk operations; insert a single malicious object within a large batch
|
|
97
|
+
</batch_paths>
|
|
98
|
+
|
|
99
|
+
<race_and_reorder>
|
|
100
|
+
- Race two updates: first sets forbidden field, second normalizes; final state may retain forbidden change
|
|
101
|
+
</race_and_reorder>
|
|
102
|
+
|
|
103
|
+
<validation>
|
|
104
|
+
1. Show a minimal request where adding a sensitive field changes persisted state for a non-privileged caller.
|
|
105
|
+
2. Provide before/after evidence (response body, subsequent GET, or GraphQL query) proving the forbidden attribute value.
|
|
106
|
+
3. Demonstrate consistency across at least two encodings or channels.
|
|
107
|
+
4. For nested/bulk, show that protected fields are written within child objects or array elements.
|
|
108
|
+
5. Quantify impact (e.g., role flip, cross-tenant move, quota increase) and reproducibility.
|
|
109
|
+
</validation>
|
|
110
|
+
|
|
111
|
+
<false_positives>
|
|
112
|
+
- Server recomputes derived fields (plan/price/role) ignoring client input
|
|
113
|
+
- Fields marked read-only and enforced consistently across encodings
|
|
114
|
+
- Only UI-side changes with no persisted effect
|
|
115
|
+
</false_positives>
|
|
116
|
+
|
|
117
|
+
<impact>
|
|
118
|
+
- Privilege escalation and admin feature access
|
|
119
|
+
- Cross-tenant or cross-account resource takeover
|
|
120
|
+
- Financial/billing manipulation and quota abuse
|
|
121
|
+
- Policy/approval bypass by toggling verification or status flags
|
|
122
|
+
</impact>
|
|
123
|
+
|
|
124
|
+
<pro_tips>
|
|
125
|
+
1. Build a sensitive-field dictionary per resource and fuzz systematically.
|
|
126
|
+
2. Always try alternate shapes and encodings; many validators are shape/CT-specific.
|
|
127
|
+
3. For GraphQL, diff the resource immediately after mutation; effects are often visible even if the mutation returns filtered fields.
|
|
128
|
+
4. Inspect SDKs/mobile apps for hidden field names and nested write examples.
|
|
129
|
+
5. Prefer minimal PoCs that prove durable state changes; avoid UI-only effects.
|
|
130
|
+
</pro_tips>
|
|
131
|
+
|
|
132
|
+
<mitigations>
|
|
133
|
+
- Enforce server-side allowlists per operation and role; deny unknown fields by default
|
|
134
|
+
- Separate input DTOs from domain models; map explicitly
|
|
135
|
+
- Recompute derived fields (role/plan/owner) from trusted context; ignore client values
|
|
136
|
+
- Lock nested writes to owned resources; validate foreign keys against caller scope
|
|
137
|
+
- For GraphQL, use input types that expose only permitted fields and enforce resolver-level checks
|
|
138
|
+
</mitigations>
|
|
139
|
+
|
|
140
|
+
<remember>Mass assignment is eliminated by explicit mapping and per-field authorization. Treat every client-supplied attribute—especially nested or batch inputs—as untrusted until validated against an allowlist and caller scope.</remember>
|
|
141
|
+
</mass_assignment_guide>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<open_redirect_vulnerability_guide>
|
|
2
|
+
<title>OPEN REDIRECT</title>
|
|
3
|
+
|
|
4
|
+
<critical>Open redirects enable phishing, OAuth/OIDC code and token theft, and allowlist bypass in server-side fetchers that follow redirects. Treat every redirect target as untrusted: canonicalize and enforce exact allowlists per scheme, host, and path.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- Server-driven redirects (HTTP 3xx Location) and client-driven redirects (window.location, meta refresh, SPA routers)
|
|
8
|
+
- OAuth/OIDC/SAML flows using redirect_uri, post_logout_redirect_uri, RelayState, returnTo/continue/next
|
|
9
|
+
- Multi-hop chains where only the first hop is validated
|
|
10
|
+
- Allowlist/canonicalization bypasses across URL parsers and reverse proxies
|
|
11
|
+
</scope>
|
|
12
|
+
|
|
13
|
+
<methodology>
|
|
14
|
+
1. Inventory all redirect surfaces: login/logout, password reset, SSO/OAuth flows, payment gateways, email links, invite/verification, unsubscribe, language/locale switches, /out or /r redirectors.
|
|
15
|
+
2. Build a test matrix of scheme×host×path variants and encoding/unicode forms. Compare server-side validation vs browser navigation results.
|
|
16
|
+
3. Exercise multi-hop: trusted-domain → redirector → external. Verify if validation applies pre- or post-redirect.
|
|
17
|
+
4. Prove impact: credential phishing, OAuth code interception, internal egress (if a server fetcher follows redirects).
|
|
18
|
+
</methodology>
|
|
19
|
+
|
|
20
|
+
<discovery_techniques>
|
|
21
|
+
<injection_points>
|
|
22
|
+
- Params: redirect, url, next, return_to, returnUrl, continue, goto, target, callback, out, dest, back, to, r, u
|
|
23
|
+
- OAuth/OIDC/SAML: redirect_uri, post_logout_redirect_uri, RelayState, state (if used to compute final destination)
|
|
24
|
+
- SPA: router.push/replace, location.assign/href, meta refresh, window.open
|
|
25
|
+
- Headers influencing construction: Host, X-Forwarded-Host/Proto, Referer; and server-side Location echo
|
|
26
|
+
</injection_points>
|
|
27
|
+
|
|
28
|
+
<parser_differentials>
|
|
29
|
+
<userinfo>
|
|
30
|
+
https://trusted.com@evil.com → many validators parse host as trusted.com, browser navigates to evil.com
|
|
31
|
+
Variants: trusted.com%40evil.com, a%40evil.com%40trusted.com
|
|
32
|
+
</userinfo>
|
|
33
|
+
|
|
34
|
+
<backslash_and_slashes>
|
|
35
|
+
https://trusted.com\\evil.com, https://trusted.com\\@evil.com, ///evil.com, /\\evil.com
|
|
36
|
+
Windows/backends may normalize \\ to /; browsers differ on interpretation of extra leading slashes
|
|
37
|
+
</backslash_and_slashes>
|
|
38
|
+
|
|
39
|
+
<whitespace_and_ctrl>
|
|
40
|
+
http%09://evil.com, http%0A://evil.com, trusted.com%09evil.com
|
|
41
|
+
Control/whitespace around the scheme/host can split parsers
|
|
42
|
+
</whitespace_and_ctrl>
|
|
43
|
+
|
|
44
|
+
<fragment_and_query>
|
|
45
|
+
trusted.com#@evil.com, trusted.com?//@evil.com, ?next=//evil.com#@trusted.com
|
|
46
|
+
Validators often stop at # while the browser parses after it
|
|
47
|
+
</fragment_and_query>
|
|
48
|
+
|
|
49
|
+
<unicode_and_idna>
|
|
50
|
+
Punycode/IDN: truѕted.com (Cyrillic), trusted.com。evil.com (full-width dot), trailing dot trusted.com.
|
|
51
|
+
Test with mixed Unicode normalization and IDNA conversion
|
|
52
|
+
</unicode_and_idna>
|
|
53
|
+
</parser_differentials>
|
|
54
|
+
|
|
55
|
+
<encoding_bypasses>
|
|
56
|
+
- Double encoding: %2f%2fevil.com, %252f%252fevil.com
|
|
57
|
+
- Mixed case and scheme smuggling: hTtPs://evil.com, http:evil.com
|
|
58
|
+
- IP variants: decimal 2130706433, octal 0177.0.0.1, hex 0x7f.1, IPv6 [::ffff:127.0.0.1]
|
|
59
|
+
- User-controlled path bases: /out?url=/\\evil.com
|
|
60
|
+
</encoding_bypasses>
|
|
61
|
+
</discovery_techniques>
|
|
62
|
+
|
|
63
|
+
<allowlist_evasion>
|
|
64
|
+
<common_mistakes>
|
|
65
|
+
- Substring/regex contains checks: allows trusted.com.evil.com, or path matches leaking external
|
|
66
|
+
- Wildcards: *.trusted.com also matches attacker.trusted.com.evil.net
|
|
67
|
+
- Missing scheme pinning: data:, javascript:, file:, gopher: accepted
|
|
68
|
+
- Case/IDN drift between validator and browser
|
|
69
|
+
</common_mistakes>
|
|
70
|
+
|
|
71
|
+
<robust_validation>
|
|
72
|
+
- Canonicalize with a single modern URL parser (WHATWG URL) and compare exact scheme, hostname (post-IDNA), and an explicit allowlist with optional exact path prefixes
|
|
73
|
+
- Require absolute HTTPS; reject protocol-relative // and unknown schemes
|
|
74
|
+
- Normalize and compare after following zero redirects only; if following, re-validate the final destination per hop server-side
|
|
75
|
+
</robust_validation>
|
|
76
|
+
</allowlist_evasion>
|
|
77
|
+
|
|
78
|
+
<oauth_oidc_saml>
|
|
79
|
+
<redirect_uri_abuse>
|
|
80
|
+
- Using an open redirect on a trusted domain for redirect_uri enables code interception
|
|
81
|
+
- Weak prefix/suffix checks: https://trusted.com → https://trusted.com.evil.com; /callback → /callback@evil.com
|
|
82
|
+
- Path traversal/canonicalization: /oauth/../../@evil.com
|
|
83
|
+
- post_logout_redirect_uri often less strictly validated; test both
|
|
84
|
+
- state must be unguessable and bound to client/session; do not recompute final destination from state without validation
|
|
85
|
+
</redirect_uri_abuse>
|
|
86
|
+
|
|
87
|
+
<defense_notes>
|
|
88
|
+
- Pre-register exact redirect_uri values per client (no wildcards). Enforce exact scheme/host/port/path match
|
|
89
|
+
- For public native apps, follow RFC guidance (loopback 127.0.0.1 with exact port handling); disallow open web redirectors
|
|
90
|
+
- SAML RelayState should be validated against an allowlist or ignored for absolute URLs
|
|
91
|
+
</defense_notes>
|
|
92
|
+
</oauth_oidc_saml>
|
|
93
|
+
|
|
94
|
+
<client_side_vectors>
|
|
95
|
+
<javascript_redirects>
|
|
96
|
+
- location.href/assign/replace using user input; ensure targets are normalized and restricted to same-origin or allowlist
|
|
97
|
+
- meta refresh content=0;url=USER_INPUT; browsers treat javascript:/data: differently; still dangerous in client-controlled redirects
|
|
98
|
+
- SPA routers: router.push(searchParams.get('next')); enforce same-origin and strip schemes
|
|
99
|
+
</javascript_redirects>
|
|
100
|
+
|
|
101
|
+
</client_side_vectors>
|
|
102
|
+
|
|
103
|
+
<reverse_proxies_and_gateways>
|
|
104
|
+
- Host/X-Forwarded-* may change absolute URL construction; validate against server-derived canonical origin, not client headers
|
|
105
|
+
- CDNs that follow redirects for link checking or prefetching can leak tokens when chained with open redirects
|
|
106
|
+
</reverse_proxies_and_gateways>
|
|
107
|
+
|
|
108
|
+
<ssrf_chaining>
|
|
109
|
+
- Some server-side fetchers (web previewers, link unfurlers, validators) follow 3xx; combine with an open redirect on an allowlisted domain to pivot to internal targets (169.254.169.254, localhost, cluster addresses)
|
|
110
|
+
- Confirm by observing distinct error/timing for internal vs external, or OAST callbacks when reachable
|
|
111
|
+
</ssrf_chaining>
|
|
112
|
+
|
|
113
|
+
<framework_notes>
|
|
114
|
+
<server_side>
|
|
115
|
+
- Rails: redirect_to params[:url] without URI parsing; test array params and protocol-relative
|
|
116
|
+
- Django: HttpResponseRedirect(request.GET['next']) without is_safe_url; relies on ALLOWED_HOSTS + scheme checks
|
|
117
|
+
- Spring: return "redirect:" + param; ensure UriComponentsBuilder normalization and allowlist
|
|
118
|
+
- Express: res.redirect(req.query.url); use a safe redirect helper enforcing relative paths or a vetted allowlist
|
|
119
|
+
</server_side>
|
|
120
|
+
|
|
121
|
+
<client_side>
|
|
122
|
+
- React/Next.js/Vue/Angular routing based on URLSearchParams; ensure same-origin policy and disallow external schemes in client code
|
|
123
|
+
</client_side>
|
|
124
|
+
</framework_notes>
|
|
125
|
+
|
|
126
|
+
<exploitation_scenarios>
|
|
127
|
+
<oauth_code_interception>
|
|
128
|
+
1. Set redirect_uri to https://trusted.example/out?url=https://attacker.tld/cb
|
|
129
|
+
2. IdP sends code to trusted.example which redirects to attacker.tld
|
|
130
|
+
3. Exchange code for tokens; demonstrate account access
|
|
131
|
+
</oauth_code_interception>
|
|
132
|
+
|
|
133
|
+
<phishing_flow>
|
|
134
|
+
1. Send link on trusted domain: /login?next=https://attacker.tld/fake
|
|
135
|
+
2. Victim authenticates; browser navigates to attacker page
|
|
136
|
+
3. Capture credentials/tokens via cloned UI or injected JS
|
|
137
|
+
</phishing_flow>
|
|
138
|
+
|
|
139
|
+
<internal_evasion>
|
|
140
|
+
1. Server-side link unfurler fetches https://trusted.example/out?u=http://169.254.169.254/latest/meta-data
|
|
141
|
+
2. Redirect follows to metadata; confirm via timing/headers or controlled endpoints
|
|
142
|
+
</internal_evasion>
|
|
143
|
+
</exploitation_scenarios>
|
|
144
|
+
|
|
145
|
+
<validation>
|
|
146
|
+
1. Produce a minimal URL that navigates to an external domain via the vulnerable surface; include the full address bar capture.
|
|
147
|
+
2. Show bypass of the stated validation (regex/allowlist) using canonicalization variants.
|
|
148
|
+
3. Test multi-hop: prove only first hop is validated and second hop escapes constraints.
|
|
149
|
+
4. For OAuth/SAML, demonstrate code/RelayState delivery to an attacker-controlled endpoint with role-separated evidence.
|
|
150
|
+
</validation>
|
|
151
|
+
|
|
152
|
+
<false_positives>
|
|
153
|
+
- Redirects constrained to relative same-origin paths with robust normalization
|
|
154
|
+
- Exact pre-registered OAuth redirect_uri with strict verifier
|
|
155
|
+
- Validators using a single canonical parser and comparing post-IDNA host and scheme
|
|
156
|
+
- User prompts that show the exact final destination before navigating and refuse unknown schemes
|
|
157
|
+
</false_positives>
|
|
158
|
+
|
|
159
|
+
<impact>
|
|
160
|
+
- Credential and token theft via phishing and OAuth/OIDC interception
|
|
161
|
+
- Internal data exposure when server fetchers follow redirects (previewers/unfurlers)
|
|
162
|
+
- Policy bypass where allowlists are enforced only on the first hop
|
|
163
|
+
- Cross-application trust erosion and brand abuse
|
|
164
|
+
</impact>
|
|
165
|
+
|
|
166
|
+
<pro_tips>
|
|
167
|
+
1. Always compare server-side canonicalization to real browser navigation; differences reveal bypasses.
|
|
168
|
+
2. Try userinfo, protocol-relative, Unicode/IDN, and IP numeric variants early; they catch many weak validators.
|
|
169
|
+
3. In OAuth, prioritize post_logout_redirect_uri and less-discussed flows; they’re often looser.
|
|
170
|
+
4. Exercise multi-hop across distinct subdomains and paths; validators commonly check only hop 1.
|
|
171
|
+
5. For SSRF chaining, target services known to follow redirects and log their outbound requests.
|
|
172
|
+
6. Favor allowlists of exact origins plus optional path prefixes; never substring/regex contains checks.
|
|
173
|
+
7. Keep a curated suite of redirect payloads per runtime (Java, Node, Python, Go) reflecting each parser’s quirks.
|
|
174
|
+
</pro_tips>
|
|
175
|
+
|
|
176
|
+
<remember>Redirection is safe only when the final destination is constrained after canonicalization. Enforce exact origins, verify per hop, and treat client-provided destinations as untrusted across every stack.</remember>
|
|
177
|
+
</open_redirect_vulnerability_guide>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<path_traversal_lfi_rfi_guide>
|
|
2
|
+
<title>PATH TRAVERSAL, LFI, AND RFI</title>
|
|
3
|
+
|
|
4
|
+
<critical>Improper file path handling and dynamic inclusion enable sensitive file disclosure, config/source leakage, SSRF pivots, and code execution. Treat all user-influenced paths, names, and schemes as untrusted; normalize and bind them to an allowlist or eliminate user control entirely.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- Path traversal: read files outside intended roots via ../, encoding, normalization gaps
|
|
8
|
+
- Local File Inclusion (LFI): include server-side files into interpreters/templates
|
|
9
|
+
- Remote File Inclusion (RFI): include remote resources (HTTP/FTP/wrappers) for code execution
|
|
10
|
+
- Archive extraction traversal (Zip Slip): write outside target directory upon unzip/untar
|
|
11
|
+
- Server/proxy normalization mismatches (nginx alias/root, upstream decoders)
|
|
12
|
+
- OS-specific paths: Windows separators, device names, UNC, NT paths, alternate data streams
|
|
13
|
+
</scope>
|
|
14
|
+
|
|
15
|
+
<methodology>
|
|
16
|
+
1. Inventory all file operations: downloads, previews, templates, logs, exports/imports, report engines, uploads, archive extractors.
|
|
17
|
+
2. Identify input joins: path joins (base + user), include/require/template loads, resource fetchers, archive extract destinations.
|
|
18
|
+
3. Probe normalization and resolution: separators, encodings, double-decodes, case, trailing dots/slashes; compare web server vs application behavior.
|
|
19
|
+
4. Escalate from disclosure (read) to influence (write/extract/include), then to execution (wrapper/engine chains).
|
|
20
|
+
</methodology>
|
|
21
|
+
|
|
22
|
+
<discovery_techniques>
|
|
23
|
+
<surface_map>
|
|
24
|
+
- HTTP params: file, path, template, include, page, view, download, export, report, log, dir, theme, lang
|
|
25
|
+
- Upload and conversion pipelines: image/PDF renderers, thumbnailers, office converters
|
|
26
|
+
- Archive extract endpoints and background jobs; imports with ZIP/TAR/GZ/7z
|
|
27
|
+
- Server-side template rendering (PHP/Smarty/Twig/Blade), email templates, CMS themes/plugins
|
|
28
|
+
- Reverse proxies and static file servers (nginx, CDN) in front of app handlers
|
|
29
|
+
</surface_map>
|
|
30
|
+
|
|
31
|
+
<capability_probes>
|
|
32
|
+
- Path traversal baseline: ../../etc/hosts and C:\\Windows\\win.ini
|
|
33
|
+
- Encodings: %2e%2e%2f, %252e%252e%252f, ..%2f, ..%5c, mixed UTF-8 (%c0%2e), Unicode dots and slashes
|
|
34
|
+
- Normalization tests: ....//, ..\\, ././, trailing dot/double dot segments; repeated decoding
|
|
35
|
+
- Absolute path acceptance: /etc/passwd, C:\\Windows\\System32\\drivers\\etc\\hosts
|
|
36
|
+
- Server mismatch: /static/..;/../etc/passwd ("..;"), encoded slashes (%2F), double-decoding via upstream
|
|
37
|
+
</capability_probes>
|
|
38
|
+
</discovery_techniques>
|
|
39
|
+
|
|
40
|
+
<detection_channels>
|
|
41
|
+
<direct>
|
|
42
|
+
- Response body discloses file content (text, binary, base64); error pages echo real paths
|
|
43
|
+
</direct>
|
|
44
|
+
|
|
45
|
+
<error_based>
|
|
46
|
+
- Exception messages expose canonicalized paths or include() warnings with real filesystem locations
|
|
47
|
+
</error_based>
|
|
48
|
+
|
|
49
|
+
<oast>
|
|
50
|
+
- RFI/LFI with wrappers that trigger outbound fetches (HTTP/DNS) to confirm inclusion/execution
|
|
51
|
+
</oast>
|
|
52
|
+
|
|
53
|
+
<side_effects>
|
|
54
|
+
- Archive extraction writes files unexpectedly outside target; verify with directory listings or follow-up reads
|
|
55
|
+
</side_effects>
|
|
56
|
+
</detection_channels>
|
|
57
|
+
|
|
58
|
+
<path_traversal>
|
|
59
|
+
<bypasses_and_variants>
|
|
60
|
+
- Encodings: single/double URL-encoding, mixed case, overlong UTF-8, UTF-16, path normalization oddities
|
|
61
|
+
- Mixed separators: / and \\ on Windows; // and \\\\ collapse differences across frameworks
|
|
62
|
+
- Dot tricks: ....// (double dot folding), trailing dots (Windows), trailing slashes, appended valid extension
|
|
63
|
+
- Absolute path injection: bypass joins by supplying a rooted path
|
|
64
|
+
- Alias/root mismatch (nginx): alias without trailing slash with nested location allows ../ to escape; try /static/../etc/passwd and ";" variants (..;)
|
|
65
|
+
- Upstream vs backend decoding: proxies/CDNs decoding %2f differently; test double-decoding and encoded dots
|
|
66
|
+
</bypasses_and_variants>
|
|
67
|
+
|
|
68
|
+
<high_value_targets>
|
|
69
|
+
- /etc/passwd, /etc/hosts, application .env/config.yaml, SSH/keys, cloud creds, service configs/logs
|
|
70
|
+
- Windows: C:\\Windows\\win.ini, IIS/web.config, programdata configs, application logs
|
|
71
|
+
- Source code templates and server-side includes; secrets in env dumps
|
|
72
|
+
</high_value_targets>
|
|
73
|
+
</path_traversal>
|
|
74
|
+
|
|
75
|
+
<lfi>
|
|
76
|
+
<wrappers_and_techniques>
|
|
77
|
+
- PHP wrappers: php://filter/convert.base64-encode/resource=index.php (read source), zip://archive.zip#file.txt, data://text/plain;base64, expect:// (if enabled)
|
|
78
|
+
- Log/session poisoning: inject PHP/templating payloads into access/error logs or session files then include them (paths vary by stack)
|
|
79
|
+
- Upload temp names: include temporary upload files before relocation; race with scanners
|
|
80
|
+
- /proc/self/environ and framework-specific caches for readable secrets
|
|
81
|
+
- Null-byte (legacy): %00 truncation in older stacks; path length truncation tricks
|
|
82
|
+
</wrappers_and_techniques>
|
|
83
|
+
|
|
84
|
+
<template_engines>
|
|
85
|
+
- PHP include/require; Smarty/Twig/Blade with dynamic template names
|
|
86
|
+
- Java/JSP/FreeMarker/Velocity; Node.js ejs/handlebars/pug engines
|
|
87
|
+
- Seek dynamic template resolution from user input (theme/lang/template)
|
|
88
|
+
</template_engines>
|
|
89
|
+
</lfi>
|
|
90
|
+
|
|
91
|
+
<rfi>
|
|
92
|
+
<conditions>
|
|
93
|
+
- Remote includes (allow_url_include/allow_url_fopen in PHP), custom fetchers that eval/execute retrieved content, SSRF-to-exec bridges
|
|
94
|
+
- Protocol handlers: http, https, ftp; language-specific stream handlers
|
|
95
|
+
</conditions>
|
|
96
|
+
|
|
97
|
+
<exploitation>
|
|
98
|
+
- Host a minimal payload that proves code execution; prefer OAST beacons or deterministic output over heavy shells
|
|
99
|
+
- Chain with upload or log poisoning when remote includes are disabled to reach local payloads
|
|
100
|
+
</exploitation>
|
|
101
|
+
</rfi>
|
|
102
|
+
|
|
103
|
+
<archive_extraction>
|
|
104
|
+
<zip_slip>
|
|
105
|
+
- Files within archives containing ../ or absolute paths escape target extract directory
|
|
106
|
+
- Test multiple formats: zip/tar/tgz/7z; verify symlink handling and path canonicalization prior to write
|
|
107
|
+
- Impact: overwrite config/templates or drop webshells into served directories
|
|
108
|
+
</zip_slip>
|
|
109
|
+
</archive_extraction>
|
|
110
|
+
|
|
111
|
+
<validation>
|
|
112
|
+
1. Show a minimal traversal read proving out-of-root access (e.g., /etc/hosts) with a same-endpoint in-root control.
|
|
113
|
+
2. For LFI, demonstrate inclusion of a benign local file or harmless wrapper output (php://filter base64 of index.php); avoid active code when not permitted.
|
|
114
|
+
3. For RFI, prove remote fetch by OAST or controlled output; avoid destructive payloads.
|
|
115
|
+
4. For Zip Slip, create an archive with ../ entries and show write outside target (e.g., marker file read back).
|
|
116
|
+
5. Provide before/after file paths, exact requests, and content hashes/lengths for reproducibility.
|
|
117
|
+
</validation>
|
|
118
|
+
|
|
119
|
+
<false_positives>
|
|
120
|
+
- In-app virtual paths that do not map to filesystem; content comes from safe stores (DB/object storage)
|
|
121
|
+
- Canonicalized paths constrained to an allowlist/root after normalization
|
|
122
|
+
- Wrappers disabled and includes using constant templates only
|
|
123
|
+
- Archive extractors that sanitize paths and enforce destination directories
|
|
124
|
+
</false_positives>
|
|
125
|
+
|
|
126
|
+
<impact>
|
|
127
|
+
- Sensitive configuration/source disclosure → credential and key compromise
|
|
128
|
+
- Code execution via inclusion of attacker-controlled content or overwritten templates
|
|
129
|
+
- Persistence via dropped files in served directories; lateral movement via revealed secrets
|
|
130
|
+
- Supply-chain impact when report/template engines execute attacker-influenced files
|
|
131
|
+
</impact>
|
|
132
|
+
|
|
133
|
+
<pro_tips>
|
|
134
|
+
1. Compare content-length/ETag when content is masked; read small canonical files (hosts) to avoid noise.
|
|
135
|
+
2. Test proxy/CDN and app separately; decoding/normalization order differs, especially for %2f and %2e encodings.
|
|
136
|
+
3. For LFI, prefer php://filter base64 probes over destructive payloads; enumerate readable logs and sessions.
|
|
137
|
+
4. Validate extraction code with synthetic archives; include symlinks and deep ../ chains.
|
|
138
|
+
5. Use minimal PoCs and hard evidence (hashes, paths). Avoid noisy DoS against filesystems.
|
|
139
|
+
</pro_tips>
|
|
140
|
+
|
|
141
|
+
<remember>Eliminate user-controlled paths where possible. Otherwise, resolve to canonical paths and enforce allowlists, forbid remote schemes, and lock down interpreters and extractors. Normalize consistently at the boundary closest to IO.</remember>
|
|
142
|
+
</path_traversal_lfi_rfi_guide>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<race_conditions_guide>
|
|
2
|
+
<title>RACE CONDITIONS</title>
|
|
3
|
+
|
|
4
|
+
<critical>Concurrency bugs enable duplicate state changes, quota bypass, financial abuse, and privilege errors. Treat every read–modify–write and multi-step workflow as adversarially concurrent.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- Read–modify–write sequences without atomicity or proper locking
|
|
8
|
+
- Multi-step operations (check → reserve → commit) with gaps between phases
|
|
9
|
+
- Cross-service workflows (sagas, async jobs) with eventual consistency
|
|
10
|
+
- Rate limits, quotas, and idempotency controls implemented at the edge only
|
|
11
|
+
</scope>
|
|
12
|
+
|
|
13
|
+
<methodology>
|
|
14
|
+
1. Model invariants for each workflow (e.g., conservation of value, uniqueness, maximums). Identify reads and writes and where they occur (service, DB, cache).
|
|
15
|
+
2. Establish a baseline with single requests. Then issue concurrent requests with identical inputs. Observe deltas in state and responses.
|
|
16
|
+
3. Scale and synchronize: ramp up parallelism, switch transports (HTTP/1.1, HTTP/2), and align request timing (last-byte sync, warmed connections).
|
|
17
|
+
4. Repeat across channels (web, API, GraphQL, WebSocket) and roles. Confirm durability and reproducibility.
|
|
18
|
+
</methodology>
|
|
19
|
+
|
|
20
|
+
<discovery_techniques>
|
|
21
|
+
<identify_race_windows>
|
|
22
|
+
- Look for explicit sequences in code or docs: "check balance then deduct", "verify coupon then apply", "check inventory then purchase", "validate token then consume"
|
|
23
|
+
- Watch for optimistic concurrency markers: ETag/If-Match, version fields, updatedAt checks; test if they are enforced
|
|
24
|
+
- Examine idempotency-key support: scope (path vs principal), TTL, and persistence (cache vs DB)
|
|
25
|
+
- Map cross-service steps: when is state written vs published, and what retries/compensations exist
|
|
26
|
+
</identify_race_windows>
|
|
27
|
+
|
|
28
|
+
<signals>
|
|
29
|
+
- Sequential request fails but parallel succeeds
|
|
30
|
+
- Duplicate rows, negative counters, over-issuance, or inconsistent aggregates
|
|
31
|
+
- Distinct response shapes/timings for simultaneous vs sequential requests
|
|
32
|
+
- Audit logs out of order; multiple 2xx for the same intent; missing or duplicate correlation IDs
|
|
33
|
+
</signals>
|
|
34
|
+
|
|
35
|
+
<surface_map>
|
|
36
|
+
- Payments: auth/capture/refund/void; credits/loyalty points; gift cards
|
|
37
|
+
- Coupons/discounts: single-use codes, stacking checks, per-user limits
|
|
38
|
+
- Quotas/limits: API usage, inventory reservations, seat counts, vote limits
|
|
39
|
+
- Auth flows: password reset/OTP consumption, session minting, device trust
|
|
40
|
+
- File/object storage: multi-part finalize, version writes, share-link generation
|
|
41
|
+
- Background jobs: export/import create/finalize endpoints; job cancellation/approve
|
|
42
|
+
- GraphQL mutations and batch operations; WebSocket actions
|
|
43
|
+
</surface_map>
|
|
44
|
+
</discovery_techniques>
|
|
45
|
+
|
|
46
|
+
<exploitation_techniques>
|
|
47
|
+
<request_synchronization>
|
|
48
|
+
- HTTP/2 multiplexing for tight concurrency; send many requests on warmed connections
|
|
49
|
+
- Last-byte synchronization: hold requests open and release final byte simultaneously
|
|
50
|
+
- Connection warming: pre-establish sessions, cookies, and TLS to remove jitter
|
|
51
|
+
</request_synchronization>
|
|
52
|
+
|
|
53
|
+
<idempotency_and_dedup_bypass>
|
|
54
|
+
- Reuse the same idempotency key across different principals/paths if scope is inadequate
|
|
55
|
+
- Hit the endpoint before the idempotency store is written (cache-before-commit windows)
|
|
56
|
+
- App-level dedup drops only the response while side effects (emails/credits) still occur
|
|
57
|
+
</idempotency_and_dedup_bypass>
|
|
58
|
+
|
|
59
|
+
<atomicity_gaps>
|
|
60
|
+
- Lost update: read-modify-write increments without atomic DB statements
|
|
61
|
+
- Partial two-phase workflows: success committed before validation completes
|
|
62
|
+
- Unique checks done outside a unique index/upsert: create duplicates under load
|
|
63
|
+
</atomicity_gaps>
|
|
64
|
+
|
|
65
|
+
<cross_service_races>
|
|
66
|
+
- Saga/compensation timing gaps: execute compensation without preventing the original success path
|
|
67
|
+
- Eventual consistency windows: act in Service B before Service A's write is visible
|
|
68
|
+
- Retry storms: duplicate side effects due to at-least-once delivery without idempotent consumers
|
|
69
|
+
</cross_service_races>
|
|
70
|
+
|
|
71
|
+
<rate_limits_and_quotas>
|
|
72
|
+
- Per-IP or per-connection enforcement: bypass with multiple IPs/sessions
|
|
73
|
+
- Counter updates not atomic or sharded inconsistently; send bursts before counters propagate
|
|
74
|
+
</rate_limits_and_quotas>
|
|
75
|
+
</exploitation_techniques>
|
|
76
|
+
|
|
77
|
+
<advanced_techniques>
|
|
78
|
+
<optimistic_concurrency_evasion>
|
|
79
|
+
- Omit If-Match/ETag where optional; supply stale versions if server ignores them
|
|
80
|
+
- Version fields accepted but not validated across all code paths (e.g., GraphQL vs REST)
|
|
81
|
+
</optimistic_concurrency_evasion>
|
|
82
|
+
|
|
83
|
+
<database_isolation>
|
|
84
|
+
- Exploit READ COMMITTED/REPEATABLE READ anomalies: phantoms, non-serializable sequences
|
|
85
|
+
- Upsert races: use unique indexes with proper ON CONFLICT/UPSERT or exploit naive existence checks
|
|
86
|
+
- Lock granularity issues: row vs table; application locks held only in-process
|
|
87
|
+
</database_isolation>
|
|
88
|
+
|
|
89
|
+
<distributed_locks>
|
|
90
|
+
- Redis locks without NX/EX or fencing tokens allow multiple winners
|
|
91
|
+
- Locks stored in memory on a single node; bypass by hitting other nodes/regions
|
|
92
|
+
</distributed_locks>
|
|
93
|
+
</advanced_techniques>
|
|
94
|
+
|
|
95
|
+
<bypass_techniques>
|
|
96
|
+
- Distribute across IPs, sessions, and user accounts to evade per-entity throttles
|
|
97
|
+
- Switch methods/content-types/endpoints that trigger the same state change via different code paths
|
|
98
|
+
- Intentionally trigger timeouts to provoke retries that cause duplicate side effects
|
|
99
|
+
- Degrade the target (large payloads, slow endpoints) to widen race windows
|
|
100
|
+
</bypass_techniques>
|
|
101
|
+
|
|
102
|
+
<special_contexts>
|
|
103
|
+
<graphql>
|
|
104
|
+
- Parallel mutations and batched operations may bypass per-mutation guards; ensure resolver-level idempotency and atomicity
|
|
105
|
+
- Persisted queries and aliases can hide multiple state changes in one request
|
|
106
|
+
</graphql>
|
|
107
|
+
|
|
108
|
+
<websocket>
|
|
109
|
+
- Per-message authorization and idempotency must hold; concurrent emits can create duplicates if only the handshake is checked
|
|
110
|
+
</websocket>
|
|
111
|
+
|
|
112
|
+
<files_and_storage>
|
|
113
|
+
- Parallel finalize/complete on multi-part uploads can create duplicate or corrupted objects; re-use pre-signed URLs concurrently
|
|
114
|
+
</files_and_storage>
|
|
115
|
+
|
|
116
|
+
<auth_flows>
|
|
117
|
+
- Concurrent consumption of one-time tokens (reset codes, magic links) to mint multiple sessions; verify consume is atomic
|
|
118
|
+
</auth_flows>
|
|
119
|
+
</special_contexts>
|
|
120
|
+
|
|
121
|
+
<chaining_attacks>
|
|
122
|
+
- Race + Business logic: violate invariants (double-refund, limit slicing)
|
|
123
|
+
- Race + IDOR: modify or read others' resources before ownership checks complete
|
|
124
|
+
- Race + CSRF: trigger parallel actions from a victim to amplify effects
|
|
125
|
+
- Race + Caching: stale caches re-serve privileged states after concurrent changes
|
|
126
|
+
</chaining_attacks>
|
|
127
|
+
|
|
128
|
+
<validation>
|
|
129
|
+
1. Single request denied; N concurrent requests succeed where only 1 should.
|
|
130
|
+
2. Durable state change proven (ledger entries, inventory counts, role/flag changes).
|
|
131
|
+
3. Reproducible under controlled synchronization (HTTP/2, last-byte sync) across multiple runs.
|
|
132
|
+
4. Evidence across channels (e.g., REST and GraphQL) if applicable.
|
|
133
|
+
5. Include before/after state and exact request set used.
|
|
134
|
+
</validation>
|
|
135
|
+
|
|
136
|
+
<false_positives>
|
|
137
|
+
- Truly idempotent operations with enforced ETag/version checks or unique constraints
|
|
138
|
+
- Serializable transactions or correct advisory locks/queues
|
|
139
|
+
- Visual-only glitches without durable state change
|
|
140
|
+
- Rate limits that reject excess with atomic counters
|
|
141
|
+
</false_positives>
|
|
142
|
+
|
|
143
|
+
<impact>
|
|
144
|
+
- Financial loss (double spend, over-issuance of credits/refunds)
|
|
145
|
+
- Policy/limit bypass (quotas, single-use tokens, seat counts)
|
|
146
|
+
- Data integrity corruption and audit trail inconsistencies
|
|
147
|
+
- Privilege or role errors due to concurrent updates
|
|
148
|
+
</impact>
|
|
149
|
+
|
|
150
|
+
<pro_tips>
|
|
151
|
+
1. Favor HTTP/2 with warmed connections; add last-byte sync for precision.
|
|
152
|
+
2. Start small (N=5–20), then scale; too much noise can mask the window.
|
|
153
|
+
3. Target read–modify–write code paths and endpoints with idempotency keys.
|
|
154
|
+
4. Compare REST vs GraphQL vs WebSocket; protections often differ.
|
|
155
|
+
5. Look for cross-service gaps (queues, jobs, webhooks) and retry semantics.
|
|
156
|
+
6. Check unique constraints and upsert usage; avoid relying on pre-insert checks.
|
|
157
|
+
7. Use correlation IDs and logs to prove concurrent interleaving.
|
|
158
|
+
8. Widen windows by adding server load or slow backend dependencies.
|
|
159
|
+
9. Validate on production-like latency; some races only appear under real load.
|
|
160
|
+
10. Document minimal, repeatable request sets that demonstrate durable impact.
|
|
161
|
+
</pro_tips>
|
|
162
|
+
|
|
163
|
+
<remember>Concurrency safety is a property of every path that mutates state. If any path lacks atomicity, proper isolation, or idempotency, parallel requests will eventually break invariants.</remember>
|
|
164
|
+
</race_conditions_guide>
|