Back to skill

Security audit

Byted Bytehouse Multimodal Search

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but it builds powerful database SQL from caller-controlled inputs without safe validation or clear scoping.

Install only in an isolated environment with least-privileged ByteHouse and Ark credentials. Do not pass user-controlled table names or raw filter conditions into this skill, and avoid sensitive or regulated text/media unless your organization approves sending it to Ark and storing it in ByteHouse. Pin and review dependencies before production use.

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/search_client.py:276
Finding

SQL Injection Through Unsanitized Dynamic Query Construction

Content
View full analysis

Vulnerability Details

File Location: scripts/search_client.py:276-298
Vulnerability Type: SQL injection
Risk Level: High

Vulnerable Code

python
def vector_search(self,
                 table_name: str,
                 query_embedding: List[float],
                 top_k: int = 10,
                 filter_condition: str = None,
                 metric: str = "COSINE",
                 hnsw_ef_s: int = 200) -> List[Dict]:
    """Pure vector search"""
    distance_func = "cosineDistance" if metric == "COSINE" else "L2Distance"
    
    sql = f"""
    SELECT 
        id, content_type, content, title, metadata, create_time,
        {distance_func}(embedding, {query_embedding}) AS score
    FROM {table_name}
    {f"WHERE {filter_condition}" if filter_condition else ""}
    ORDER BY score ASC
    LIMIT {top_k}
    SETTINGS enable_new_ann = 1, hnsw_ef_s = {hnsw_ef_s}
    """
    
    rows = self._execute_sql(sql, query_type="select")
    columns = ['id', 'content_type', 'content', 'title', 'metadata', 'create_time', 'score']
    return [dict(zip(columns, row)) for row in rows]

The same unsafe construction pattern also occurs in:

  • scripts/search_client.py:139-167, where table_name, index settings, and related options are interpolated into DDL.
  • scripts/search_client.py:196-204, where table_name and inserted values are interpolated into an INSERT statement.
  • scripts/search_client.py:337-344, where table_name, query_text, filter_condition, and limits are used to build a hybrid-search query.
  • scripts/search_client.py:376-400, where caller-provided filter conditions are appended to generated search filters.

Technical Analysis

The client builds SQL statements using Python f-strings and forwards them directly to ByteHouse or the MCP database tool. Caller-controlled values such as table_name and filter_condition are treated as executable ...[truncated 1963 chars]

Remediation
View remediation

Remediation Suggestions

  1. Use database-driver parameter binding for every data value, including text, IDs, vectors, and limits where supported.
  2. Do not expose raw SQL through filter_condition. Replace it with a structured filter representation containing approved columns, operators, and typed values.
  3. Validate table names and other identifiers against a strict identifier pattern and, preferably, an application-maintained allowlist.
  4. Allowlist metric, index_type, and other enum-like options before query construction.
  5. Convert numeric settings with strict type checks and enforce safe minimum and maximum values.
  6. Use driver-supported identifier-quoting facilities where dynamic identifiers are unavoidable.
  7. Ensure the database account has only the minimum required permissions. Separate read-only search credentials from DDL and insertion credentials.
  8. Add security tests covering malicious identifiers, injected predicates, comment sequences, unions, and statement delimiters.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:16
Finding

Unpinned Third-Party Runtime Dependencies

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:16
Vulnerability Type: Unpinned dependency installation
Risk Level: Medium

Vulnerable Code

bash
pip install clickhouse-connect volcengine-python-sdk[ark] numpy

Technical Analysis

The documented installation command installs third-party packages without exact versions or integrity hashes. Consequently, installations performed at different times can resolve to different artifacts.

A future compromised, malicious, or incompatible package release could therefore become part of the Skill environment without any change to the reviewed project. Python packages can execute code during installation and whenever imported by the Skill.

No direct evidence was found that the named packages are currently malicious. The weakness is the absence of reproducible version and integrity controls.

Attack Path

  1. A user follows the installation command in SKILL.md.
  2. pip queries the configured package index and resolves the latest package versions allowed at that time.
  3. A compromised package release, compromised package-index account, unsafe mirror, or dependency-chain compromise supplies altered code.
  4. The package is installed into the Skill environment.
  5. Malicious package code executes during installation or when imported by embedding.py or search_client.py.

Impact Assessment

Dependency code normally executes with the same operating-system privileges as the user or agent installing and running the Skill. A compromised dependency could access environment variables, including database and Ark credentials, read or modify accessible files, make network requests, tamper with database operations, or execute arbitrary local code.

The scope is limited by the privileges and isolation controls of the installation environment, but it could include the complete Skill runtime and all credentials exposed to that process.

Remediation
View remediation

Remediation Suggestions

  1. Create a reviewed lock file or requirements file containing exact dependency and transitive-dependency versions.
  2. Require cryptographic hashes, such as through pip install --require-hashes.
  3. Install packages only from an approved package index or authenticated internal mirror.
  4. Automate vulnerability and provenance scanning for all locked dependencies.
  5. Review and deliberately approve dependency upgrades rather than resolving mutable latest releases during installation.
  6. Perform installation and execution in an isolated, least-privileged environment without unnecessary credentials.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/embedding.py:29
Finding

Unrestricted Configurable API Endpoint Can Receive Credentials and User Content

Content
View full analysis

Vulnerability Details

File Location: scripts/embedding.py:29-33 and scripts/embedding.py:67-78
Vulnerability Type: Unvalidated credential-bearing service endpoint
Risk Level: Medium

