Back to skill

Security audit

数据库访问服务

Security checks for vulnerabilities and agentic risk

Overview

This database skill needs Review because its documented database purpose appears to be mixed with an external API proxy and unrelated plaintext API-key handling.

Install only after confirming who operates the remote API, exactly what database inputs and results are sent to it, why XBY_GAOKAO/XBY_APIKEY configuration is present, and how writes or DDL are approved. Use a read-only database account, avoid production data until the data flow is clear, and do not store API keys in a project .env unless you accept that plaintext persistence risk.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (22)

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill declares no permissions while its documented workflow clearly implies access to environment variables, local file writes for persisting secrets, and outbound network access to a remote API. This weakens transparency and consent because a user may believe the skill is only performing local database operations when it can also store credentials and exfiltrate inputs to an external service.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill is presented as a secure direct database-access server with validation, audit logging, and security controls, but the documented behavior instead proxies requests to an external API and persists an API key locally. That mismatch can cause users to send sensitive database URLs, schemas, and SQL queries to a third party under false assumptions about local execution and built-in safeguards.

Description-Behavior Mismatch

High
Confidence
96% confidence
Finding
The documentation says this is a secure database access service, but the required setup and project structure show dependency on an external API-keyed service rather than direct database access. This is dangerous because users may provide confidential connection strings, schema details, or SQL data to a remote endpoint they did not intend to trust.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
The file claims the code only calls an API, yet elsewhere advertises validation, audit logging, and security controls without explaining where or how those protections are enforced. This creates a false sense of safety and may lead users to execute risky SQL operations believing the service is applying protections that are not actually evidenced in the skill.

Description-Behavior Mismatch

Medium
Confidence
89% confidence
Finding
The implementation does not perform direct database access as the manifest suggests; instead it sends requests to a generic external MCP API endpoint. In a security-sensitive database skill, this mismatch increases supply-chain and data-exfiltration risk because database queries, credentials, or results may be routed to an external service outside the user’s expected trust boundary.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The client accepts an arbitrary tool name and forwards arbitrary parameters to an external API, creating a broad remote invocation primitive that exceeds the stated purpose of secure database access. In an agent skill, this can enable unintended actions, expansion of privilege, or covert forwarding of sensitive data to upstream tools not covered by the skill’s declared scope.

Description-Behavior Mismatch

High
Confidence
95% confidence
Finding
The file is supposed to belong to a database-access skill, but it instead configures a different external service endpoint and API key namespace tied to another product ('XBY_GAOKAO'). That mismatch strongly suggests hidden or repurposed functionality and creates a risk that users or host agents will unknowingly send secrets or requests to an unrelated remote service.

Intent-Code Divergence

Medium
Confidence
92% confidence
Finding
The class docstring identifies a different skill than the manifest, which is a supply-chain integrity warning rather than a harmless comment issue. This inconsistency makes the package harder to audit and increases the chance that code from an unrelated skill was copied in, including behavior users did not consent to.

Description-Behavior Mismatch

Medium
Confidence
89% confidence
Finding
The skill exposes a general-purpose SQL execution wrapper that explicitly supports write operations and DDL via `allow_write`, while the skill description emphasizes 'secure database access'. In an agent/tooling context, allowing the model or upstream caller to supply arbitrary `sql` and even override `db_url` materially increases the risk of destructive actions, unauthorized data modification, schema changes, or access to unintended databases if higher-layer controls fail or are misconfigured.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill explicitly supports INSERT, UPDATE, DELETE, and DDL but does not warn about destructive or irreversible effects. In a database-access context, this omission increases the risk of accidental data loss, schema damage, or unauthorized modification, especially when routed through an LLM that may act on ambiguous user intent.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The documentation permits EXPLAIN ANALYZE without warning that it executes the query and can consume substantial resources or trigger side effects depending on the database and statement. Users may treat it as a harmless planning tool when it can impact performance and operational stability.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The code persistently writes the API key into a local .env file without any access control, encryption, permission hardening, or explicit user warning. Secrets stored this way are easily exposed through backups, source-control mistakes, shared workspaces, or other local processes reading the file.

