strix-agent 0.1.17__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 (41) 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 +81 -24
  7. strix/cli/tool_components/base_renderer.py +2 -2
  8. strix/cli/tool_components/reporting_renderer.py +2 -1
  9. strix/llm/llm.py +9 -0
  10. strix/prompts/README.md +64 -0
  11. strix/prompts/__init__.py +1 -1
  12. strix/prompts/cloud/.gitkeep +0 -0
  13. strix/prompts/custom/.gitkeep +0 -0
  14. strix/prompts/frameworks/fastapi.jinja +142 -0
  15. strix/prompts/frameworks/nextjs.jinja +126 -0
  16. strix/prompts/protocols/graphql.jinja +215 -0
  17. strix/prompts/reconnaissance/.gitkeep +0 -0
  18. strix/prompts/technologies/firebase_firestore.jinja +177 -0
  19. strix/prompts/technologies/supabase.jinja +189 -0
  20. strix/prompts/vulnerabilities/authentication_jwt.jinja +133 -115
  21. strix/prompts/vulnerabilities/broken_function_level_authorization.jinja +146 -0
  22. strix/prompts/vulnerabilities/business_logic.jinja +146 -118
  23. strix/prompts/vulnerabilities/csrf.jinja +137 -131
  24. strix/prompts/vulnerabilities/idor.jinja +149 -118
  25. strix/prompts/vulnerabilities/insecure_file_uploads.jinja +188 -0
  26. strix/prompts/vulnerabilities/mass_assignment.jinja +141 -0
  27. strix/prompts/vulnerabilities/path_traversal_lfi_rfi.jinja +142 -0
  28. strix/prompts/vulnerabilities/race_conditions.jinja +135 -165
  29. strix/prompts/vulnerabilities/rce.jinja +128 -180
  30. strix/prompts/vulnerabilities/sql_injection.jinja +128 -192
  31. strix/prompts/vulnerabilities/ssrf.jinja +118 -151
  32. strix/prompts/vulnerabilities/xss.jinja +144 -196
  33. strix/prompts/vulnerabilities/xxe.jinja +151 -243
  34. strix/tools/agents_graph/agents_graph_actions.py +4 -3
  35. strix/tools/agents_graph/agents_graph_actions_schema.xml +10 -14
  36. strix/tools/registry.py +1 -1
  37. {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/METADATA +55 -16
  38. {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/RECORD +41 -28
  39. {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/LICENSE +0 -0
  40. {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/WHEEL +0 -0
  41. {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/entry_points.txt +0 -0
@@ -1,194 +1,164 @@
1
1
  <race_conditions_guide>
2
- <title>RACE CONDITIONS - TIME-OF-CHECK TIME-OF-USE (TOCTOU) MASTERY</title>
3
-
4
- <critical>Race conditions lead to financial fraud, privilege escalation, and business logic bypass. Often overlooked but devastating.</critical>
5
-
6
- <high_value_targets>
7
- - Payment/checkout processes
8
- - Coupon/discount redemption
9
- - Account balance operations
10
- - Voting/rating systems
11
- - Limited resource allocation
12
- - User registration (username claims)
13
- - Password reset flows
14
- - File upload/processing
15
- - API rate limits
16
- - Loyalty points/rewards
17
- - Stock/inventory management
18
- - Withdrawal functions
19
- </high_value_targets>
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>
20
19
 
21
20
  <discovery_techniques>
22
21
  <identify_race_windows>
23
- Multi-step processes with gaps between:
24
- 1. Check phase (validation/verification)
25
- 2. Use phase (action execution)
26
- 3. Write phase (state update)
27
-
28
- Look for:
29
- - "Check balance then deduct"
30
- - "Verify coupon then apply"
31
- - "Check inventory then purchase"
32
- - "Validate token then consume"
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
33
26
  </identify_race_windows>
34
27
 
35
- <detection_methods>
36
- - Parallel requests with same data
37
- - Rapid sequential requests
38
- - Monitor for inconsistent states
39
- - Database transaction analysis
40
- - Response timing variations
41
- </detection_methods>
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>
42
44
  </discovery_techniques>
43
45
 
44
- <exploitation_tools>
45
- <turbo_intruder>
46
- Python script for Burp Suite Turbo Intruder:
47
- ```python
48
- def queueRequests(target, wordlists):
49
- engine = RequestEngine(endpoint=target.endpoint,
50
- concurrentConnections=30,
51
- requestsPerConnection=100,
52
- pipeline=False)
53
-
54
- for i in range(30):
55
- engine.queue(target.req, gate='race1')
56
-
57
- engine.openGate('race1')
58
- ```
59
- </turbo_intruder>
60
-
61
- <manual_methods>
62
- - Browser developer tools (multiple tabs)
63
- - curl with & for background: curl url & curl url &
64
- - Python asyncio/aiohttp
65
- - Go routines
66
- - Node.js Promise.all()
67
- </manual_methods>
68
- </exploitation_tools>
69
-
70
- <common_vulnerabilities>
71
- <financial_races>
72
- - Double withdrawal
73
- - Multiple discount applications
74
- - Balance transfer duplication
75
- - Payment bypass
76
- - Cashback multiplication
77
- </financial_races>
78
-
79
- <authentication_races>
80
- - Multiple password resets
81
- - Account creation with same email
82
- - 2FA bypass
83
- - Session generation collision
84
- </authentication_races>
85
-
86
- <resource_races>
87
- - Inventory depletion bypass
88
- - Rate limit circumvention
89
- - File overwrite
90
- - Token reuse
91
- </resource_races>
92
- </common_vulnerabilities>
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>
93
76
 
94
77
  <advanced_techniques>
95
- <single_packet_attack>
96
- HTTP/2 multiplexing for true simultaneous delivery:
97
- - All requests in single TCP packet
98
- - Microsecond precision
99
- - Bypass even mutex locks
100
- </single_packet_attack>
101
-
102
- <last_byte_sync>
103
- Send all but last byte, then:
104
- 1. Hold connections open
105
- 2. Send final byte simultaneously
106
- 3. Achieve nanosecond precision
107
- </last_byte_sync>
108
-
109
- <connection_warming>
110
- Pre-establish connections:
111
- 1. Create connection pool
112
- 2. Prime with dummy requests
113
- 3. Send race requests on warm connections
114
- </connection_warming>
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>
115
93
  </advanced_techniques>
116
94
 
117
95
  <bypass_techniques>
118
- <distributed_attacks>
119
- - Multiple source IPs
120
- - Different user sessions
121
- - Varied request headers
122
- - Geographic distribution
123
- </distributed_attacks>
124
-
125
- <timing_optimization>
126
- - Measure server processing time
127
- - Align requests with server load
128
- - Exploit maintenance windows
129
- - Target async operations
130
- </timing_optimization>
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
131
100
  </bypass_techniques>
132
101
 
133
- <specific_scenarios>
134
- <limit_bypass>
135
- "Limited to 1 per user" Send N parallel requests
136
- Results: N successful purchases
137
- </limit_bypass>
138
-
139
- <balance_manipulation>
140
- Transfer $100 from account with $100 balance:
141
- - 10 parallel transfers
142
- - Each checks balance: $100 available
143
- - All proceed: -$900 balance
144
- </balance_manipulation>
145
-
146
- <vote_manipulation>
147
- Single vote limit:
148
- - Send multiple vote requests simultaneously
149
- - All pass validation
150
- - Multiple votes counted
151
- </vote_manipulation>
152
- </specific_scenarios>
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>
153
127
 
154
128
  <validation>
155
- To confirm race condition:
156
- 1. Demonstrate parallel execution success
157
- 2. Show single request fails
158
- 3. Prove timing dependency
159
- 4. Document financial/security impact
160
- 5. Achieve consistent reproduction
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.
161
134
  </validation>
162
135
 
163
136
  <false_positives>
164
- NOT a race condition if:
165
- - Idempotent operations
166
- - Proper locking mechanisms
167
- - Atomic database operations
168
- - Queue-based processing
169
- - No security impact
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
170
141
  </false_positives>
171
142
 
172
143
  <impact>
173
- - Financial loss (double spending)
174
- - Resource exhaustion
175
- - Data corruption
176
- - Business logic bypass
177
- - Privilege escalation
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
178
148
  </impact>
179
149
 
180
150
  <pro_tips>
181
- 1. Use HTTP/2 for better synchronization
182
- 2. Automate with Turbo Intruder
183
- 3. Test payment flows extensively
184
- 4. Monitor database locks
185
- 5. Try different concurrency levels
186
- 6. Test async operations
187
- 7. Look for compensating transactions
188
- 8. Check mobile app endpoints
189
- 9. Test during high load
190
- 10. Document exact timing windows
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.
191
161
  </pro_tips>
192
162
 
193
- <remember>Modern race conditions require microsecond precision. Focus on financial operations and limited resource allocation. Single-packet attacks are most reliable.</remember>
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>
194
164
  </race_conditions_guide>