Back to skill

Security audit

数值计算器

Security checks for vulnerabilities and agentic risk

Overview

This calculator is not clearly local: it requires an external API key, stores it in a local .env file, and sends calculator inputs to a remote service.

Only install this if you are comfortable giving a xiaobenyang.com API key to the skill, storing that key in a local .env file, and sending even simple calculation inputs to an external service. A normal calculator should compute locally, so review the publisher and endpoint trust before use.

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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (30)

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill declares itself as a simple calculator, yet the documentation indicates capabilities involving environment access, file read/write, and network use without corresponding transparent permission declaration. This expands the trust boundary significantly and can surprise users into exposing secrets or allowing external data flow for a task that should be purely local.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
There is a strong description-behavior mismatch: a 'numeric calculator' should not need a remote API, API key management, or persistent credential storage. This misrepresentation can trick users into providing credentials and sending inputs to an external service under false expectations of local computation.

Intent-Code Divergence

High
Confidence
97% confidence
Finding
The workflow text references a different use case entirely, including a school-search style function example and a gaokao-related project structure. Such internal inconsistency is a red flag for copy-paste errors or repurposed infrastructure, making it unclear what data is actually processed or where it is sent.

Intent-Code Divergence

High
Confidence
96% confidence
Finding
The documented return handling and dependency on API raw data contradict the claimed local arithmetic purpose. Direct reliance on raw external API responses indicates hidden remote processing and increases risk of unexpected content exposure, data leakage, or unsafe rendering of unvalidated output.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
Requiring an external API key for basic arithmetic exceeds the stated purpose and needlessly introduces credential handling into a low-risk task. This broadens attack surface by turning a local utility into a networked, credential-dependent service.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
Collecting and persisting a user's external API key is disproportionate to the advertised calculator purpose. Users may be socially engineered into surrendering credentials for functionality that should not require any secret at all.

Description-Behavior Mismatch

High
Confidence
94% confidence
Finding
The skill is presented as a numeric calculator, but this file implements a generic remote MCP API client that can invoke arbitrary upstream tools by caller-supplied tool_name, mcp_id, and params. This mismatch weakens user trust and expands the capability surface from local arithmetic to remote action execution, which is dangerous in an agent setting because a seemingly harmless skill can become a proxy for unintended network access or tool invocation.

Context-Inappropriate Capability

High
Confidence
92% confidence
Finding
A calculator skill normally should not need broad outbound network capability, yet this code creates an HTTP client and posts arbitrary parameters to a remote endpoint using dynamic headers and function selection. In an agent environment, that makes the skill more dangerous because it can act as a general-purpose network/tool proxy under the guise of simple math, potentially enabling unauthorized external interaction, data exfiltration, or policy bypass depending on how the skill is exposed.

Description-Behavior Mismatch

High
Confidence
99% confidence
Finding
The file implements configuration for a remote 'gaokao' service, including a base URL, MCP identifier, and API key handling, which is inconsistent with the declared purpose of a local numeric calculator. This mismatch materially increases risk because it introduces unexplained outbound-service and credential-handling capability that could be used for hidden data access or unauthorized remote interactions.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The code reads, stores, updates, and exposes an API key through both .env and process environment state even though a calculator skill has no legitimate need for credential management. In this context, secret persistence and mutation expand the attack surface for credential theft, misuse, or covert service access.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
The presence of a hardcoded external service URL and MCP identifier indicates remote-service capability outside the stated functionality of a numeric calculator. While not proof of exploitation by itself, this hidden dependency is dangerous because it can facilitate opaque network interactions or tie the skill to an unrelated backend service.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The class docstring identifies the component as a '高考Skill配置' rather than a calculator, revealing a strong code provenance mismatch. In security review, such mismatches are significant because they suggest copy-pasted or repurposed logic that may carry hidden capabilities not aligned with the published skill behavior.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The skill is presented as a simple numeric calculator, but every arithmetic function forwards user-supplied inputs to an external API through call_api. This creates an unnecessary data egress and trust-boundary violation: users and hosts may expect purely local computation, while the implementation silently depends on a remote service that could log inputs, change behavior, fail, or be swapped for something more dangerous.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
A calculator skill does not need network access for add/subtract/multiply/divide/power/sqrt/factorial, so the presence of external API-calling capability is unjustified by the stated purpose. That mismatch increases risk because it expands the attack surface, enables covert data transmission, and allows remote behavior changes inconsistent with the minimal functionality users would expect from a calculator.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The function persists the API key to a local .env file and updates process environment state without any explicit user-facing consent, warning, or security controls. This is risky because users may unknowingly store sensitive credentials in plaintext on disk, where they can be exposed through logs, backups, repository mistakes, or local compromise.

