strix-agent 0.1.18__py3-none-any.whl → 0.3.1__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 +49 -39
- strix/agents/StrixAgent/system_prompt.jinja +23 -10
- strix/agents/base_agent.py +90 -10
- strix/agents/state.py +23 -2
- strix/interface/cli.py +171 -0
- strix/interface/main.py +482 -0
- strix/{cli → interface}/tool_components/base_renderer.py +2 -2
- strix/{cli → interface}/tool_components/reporting_renderer.py +2 -1
- strix/{cli → interface}/tool_components/scan_info_renderer.py +17 -12
- strix/{cli/app.py → interface/tui.py} +107 -31
- strix/interface/utils.py +435 -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/runtime/docker_runtime.py +28 -7
- strix/runtime/runtime.py +4 -1
- strix/telemetry/__init__.py +4 -0
- strix/{cli → telemetry}/tracer.py +21 -9
- strix/tools/agents_graph/agents_graph_actions.py +17 -12
- strix/tools/agents_graph/agents_graph_actions_schema.xml +10 -14
- strix/tools/executor.py +1 -1
- strix/tools/finish/finish_actions.py +1 -1
- strix/tools/registry.py +1 -1
- strix/tools/reporting/reporting_actions.py +1 -1
- {strix_agent-0.1.18.dist-info → strix_agent-0.3.1.dist-info}/METADATA +95 -15
- strix_agent-0.3.1.dist-info/RECORD +115 -0
- strix_agent-0.3.1.dist-info/entry_points.txt +3 -0
- strix/cli/main.py +0 -702
- strix_agent-0.1.18.dist-info/RECORD +0 -99
- strix_agent-0.1.18.dist-info/entry_points.txt +0 -3
- /strix/{cli → interface}/__init__.py +0 -0
- /strix/{cli/assets/cli.tcss → interface/assets/tui_styles.tcss} +0 -0
- /strix/{cli → interface}/tool_components/__init__.py +0 -0
- /strix/{cli → interface}/tool_components/agents_graph_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/browser_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/file_edit_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/finish_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/notes_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/proxy_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/python_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/registry.py +0 -0
- /strix/{cli → interface}/tool_components/terminal_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/thinking_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/user_message_renderer.py +0 -0
- /strix/{cli → interface}/tool_components/web_search_renderer.py +0 -0
- {strix_agent-0.1.18.dist-info → strix_agent-0.3.1.dist-info}/LICENSE +0 -0
- {strix_agent-0.1.18.dist-info → strix_agent-0.3.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<insecure_file_uploads_guide>
|
|
2
|
+
<title>INSECURE FILE UPLOADS</title>
|
|
3
|
+
|
|
4
|
+
<critical>Upload surfaces are high risk: server-side execution (RCE), stored XSS, malware distribution, storage takeover, and DoS. Modern stacks mix direct-to-cloud uploads, background processors, and CDNs—authorization and validation must hold across every step.</critical>
|
|
5
|
+
|
|
6
|
+
<scope>
|
|
7
|
+
- Web/mobile/API uploads, direct-to-cloud (S3/GCS/Azure) presigned flows, resumable/multipart protocols (tus, S3 MPU)
|
|
8
|
+
- Image/document/media pipelines (ImageMagick/GraphicsMagick, Ghostscript, ExifTool, PDF engines, office converters)
|
|
9
|
+
- Admin/bulk importers, archive uploads (zip/tar), report/template uploads, rich text with attachments
|
|
10
|
+
- Serving paths: app directly, object storage, CDN, email attachments, previews/thumbnails
|
|
11
|
+
</scope>
|
|
12
|
+
|
|
13
|
+
<methodology>
|
|
14
|
+
1. Map the pipeline: client → ingress (edge/app/gateway) → storage → processors (thumb, OCR, AV, CDR) → serving (app/storage/CDN). Note where validation and auth occur.
|
|
15
|
+
2. Identify allowed types, size limits, filename rules, storage keys, and who serves the content. Collect baseline uploads per type and capture resulting URLs and headers.
|
|
16
|
+
3. Exercise bypass families systematically: extension games, MIME/content-type, magic bytes, polyglots, metadata payloads, archive structure, chunk/finalize differentials.
|
|
17
|
+
4. Validate execution and rendering: can uploaded content execute on server or client? Confirm with minimal PoCs and headers analysis.
|
|
18
|
+
</methodology>
|
|
19
|
+
|
|
20
|
+
<discovery_techniques>
|
|
21
|
+
<surface_map>
|
|
22
|
+
- Endpoints/fields: upload, file, avatar, image, attachment, import, media, document, template
|
|
23
|
+
- Direct-to-cloud params: key, bucket, acl, Content-Type, Content-Disposition, x-amz-meta-*, cache-control
|
|
24
|
+
- Resumable APIs: create/init → upload/chunk → complete/finalize; check if metadata/headers can be altered late
|
|
25
|
+
- Background processors: thumbnails, PDF→image, virus scan queues; identify timing and status transitions
|
|
26
|
+
</surface_map>
|
|
27
|
+
|
|
28
|
+
<capability_probes>
|
|
29
|
+
- Small probe files of each claimed type; diff resulting Content-Type, Content-Disposition, and X-Content-Type-Options on download
|
|
30
|
+
- Magic bytes vs extension: JPEG/GIF/PNG headers; mismatches reveal reliance on extension or MIME sniffing
|
|
31
|
+
- SVG/HTML probe: do they render inline (text/html or image/svg+xml) or download (attachment)?
|
|
32
|
+
- Archive probe: simple zip with nested path traversal entries and symlinks to detect extraction rules
|
|
33
|
+
</capability_probes>
|
|
34
|
+
</discovery_techniques>
|
|
35
|
+
|
|
36
|
+
<detection_channels>
|
|
37
|
+
<server_execution>
|
|
38
|
+
- Web shell execution (language dependent), config/handler uploads (.htaccess, .user.ini, web.config) enabling execution
|
|
39
|
+
- Interpreter-side template/script evaluation during conversion (ImageMagick/Ghostscript/ExifTool)
|
|
40
|
+
</server_execution>
|
|
41
|
+
|
|
42
|
+
<client_execution>
|
|
43
|
+
- Stored XSS via SVG/HTML/JS if served inline without correct headers; PDF JavaScript; office macros in previewers
|
|
44
|
+
</client_execution>
|
|
45
|
+
|
|
46
|
+
<header_and_render>
|
|
47
|
+
- Missing X-Content-Type-Options: nosniff enabling browser sniff to script
|
|
48
|
+
- Content-Type reflection from upload vs server-set; Content-Disposition: inline vs attachment
|
|
49
|
+
</header_and_render>
|
|
50
|
+
|
|
51
|
+
<process_side_effects>
|
|
52
|
+
- AV/CDR race or absence; background job status allows access before scan completes; password-protected archives bypass scanning
|
|
53
|
+
</process_side_effects>
|
|
54
|
+
</detection_channels>
|
|
55
|
+
|
|
56
|
+
<core_payloads>
|
|
57
|
+
<web_shells_and_configs>
|
|
58
|
+
- PHP: GIF polyglot (starts with GIF89a) followed by <?php echo 1; ?>; place where PHP is executed
|
|
59
|
+
- .htaccess to map extensions to code (AddType/AddHandler); .user.ini (auto_prepend/append_file) for PHP-FPM
|
|
60
|
+
- ASP/JSP equivalents where supported; IIS web.config to enable script execution
|
|
61
|
+
</web_shells_and_configs>
|
|
62
|
+
|
|
63
|
+
<stored_xss>
|
|
64
|
+
- SVG with onload/onerror handlers served as image/svg+xml or text/html
|
|
65
|
+
- HTML file with script when served as text/html or sniffed due to missing nosniff
|
|
66
|
+
</stored_xss>
|
|
67
|
+
|
|
68
|
+
<mime_magic_polyglots>
|
|
69
|
+
- Double extensions: avatar.jpg.php, report.pdf.html; mixed casing: .pHp, .PhAr
|
|
70
|
+
- Magic-byte spoofing: valid JPEG header then embedded script; verify server uses content inspection, not extensions alone
|
|
71
|
+
</mime_magic_polyglots>
|
|
72
|
+
|
|
73
|
+
<archive_attacks>
|
|
74
|
+
- Zip Slip: entries with ../../ to escape extraction dir; symlink-in-zip pointing outside target; nested zips
|
|
75
|
+
- Zip bomb: extreme compression ratios (e.g., 42.zip) to exhaust resources in processors
|
|
76
|
+
</archive_attacks>
|
|
77
|
+
|
|
78
|
+
<toolchain_exploits>
|
|
79
|
+
- ImageMagick/GraphicsMagick legacy vectors (policy.xml may mitigate): crafted SVG/PS/EPS invoking external commands or reading files
|
|
80
|
+
- Ghostscript in PDF/PS with file operators (%pipe%)
|
|
81
|
+
- ExifTool metadata parsing bugs; overly large or crafted EXIF/IPTC/XMP fields
|
|
82
|
+
</toolchain_exploits>
|
|
83
|
+
|
|
84
|
+
<cloud_storage_vectors>
|
|
85
|
+
- S3/GCS presigned uploads: attacker controls Content-Type/Disposition; set text/html or image/svg+xml and inline rendering
|
|
86
|
+
- Public-read ACL or permissive bucket policies expose uploads broadly; object key injection via user-controlled path prefixes
|
|
87
|
+
- Signed URL reuse and stale URLs; serving directly from bucket without attachment + nosniff headers
|
|
88
|
+
</cloud_storage_vectors>
|
|
89
|
+
</core_payloads>
|
|
90
|
+
|
|
91
|
+
<advanced_techniques>
|
|
92
|
+
<resumable_multipart>
|
|
93
|
+
- Change metadata between init and complete (e.g., swap Content-Type/Disposition at finalize)
|
|
94
|
+
- Upload benign chunks, then swap last chunk or complete with different source if server trusts client-side digests only
|
|
95
|
+
</resumable_multipart>
|
|
96
|
+
|
|
97
|
+
<filename_and_path>
|
|
98
|
+
- Unicode homoglyphs, trailing dots/spaces, device names, reserved characters to bypass validators and filesystem rules
|
|
99
|
+
- Null-byte truncation on legacy stacks; overlong paths; case-insensitive collisions overwriting existing files
|
|
100
|
+
</filename_and_path>
|
|
101
|
+
|
|
102
|
+
<processing_races>
|
|
103
|
+
- Request file immediately after upload but before AV/CDR completes; or during derivative creation to get unprocessed content
|
|
104
|
+
- Trigger heavy conversions (large images, deep PDFs) to widen race windows
|
|
105
|
+
</processing_races>
|
|
106
|
+
|
|
107
|
+
<metadata_abuse>
|
|
108
|
+
- Oversized EXIF/XMP/IPTC blocks to trigger parser flaws; payloads in document properties of Office/PDF rendered by previewers
|
|
109
|
+
</metadata_abuse>
|
|
110
|
+
|
|
111
|
+
<header_manipulation>
|
|
112
|
+
- Force inline rendering with Content-Type + inline Content-Disposition; test browsers with and without nosniff
|
|
113
|
+
- Cache poisoning via CDN with keys missing Vary on Content-Type/Disposition
|
|
114
|
+
</header_manipulation>
|
|
115
|
+
</advanced_techniques>
|
|
116
|
+
|
|
117
|
+
<filter_bypasses>
|
|
118
|
+
<validation_gaps>
|
|
119
|
+
- Client-side only checks; relying on JS/MIME provided by browser; trusting multipart boundary part headers blindly
|
|
120
|
+
- Extension allowlists without server-side content inspection; magic-bytes only without full parsing
|
|
121
|
+
</validation_gaps>
|
|
122
|
+
|
|
123
|
+
<evasion_tricks>
|
|
124
|
+
- Double extensions, mixed case, hidden dotfiles, extra dots (file..png), long paths with allowed suffix
|
|
125
|
+
- Multipart name vs filename vs path discrepancies; duplicate parameters and late parameter precedence
|
|
126
|
+
</evasion_tricks>
|
|
127
|
+
</filter_bypasses>
|
|
128
|
+
|
|
129
|
+
<special_contexts>
|
|
130
|
+
<rich_text_editors>
|
|
131
|
+
- RTEs allow image/attachment uploads and embed links; verify sanitization and serving headers for embedded content
|
|
132
|
+
</rich_text_editors>
|
|
133
|
+
|
|
134
|
+
<mobile_clients>
|
|
135
|
+
- Mobile SDKs may send nonstandard MIME or metadata; servers sometimes trust client-side transformations or EXIF orientation
|
|
136
|
+
</mobile_clients>
|
|
137
|
+
|
|
138
|
+
<serverless_and_cdn>
|
|
139
|
+
- Direct-to-bucket uploads with Lambda/Workers post-processing; verify that security decisions are not delegated to frontends
|
|
140
|
+
- CDN caching of uploaded content; ensure correct cache keys and headers (attachment, nosniff)
|
|
141
|
+
</serverless_and_cdn>
|
|
142
|
+
</special_contexts>
|
|
143
|
+
|
|
144
|
+
<parser_hardening>
|
|
145
|
+
- Validate on server: strict allowlist by true type (parse enough to confirm), size caps, and structural checks (dimensions, page count)
|
|
146
|
+
- Strip active content: convert SVG→PNG; remove scripts/JS from PDF; disable macros; normalize EXIF; consider CDR for risky types
|
|
147
|
+
- Store outside web root; serve via application or signed, time-limited URLs with Content-Disposition: attachment and X-Content-Type-Options: nosniff
|
|
148
|
+
- For cloud: private buckets, per-request signed GET, enforce Content-Type/Disposition on GET responses from your app/gateway
|
|
149
|
+
- Disable execution in upload paths; ignore .htaccess/.user.ini; sanitize keys to prevent path injections; randomize filenames
|
|
150
|
+
- AV + CDR: scan synchronously when possible; quarantine until verdict; block password-protected archives or process in sandbox
|
|
151
|
+
</parser_hardening>
|
|
152
|
+
|
|
153
|
+
<validation>
|
|
154
|
+
1. Demonstrate execution or rendering of active content: web shell reachable, or SVG/HTML executing JS when viewed.
|
|
155
|
+
2. Show filter bypass: upload accepted despite restrictions (extension/MIME/magic mismatch) with evidence on retrieval.
|
|
156
|
+
3. Prove header weaknesses: inline rendering without nosniff or missing attachment; present exact response headers.
|
|
157
|
+
4. Show race or pipeline gap: access before AV/CDR; extraction outside intended directory; derivative creation from malicious input.
|
|
158
|
+
5. Provide reproducible steps: request/response for upload and subsequent access, with minimal PoCs.
|
|
159
|
+
</validation>
|
|
160
|
+
|
|
161
|
+
<false_positives>
|
|
162
|
+
- Upload stored but never served back; or always served as attachment with strict nosniff
|
|
163
|
+
- Converters run in locked-down sandboxes with no external IO and no script engines; no path traversal on archive extraction
|
|
164
|
+
- AV/CDR blocks the payload and quarantines; access before scan is impossible by design
|
|
165
|
+
</false_positives>
|
|
166
|
+
|
|
167
|
+
<impact>
|
|
168
|
+
- Remote code execution on application stack or media toolchain host
|
|
169
|
+
- Persistent cross-site scripting and session/token exfiltration via served uploads
|
|
170
|
+
- Malware distribution via public storage/CDN; brand/reputation damage
|
|
171
|
+
- Data loss or corruption via overwrite/zip slip; service degradation via zip bombs or oversized assets
|
|
172
|
+
</impact>
|
|
173
|
+
|
|
174
|
+
<pro_tips>
|
|
175
|
+
1. Keep PoCs minimal: tiny SVG/HTML for XSS, a single-line PHP/ASP where relevant, and benign magic-byte polyglots.
|
|
176
|
+
2. Always capture download response headers and final MIME from the server/CDN; that decides browser behavior.
|
|
177
|
+
3. Prefer transforming risky formats to safe renderings (SVG→PNG) rather than attempting complex sanitization.
|
|
178
|
+
4. In presigned flows, constrain all headers and object keys server-side; ignore client-supplied ACL and metadata.
|
|
179
|
+
5. For archives, extract in a chroot/jail with explicit allowlist; drop symlinks and reject traversal.
|
|
180
|
+
6. Test finalize/complete steps in resumable flows; many validations only run on init, not at completion.
|
|
181
|
+
7. Verify background processors with EICAR and tiny polyglots; ensure quarantine gates access until safe.
|
|
182
|
+
8. When you cannot get execution, aim for stored XSS or header-driven script execution; both are impactful.
|
|
183
|
+
9. Validate that CDNs honor attachment/nosniff and do not override Content-Type/Disposition.
|
|
184
|
+
10. Document full pipeline behavior per asset type; defenses must match actual processors and serving paths.
|
|
185
|
+
</pro_tips>
|
|
186
|
+
|
|
187
|
+
<remember>Secure uploads are a pipeline property. Enforce strict type, size, and header controls; transform or strip active content; never execute or inline-render untrusted uploads; and keep storage private with controlled, signed access.</remember>
|
|
188
|
+
</insecure_file_uploads_guide>
|
|
@@ -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,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>
|