hybrid-search-implementation

Fail

Audited by Gen Agent Trust Hub on Sep 22, 2026

Risk Level: HIGHCOMMAND_EXECUTIONDYNAMIC_EXECUTIONINDIRECT_PROMPT_INJECTION
Full Analysis
  • [COMMAND_EXECUTION]: The PostgreSQL search template in references/details.md contains a SQL injection vulnerability. Specifically, the hybrid_search method interpolates dictionary keys from the filter_metadata parameter directly into the SQL query string (metadata->>'{key}') rather than using parameterized identifiers. If these keys are sourced from untrusted user input, an attacker could execute arbitrary SQL commands. \n- [DYNAMIC_EXECUTION]: The Elasticsearch search template in references/details.md performs unsafe string interpolation of the boost_vector variable into an Elasticsearch script_score query. This pattern creates a risk of script injection if the boost parameter is not strictly validated before being interpolated into the Painless script. \n- [INDIRECT_PROMPT_INJECTION]: The skill facilitates the creation of RAG (Retrieval-Augmented Generation) systems that process untrusted external data, which is a primary surface for indirect prompt injection. \n
  • Ingestion points: The query and filter_metadata parameters in the search and hybrid_search methods in references/details.md are used to ingest data and control retrieval. \n
  • Boundary markers: No explicit delimiters or boundary instructions are included in the templates to help the agent distinguish between instructions and potentially malicious retrieved data. \n
  • Capability inventory: The implementation uses database query clients and neural reranking models to process and act on retrieved content. \n
  • Sanitization: The code lacks sanitization for metadata keys in SQL queries, creating an exploitable vulnerability surface.
Recommendations
  • AI detected serious security threats
Audit Metadata
Risk Level
HIGH
Analyzed
Sep 22, 2026, 08:12 PM