Ssd 3

Medium
Confidence
98% confidence
Finding
The skill explicitly instructs collection and persistence of the user's API key before proceeding. Persisting secrets in `.env` or similar local storage can expose credentials to other tools, logs, backups, or later compromise, especially when unnecessary for the advertised functionality.

Ssd 3

Medium
Confidence
92% confidence
Finding
Displaying raw API return data directly to the user is unsafe because external responses may contain unexpected, sensitive, or misleading content. Without validation or filtering, the skill can expose backend details, echo secrets, or surface content not appropriate for direct rendering.

Env Variable Harvesting

High
Category
Data Exfiltration
Content
if not found:
            new_lines.append(f"XBY_APIKEY={api_key}")
        env_path.write_text("\n".join(new_lines) + "\n", encoding="utf-8")
        os.environ["XBY_APIKEY"] = api_key
        return True
    except Exception as e:
        print(f"保存API key失败: {e}")
Confidence
76% confidence
Finding
This line writes a provided API key into the process environment, making the secret broadly available to the current process and potentially any child processes. In the context of an unnecessary credential-handling calculator skill, propagating secrets this way increases exposure and can enable accidental leakage or unauthorized reuse.

Credential Access

High
Category
Privilege Escalation
Content
model_config = SettingsConfigDict(
        env_prefix="XBY_GAOKAO_",
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )
Confidence
82% confidence
Finding
Configuring automatic loading from .env establishes secret access behavior in a skill that should only perform arithmetic. In this context, credential-loading capability is suspicious because it normalizes secret ingestion where none should be needed, increasing the chance of unintended credential exposure or misuse.

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
92% confidence
Finding
The model_post_init method explicitly reads the .env file and extracts XBY_APIKEY, demonstrating direct credential harvesting behavior beyond standard configuration loading. For a numeric calculator, manually parsing and pulling secrets from disk is especially unjustified and raises concern about hidden secret collection.

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
90% confidence
Finding
The explicit existence check and subsequent read of the .env file form part of a direct credential-access path. Because this skill's declared purpose does not require secrets, reading a common secret file from disk materially increases the risk of unauthorized credential collection.

Credential Access

High
Category
Privilege Escalation
Content
if line.startswith("XBY_APIKEY="):
                    self.api_key = line.split("=", 1)[1].strip()
                    break
        # 如果环境变量有值,覆盖 .env 的值
        env_val = os.getenv("XBY_APIKEY", "")
        if env_val:
            self.api_key = env_val
Confidence
88% confidence
Finding
Reading XBY_APIKEY from environment variables adds another secret-ingestion path for an unrelated skill. Although environment-variable access is common in legitimate apps, in this mismatched context it contributes to unnecessary credential exposure and broadens avenues 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 is dedicated to saving an API key into a .env file, which is plaintext secret persistence. In a calculator skill, this capability is both unnecessary and dangerous because it creates durable local credential storage that can be exfiltrated or unintentionally committed.

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
91% confidence
Finding
The set_api_key entry point accepts arbitrary API keys and persists them to disk, enabling ongoing credential capture and retention. Given the skill's advertised calculator purpose, this is an unjustified secret-management interface that could be abused to plant, replace, or harvest credentials for unrelated services.

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
96% confidence
Finding
The dependency is specified with a lower-bound range (`requests>=2.31.0`) rather than an exact version or tightly constrained range, which harms build reproducibility and can allow unintended or newly compromised upstream releases into the environment. In a security-sensitive supply chain context, this is a real weakness even though it is common and not necessarily malicious.

Static analysis

No suspicious patterns detected.