Back to skill

Security audit

计算器服务

Security checks for vulnerabilities and agentic risk

Overview

This calculator skill is not clearly malicious, but it deserves review because it sends calculator inputs to a third-party API and stores an API key in a local .env file.

Review before installing. Only use this skill if you are comfortable sending calculation inputs to the Xiaobenyang API and storing an XBY_APIKEY value in a plaintext .env file in the working directory. Avoid using it for sensitive business, financial, research, or personal calculations unless the publisher documents the API service, data handling, and key-management practices more clearly.

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 (28)

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill declares no permissions, yet its documentation clearly instructs use of environment variables, file persistence via `.env`/`set_api_key`, and outbound network/API access. This mismatch prevents informed consent and weakens sandboxing or policy enforcement, especially because the skill also handles credentials.

Description-Behavior Mismatch

High
Confidence
97% confidence
Finding
The skill is presented as a calculator, but core workflow instructions require collecting an API key and interacting with an external API-backed gaokao service. This deceptive identity can trick users into disclosing credentials and granting capabilities they would not expect from a local calculator tool.

Intent-Code Divergence

High
Confidence
96% confidence
Finding
The example tool call invokes a school-search API function that is unrelated to the advertised calculator functionality. This contradiction is a strong indicator of hidden or copied functionality and increases the risk that the skill routes user data to an unexpected external service.

Intent-Code Divergence

Medium
Confidence
83% confidence
Finding
Describing tool outputs as raw API responses contradicts the claim of direct calculator-style computation and implies dependence on a remote backend. This expands the attack surface to include data exfiltration, response tampering, and privacy issues that users would not expect from a calculator.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
The project structure naming `xiaobenyang_gaokao_skill` conflicts with the stated calculator purpose and reinforces that the package may actually be for another service. Such inconsistencies undermine trust and can conceal unexpected networked behavior or credential handling.

Description-Behavior Mismatch

High
Confidence
95% confidence
Finding
The file implements an outbound network proxy to an external MCP API, which materially differs from a user’s likely expectation of a local calculator service. In a calculator skill context, silently forwarding requests and parameters off-box increases data exposure, expands the trust boundary, and creates dependency on a third-party service that can observe inputs and influence outputs.

Context-Inappropriate Capability

Medium
Confidence
88% confidence
Finding
This code introduces external network access and API-key-based authentication into a skill described as a calculator, which exceeds the directly implied functionality and adds confidentiality and supply-chain risk. Even if the API is legitimate, transmitting user-supplied calculation inputs to a remote endpoint can leak sensitive data and lets upstream behavior affect results.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The file implements remote-service configuration and API key handling for a '小笨羊高考' service, which is inconsistent with the declared calculator skill. This mismatch is dangerous because it can conceal undisclosed data flows or credential use, making users believe they are running a local math tool while the code is prepared to access an unrelated remote API.

Context-Inappropriate Capability

High
Confidence
97% confidence
Finding
The code persistently stores an API key in a local .env file and mirrors it into process environment variables, even though this behavior is not justified by a calculator service. Persisting secrets in this way increases the chance of credential leakage through source control, local file disclosure, backups, logs, or reuse by other components.

Intent-Code Divergence

Medium
Confidence
93% confidence
Finding
The class docstring identifies the code as configuration for a different skill ('小笨羊高考Skill'), directly conflicting with the advertised calculator identity. This kind of identity mismatch is a strong supply-chain warning sign because it suggests copied or repurposed code with hidden assumptions, including unintended external connectivity or credential handling.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
该技能表面上是“计算器服务”,但实现并不在本地执行数学运算,而是统一通过 call_api 将用户输入发送到外部服务。这会改变信任边界:用户可能认为输入仅在本地处理,实际却被远程接收、记录或二次利用,形成隐私和供应链风险。

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
整个工具层为大量数学函数提供统一的外部 API 转发能力,这使技能拥有超出“本地计算器”最小必要范围的网络出站能力。即便当前仅用于数学接口,这种设计仍扩大了攻击面:远程端被替换、滥用或返回恶意/误导结果时,调用方缺少本地约束与隔离。

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill instructs the model to request an API key from the user and persist it via configuration, but provides no warning about storage location, retention, access controls, or transmission. This can lead to unsafe credential collection and long-term exposure of secrets in files or logs.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The request sends an API key in headers and serializes arbitrary params to an external service without any indication in this file of notice, consent, or data minimization. In a calculator context, users may reasonably input proprietary or sensitive numeric data, so silent transmission to a third party creates avoidable privacy and credential-handling risk.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The function writes the supplied API key directly into .env without any user-facing warning, confirmation, or notice of persistence. This is risky because users may provide a secret expecting temporary in-memory use, but the code silently creates a durable credential artifact on disk.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
代码在各数学函数中直接向外部 API 发送参数,但从该文件可见没有任何面向用户的告知或同意流程,用户很可能误以为输入仅用于本地计算。即使输入通常是数字,仍可能包含敏感商业、科研或财务数据;未经披露的外发会造成隐私、合规和信任问题。

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
88% confidence
Finding
Configuring the application to read a .env file for secrets is a form of credential access, and in this skill it is suspicious because a calculator service should not need hidden remote-service credentials. This expands the attack surface by encouraging local secret storage and undisclosed dependency on external authentication.

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
95% confidence
Finding
The post-init hook explicitly opens and parses .env to force-read XBY_APIKEY, bypassing normal transparent configuration expectations. In the context of a calculator skill, this is especially dangerous because it indicates hidden credential acquisition behavior for an unrelated service.

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
95% confidence
Finding
This code checks for the presence of .env and reads its content to extract a specific API key, which is a direct credential access path. Because the skill is presented as a calculator, this hidden secret-reading behavior materially increases suspicion and could lead to unauthorized use of stored credentials.

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
86% confidence
Finding
The fallback to os.getenv('XBY_APIKEY') accesses a secret from the environment for an unrelated remote service. Environment-based secret access is common in legitimate software, but here it is still risky because it supports concealed credential use inconsistent with the advertised calculator-only purpose.

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
94% confidence
Finding
The function dedicated to saving an API key into .env demonstrates built-in credential management for a service that the skill description does not justify. Such code can cause plaintext secret exposure on disk and can normalize unsafe secret handling practices for users.

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 function is explicitly designed to persist a supplied API key to .env, reinforcing hidden credential storage behavior. In the context of a calculator skill, this is unnecessary and increases the likelihood of secret leakage or misuse.

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
The dependency uses a lower-bound specifier (requests>=2.31.0) instead of pinning to a specific version or constrained range, which makes builds non-reproducible and can silently pull in unexpected upstream changes. In a network-capable service, this increases supply-chain and stability risk because a future release could introduce breaking behavior or a vulnerable version path without code changes in this project.

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
90% confidence
Finding
pydantic>=2.7.0 is unpinned, so installations may resolve to different versions over time. That creates reproducibility and supply-chain exposure, especially in an MCP service where parsing and validation libraries are security-relevant and upstream regressions could affect input handling.

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
90% confidence
Finding
pydantic-settings>=2.2.0 is unpinned, allowing unreviewed future versions to be installed. Because settings libraries influence environment/config loading, unexpected upstream changes can alter security-sensitive configuration behavior or introduce dependency-chain risk.

Static analysis

No suspicious patterns detected.