Vulnerable Code

python
def __init__(self):
    self.client = Ark(
        api_key=os.environ.get("ARK_API_KEY"),
        base_url=os.environ.get(
            "ARK_BASE_URL",
            "https://ark.cn-beijing.volces.com/api/v3"
        )
    )
    self.model = os.environ.get(
        "EMBEDDING_MODEL",
        "doubao-embedding-vision-251215"
    )
    self.dimensions = int(os.environ.get("EMBEDDING_DIMENSIONS", 1536))
python
request_params = {
    "model": self.model,
    "encoding_format": "float",
    "input": [input_item],
    "dimensions": self.dimensions
}

if instruction and "251215" in self.model:
    request_params["instructions"] = instruction

resp = self.client.multimodal_embeddings.create(**request_params)

Technical Analysis

ARK_BASE_URL is accepted directly from the process environment and passed to the Ark SDK without validating its scheme or destination host. The same client is configured with ARK_API_KEY and subsequently transmits text, media URLs, model information, and optional instructions to the selected endpoint.

If an attacker can influence the environment or deployment configuration, the endpoint can potentially be redirected to an unintended server. Depending on SDK authentication behavior, that server may receive the API credential or an authorization token in addition to submitted user content.

The secure official HTTPS endpoint is used by default, so exploitation requires control over configuration or environment variables. The issue is the absence of safeguards around an especially sensitive configuration value.

Attack Path

  1. An attacker gains influence over deployment configuration, environment injection, a launch scri ...[truncated 1072 chars]
Remediation
View remediation

Remediation Suggestions

  1. Allowlist the official Ark HTTPS hostname or an explicitly approved set of organizational endpoints.
  2. Parse the configured URL and reject non-HTTPS schemes, embedded credentials, unexpected ports, malformed hosts, and unapproved domains.
  3. Require a separate explicit security opt-in before permitting custom endpoints.
  4. Use different restricted credentials for custom or test endpoints rather than forwarding production credentials.
  5. Document that endpoint configuration is security-sensitive and must not be derived from untrusted input.
  6. Redact authorization information and sensitive request data from exceptions and logs.
  7. Apply egress controls so the Skill process can contact only approved API destinations.
  8. Scope and rotate ARK_API_KEY regularly and monitor it for anomalous use.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The declared description presents the skill as supporting multimodal vector storage and hybrid retrieval in ByteHouse. However, the provided code chunk is limited to generating embeddings using an external Ark API client. It accepts text, image URL, and video URL inputs, calls a multimodal embedding endpoint, and returns vectors. There is no code for connecting to ByteHouse, inserting vectors, indexing data, issuing retrieval queries, or performing hybrid search. The main implemented capability is embedding generation, which may be a supporting component of such a skill, but by itself it does not match the declared end-to-end ByteHouse storage/retrieval functionality.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill documents use of environment variables and references code under scripts/, but it does not declare any tool scope such as permissions or allowed-tools. That creates an authorization ambiguity where a runtime may permit broader env or MCP access than users expect, increasing the chance of unintended secret access or external operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill instructs users to vectorize and store text, images, and videos through an external embedding API and a database, but it gives no privacy or data-transmission warning. Users may unknowingly send sensitive multimodal content to third-party services or persist it in external systems without informed consent or handling guidance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python code sends the input payload to a remote embedding API via self.client.multimodal_embeddings.create(**request_params). While the module docstrings describe vectorization behavior, they do not warn that user-supplied content and URLs are transmitted to an external service, and there is no confirmation prompt or user-facing logging around that transfer.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and many user-visible messages are written only in Chinese, which imposes a specific language on users without opt-in or justification. Under the language/locale policy, forcing a single language without offering choice or documenting a region-specific constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
69% confidence
Finding

The skill documentation and usage guidance are presented entirely in Chinese, and there is no indication that the language is optional or that the skill is intended only for a Chinese-speaking or region-specific audience. Under the language/locale policy, forcing a specific language without user opt-in can be a policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The environment setup lists database and API credentials but does not adequately warn about safeguarding secrets beyond avoiding hardcoding. Without guidance on least privilege, secret storage, rotation, and the fact that those credentials enable external transmission and database access, users may expose or misuse high-value secrets.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code file contains natural-language user-facing documentation entirely in Chinese, with no indication that the skill offers a language choice or that the locale restriction is intentional and justified. Under the policy, forcing a specific language without opt-in can be a locale-policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The module-level documentation and all raised error messages are written only in Chinese, which imposes a specific language on users without offering language choice or documenting a justified locale constraint. Under the policy, fixed language behavior without opt-in can be a locale-policy violation unless clearly scoped as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code file contains natural-language instructional text in Chinese (for example, the module docstring at L016 and surrounding example comments), which effectively forces a specific language for readers. The policy allows locale constraints only when they are justified or when users are given a choice, neither of which is present here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code reads sensitive connection details including host, username, and password from environment variables to establish database connections. While the code comments describe connection behavior, there is no user-facing warning, confirmation, or disclosure that the skill accesses stored credentials or system configuration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The helper executes SQL through either an MCP client or native database client, which transmits queries and potentially user-provided content to a remote ByteHouse service. The file lacks any print/log statement or explicit warning in docstrings that user content, embeddings, and queries are sent over the network.

Content

No source excerpt is available for this finding.