Credential Access

High
Category
Privilege Escalation
Content
default_year: int = 2025

    def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
Confidence
89% confidence
Finding
The code manually parses .env to force-read a specific API key from a nonstandard variable name, bypassing the declared env_prefix and normal settings behavior. In the context of a mismatched skill, this looks like hidden credential collection logic for an unrelated service and increases the chance secrets are consumed without clear operator intent.

Credential Access

High
Category
Privilege Escalation
Content
def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
            for line in content.splitlines():
Confidence
89% confidence
Finding
The explicit read of .env content to extract XBY_APIKEY is unnecessary because BaseSettings already supports environment loading. In this package context, the manual extraction of an unrelated service credential is suspicious and broadens the attack surface for secret misuse.

Credential Access

High
Category
Privilege Escalation
Content
def save_api_key_to_env(api_key: str) -> bool:
    """将API key保存到.env文件"""
    try:
        env_path = Path(".env")
        lines = []
        if env_path.exists():
            lines = env_path.read_text(encoding="utf-8").splitlines()
Confidence
93% confidence
Finding
This function persists an API key into .env, creating long-lived plaintext secret storage on disk. In a skill whose manifest describes database access but whose code manages another service's API key, that persistence is more dangerous because users may not expect or authorize storage of unrelated credentials.

Credential Access

High
Category
Privilege Escalation
Content
def set_api_key(api_key: str) -> bool:
    """设置API key并持久化到.env"""
    if not api_key or not api_key.strip():
        return False
    api_key = api_key.strip()
Confidence
90% confidence
Finding
The set_api_key routine explicitly promises persistence of the credential, encouraging insecure operational patterns and increasing the chance that secrets remain on disk after use. Combined with the skill-identity mismatch, this could lead to silent retention of credentials for an unrelated service.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
95% confidence
Finding
Using a lower-bounded but unpinned dependency for requests allows future installs to resolve to different versions over time, which can introduce breaking changes or newly vulnerable releases into the environment. Because this skill appears security-sensitive and may handle database credentials or query flows, nondeterministic dependency resolution increases supply-chain risk.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
94% confidence
Finding
Unpinned pydantic versions make builds non-reproducible and can unexpectedly pull in new major or minor releases with behavior changes or security issues. In a service that validates configuration and possibly query schemas, validator behavior drift can weaken security assumptions or cause unstable deployments.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
94% confidence
Finding
Unpinned pydantic-settings creates supply-chain and reproducibility risk because future installations may resolve to unreviewed versions. Since this package typically handles environment-driven configuration, changes in parsing or precedence could affect secrets handling or security controls.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
94% confidence
Finding
Leaving python-dotenv unpinned means deployments can silently consume newer releases, including ones with changed behavior or newly introduced vulnerabilities. Because dotenv tooling often loads or writes environment-based secrets and configuration, version drift can materially affect security-sensitive operations.

Known Vulnerable Dependency: requests==2.31.0 — 3 advisory(ies): CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi); CVE-2026-25645 (Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility func)

Low
Category
Supply Chain
Confidence
98% confidence
Finding
The dependency specification permits requests 2.31.0, which is affected by multiple advisories, including credential leakage via malicious URLs and TLS verification issues in certain Session flows. In a database access service, any outbound HTTP usage could expose credentials, tokens, or operational metadata, making this more concerning than in a non-sensitive tool.

Known Vulnerable Dependency: python-dotenv==1.0.1 — 1 advisory(ies): CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via )

Low
Category
Supply Chain
Confidence
91% confidence
Finding
The dependency specification permits python-dotenv 1.0.1, which is reported as vulnerable to symlink-following during set_key operations, potentially enabling arbitrary file overwrite in unsafe usage patterns. In a service likely to manage configuration and secrets, a file overwrite issue could affect environment files, service config, or other sensitive paths if an attacker can influence filesystem state.

Static analysis

No suspicious patterns detected.