Back to skill

Security audit

Byted Bytehouse Hybrid Search

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real ByteHouse hybrid-search skill, but it needs Review because it uses powerful database credentials with unsafe SQL construction and sends text to a configurable embedding service.

Review before installing in production. Use a least-privileged ByteHouse account, do not pass untrusted table names or limits into this client, pin and review dependencies, restrict ARK_BASE_URL to the intended HTTPS provider, and avoid embedding confidential or regulated text unless your data policy allows sending it to the configured embedding service.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/hybrid_search_client.py:80
Finding

SQL Injection Through Unvalidated Table Names and Query Limits

Content
View full analysis
None: exists_clause = "IF NOT EXISTS" if if_not_exists else "" vec_dimensions = self.embedding_client.dimensions create_sql = f""" CREATE TABLE {exists_clause} {table_name} ( `doc_id` UInt64, `title` String, `content` String, `embedding` Array(Float32), `create_time` DateTime DEFAULT now(), INDEX content_idx content TYPE inverted('standard', '{{\"version\":\"v2\"}}') GRANULARITY 1, INDEX embedding_idx embedding TYPE HNSW_SQ('DIM={vec_dimensions}', 'metric=COSINE', 'M=32', 'EF_CONSTRUCTION=256') GRANULARITY 1 ) ENGINE = MergeTree() ORDER BY doc_id SETTINGS index_granularity = 1024 """ self.client.command(create_sql) ``` ```python insert_sql = f""" INSERT INTO {table_name} (doc_id, title, content, embedding) VALUES (%s, %s, %s, %s) """ self.client.command(insert_sql, parameters=[doc_id, title, content, embedding]) ``` ```python search_sql = f""" SELECT doc_id, title, content, _text_search_score as bm25_score FROM {table_name} WHERE textSearch(content, %s) ORDER BY bm25_score DESC LIMIT {top_k} """ results = self.client.query(search_sql, parameters=[query]).result_rows ``` ```python search_sql = f""" SELECT doc_id, title, content, cosineDistance(embedding, %s) as vector_score FROM {table_name} ORDER BY vector_score ASC LIMIT {top_k} """ results = self.client.query(search_sql, parameters=[query_embedding]).result_rows ``` ### Technical Analysis The public database methods interpolate `table_name` and `top_k` directly into SQL strings. Although document values, search text, and embeddings are passed thro ...[truncated 2293 chars]
Remediation
View remediation
str: if not isinstance(value, str) or not _IDENTIFIER.fullmatch(value): raise ValueError("Invalid SQL identifier") return value ``` 2. If qualified identifiers are required, validate each database and table component independently rather than allowing arbitrary punctuation. 3. Use the database driver's supported identifier-quoting mechanism after validation. Do not treat ordinary value parameterization as protection for table names. 4. Enforce integer types and conservative bounds for all ranking parameters: ```python def validate_limit(value: int, maximum: int = 1000) -> int: if isinstance(value, bool) or not isinstance(value, int): raise TypeError("Limit must be an integer") if value < 1 or value > maximum: raise ValueError("Limit is outside the permitted range") return value ``` 5. Apply equivalent validation to `top_k`, `recall_k`, and `rrf_k`. 6. Prefer mapping externally supplied logical index names to server-side table names controlled by the application. 7. Run the client under a least-privileged ByteHouse account. Separate DDL privileges from search and insertion privileges where possible. 8. Add negative tests containing quotes, whitespace, comments, delimiters, Unicode lookalikes, and oversized or negative limit values. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/embedding.py:32
Finding

Configurable Embedding Endpoint Can Receive API Credentials and Sensitive Text

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:16
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill is presented as a ByteHouse hybrid search capability, but the documented behavior also depends on an external Ark embedding API and associated secrets that are not clearly reflected in the declared purpose. This mismatch is dangerous because operators may approve or run the skill under incorrect assumptions, enabling unreviewed outbound data flow to a third-party service and secret use outside the expected trust boundary.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill references environment-based capabilities and sensitive configuration inputs, but it does not declare any explicit tool scope or permissions boundaries. This is dangerous because consumers of the skill cannot easily tell that it expects access to secrets and external resources, increasing the risk of unintended secret exposure or over-broad execution in agent environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The methods send raw text inputs to a remote embedding API service, which creates a real data exposure boundary outside the local system. In a hybrid-search skill, user queries or indexed content may contain sensitive business data, and the code provides no disclosure, consent flow, redaction, or classification guard before transmission.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes a hybrid retrieval skill for performing full-text and vector search with RRF reranking. In addition to retrieval, the code provisions schema (CREATE TABLE) and writes document data (INSERT), which materially expands behavior beyond search into database administration and ingestion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Document titles and contents are batch-sent to the embedding client to generate vectors, which may expose user or tenant data to another processing boundary without explicit notice. This is more concerning because full document content is involved, increasing the chance of transmitting sensitive internal, personal, or regulated data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The search query is sent to the embedding client before vector search, which may transmit user-entered text to another component or external service without explicit disclosure. If queries contain sensitive business or personal data, this creates a privacy and data-governance risk, especially because the skill is presented as database search functionality rather than data sharing with an embedding provider.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The module docstring, parameter documentation, and error message are written only in Chinese, with no indication that users may choose another language. This can conflict with language/locale policy expectations when a skill is intended for broader use and does not document or offer language selection.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This file contains user-facing natural-language content such as the module docstring, comments, and printed output exclusively in Chinese. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is clearly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The manifest only describes hybrid search behavior and does not mention secret or environment-based credential loading. Accessing environment variables for host, user, and password introduces a credential-handling capability beyond the stated functional scope, even though it supports backend connectivity.

Content

No source excerpt is available for this finding.