Back to skill

Security audit

科学计算工具

Security checks for vulnerabilities and agentic risk

Overview

This calculator skill should be reviewed carefully because it requires and stores an API key, sends calculations to a third-party service, and contains mismatched gaokao-related artifacts.

Install only if you specifically trust xiaobenyang.com/XiaoBenYang with your API key and all calculation inputs. Avoid using this for sensitive numbers, and prefer a local calculator skill unless the publisher clarifies why remote API execution and plaintext .env storage are required.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:45
Finding

API Key Persisted in a Plaintext Environment File

Content
View full analysis
bool: """将API key保存到.env文件""" try: env_path = Path(".env") lines = [] if env_path.exists(): lines = env_path.read_text(encoding="utf-8").splitlines() found = False new_lines = [] for line in lines: if line.startswith("XBY_APIKEY="): new_lines.append(f"XBY_APIKEY={api_key}") found = True else: new_lines.append(line) 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 ``` ### Technical Analysis The skill stores the user-provided API key directly in a plaintext `.env` file in the current working directory. No encryption, operating-system credential storage, ownership validation, or explicit restrictive file permissions are used. When the file is newly created, its permissions depend entirely on the process umask. When an existing file is overwritten, potentially insecure permissions are retained. The current working directory is also used instead of a fixed, application-specific configuration directory, increasing the possibility of writing the credential into a shared workspace or source repository. ### Attack Path 1. A user provides an API key as required by the skill. 2. `set_api_key()` invokes `save_api_key_to_env()`. 3. The key is written as `XBY_APIKEY=` to `.env`. 4. An unrelated local process, another user with workspace access, a backup process, or a source-control operation obtains the `.env` file. 5. The exposed key is reused to make requests under the victim's API account. ### Impact Assessment Successful exploi ...[truncated 388 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/call_api.py:56
Finding

API Credential Can Be Redirected to an Attacker-Controlled Endpoint

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/tools.py:8
Finding

Unnecessary External Disclosure of Calculation Inputs

Content
View full analysis
Dict[str, Any]: """ 两个数相加 Args: a: null b: null Returns: null """ arguments = { "a": a, "b": b } return call_api("1777419068744707", "add", arguments) ``` The parameters are transmitted to the remote endpoint: ```python url = f"{settings.base_url}/api" mcp_id = mcp_id or settings.mcp_id api_key = get_api_key() if not api_key: raise UpstreamError("API密钥未设置,请先调用 set_api_key()") headers = { "XBY-APIKEY": api_key, "func": tool_name, "mcpid": mcp_id, "Content-Type": "application/json", } # data = {k: str(v) if v is not None else "" for k, v in params.items()} t0 = time.time() try: resp = self._session.post( url=url, headers=headers, data=json.dumps(params), timeout=settings.timeout_seconds, ) ``` ### Technical Analysis Operations such as addition, subtraction, multiplication, trigonometry, logarithms, roots, powers, and factorials can be performed locally using Python's standard library. Instead, the skill sends all operands to an external service and requires an API credential. The documentation discloses that tools invoke an API, so this is not covert network behavior. Nevertheless, the design violates data-minimization and least-capability principles because network access and credential collection are unnecessary for the advertised calculations. It also makes result integrity and availability dependent on the external service. ### Attack Path 1. A user submits calculation operands to the skill. 2. The selected tool packages the operands into an argument dictionary. 3. `call_api()` serializes the arguments a ...[truncated 665 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
Findings (38)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is described as a calculator but the documentation indicates reading and persisting an API key, using environment variables, and referencing gaokao-related configuration. That inconsistency strongly suggests repurposed or mislabeled functionality, which increases the risk of inappropriate credential collection and user deception.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is described as a calculator but the documentation indicates reading and persisting an API key, using environment variables, and referencing gaokao-related configuration. That inconsistency strongly suggests repurposed or mislabeled functionality, which increases the risk of inappropriate credential collection and user deception.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

A scientific calculator should be able to perform its core function locally, yet this skill requires an external API key before use. That creates an unjustified dependency on a third-party service and pressures users to surrender credentials for a task that normally needs no network access, making the context significantly more suspicious.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs the agent to ask for and persist a third-party API key even though such a credential is not reasonably necessary for calculator functionality. In this context, collecting secrets is more dangerous because users would not expect a basic math tool to handle credentials at all, creating elevated phishing and secret-retention risk.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The project structure and examples reference a gaokao-related skill and school-search behavior that conflict with the scientific-calculator branding. This kind of internal inconsistency is a strong indicator of mislabeled or repackaged functionality, which can conceal the true purpose of the skill and lead users to trust an unrelated remote service.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code sends calculation requests and an API key to an external MCP service, creating a data egress path and making the skill depend on remote execution rather than local computation. For a scientific calculator, outbound transmission is unnecessary for the stated functionality and increases risk of data exposure, unauthorized third-party processing, and supply-chain abuse if the upstream service is compromised or behaves unexpectedly.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The function is a generic remote tool dispatcher: it accepts arbitrary mcp_id, tool_name, and params and forwards them to an upstream service via headers and JSON body. In the context of a scientific calculator, this capability is overbroad and unjustified, meaning the skill could be repurposed to invoke non-calculator remote tools or hidden behaviors beyond user expectations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file’s behavior materially conflicts with the advertised skill purpose: instead of a simple scientific calculator, it manages persistent API credentials for an unrelated MCP/gaokao service. That mismatch is a strong supply-chain red flag because users may grant or store secrets they would not expect a calculator skill to access, increasing the risk of covert credential collection or unauthorized external service use.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 13)May include surrounding context.

python
model_config = SettingsConfigDict(
        env_prefix="XBY_GAOKAO_",
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )

Credential Access

High
Category
Privilege Escalation
Confidence
85% confidence
Finding

The code explicitly opens and parses .env to extract XBY_APIKEY, duplicating the settings library’s behavior and increasing the amount of custom secret-handling logic. In a skill that does not obviously require remote credentials, this manual secret access is suspicious and increases the chance of accidental exposure, misuse, or future extension into covert credential harvesting.

Content

Scanner excerpt · scripts/config.py (reported line 31)May include surrounding context.

python
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")

Credential Access

High
Category
Privilege Escalation
Confidence
85% confidence
Finding

Checking for and reading a local .env file to retrieve an API key constitutes direct access to stored credentials. While not inherently malicious, in this misleading skill context it increases concern because a calculator-like tool is unexpectedly inspecting local secret material.

Content

Scanner excerpt · scripts/config.py (reported line 32)May include surrounding context.

python
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():

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/config.py (reported line 39)May include surrounding context.

python
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

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

Persisting an API key to a local .env file is unjustified for a scientific-calculation tool and creates a durable secret-at-rest that may be exposed through source control, backups, logs, or multi-user filesystem access. In this context, the capability is more dangerous because it is unexpected and broadens the attack surface beyond what users would anticipate from a calculator.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

This function is dedicated to saving an API key into .env, creating persistent local credential storage. In the context of a purported scientific calculator, this is unnecessarily dangerous because it can silently retain secrets on disk and facilitate later compromise via repository leakage, local file disclosure, or unintended reuse by other processes.

Content

Scanner excerpt · scripts/config.py (reported line 48)May include surrounding context.

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

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill exposes capabilities consistent with environment access, file read/write, and network use, but it does not declare any explicit tool scope or permissions boundary. For a skill presented as a simple calculator, this hidden capability expansion reduces transparency and can enable unnecessary credential handling and outbound communication without clear user consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill metadata and all user-facing instructions are written exclusively in Chinese, indicating a fixed language experience. There is no statement offering language selection or documenting a justified locale restriction such as a region-specific compliance requirement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill requires users to provide an API key and save it, but it does not disclose how the credential is stored, protected, reused, or exposed to other components. Lack of credential-handling transparency can lead to unsafe storage practices and accidental secret leakage, especially when paired with file-write and environment access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The workflow and return-value instructions describe a generic router that forwards requests to external functions and displays raw API data, rather than a bounded local calculator. In this context, the skill acts more like an opaque API wrapper, increasing the risk of hidden remote behavior and overbroad data exposure to users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The request transmits user-supplied parameters and API credentials to an external service, but this file provides no user-facing disclosure, consent, or indication of what data leaves the system. While not a memory-safety flaw, it is a genuine privacy and transparency issue because users of a calculator would reasonably expect local processing, not hidden network transmission.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The docstring identifies the code as a gaokao skill configuration while the package is presented as a scientific calculator, indicating likely code reuse or repurposing without transparent disclosure. Such intent mismatch is a security concern because it suggests hidden or unrelated functionality may be embedded, undermining user trust and review assumptions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The function writes sensitive credentials to .env immediately, with no user-facing warning, consent, or explanation of persistence. This can cause users to unknowingly leave long-lived secrets on disk where they may later be exfiltrated or accidentally committed to a repository.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

该工具表面上是本地“科学计算”封装,但所有计算参数都会被发送到远程 API 处理,造成与用户预期不符的数据外传和可用性依赖。即使输入通常只是数字,这种隐式远程执行仍会带来隐私、完整性和供应链风险,尤其当上层代理把敏感数值、公式或业务数据传入这些函数时。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

该 API 调用会把用户输入参数发送到外部服务,但代码和文档未向用户披露这一点。缺乏透明度会导致用户在不知情下共享输入内容,并使调用方低估隐私、合规和第三方服务故障风险。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

此函数同样将参数发送给远程 API,却没有任何用户可见的告知或同意流程。对于看似简单的本地数学功能,这种隐式网络传输尤其容易造成错误信任和数据处理边界误判。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

远程 API 调用未说明用户输入会离开本地环境,违反了对“计算器/数学工具”这类低风险本地工具的常见预期。攻击面主要来自数据外传、服务被篡改返回错误结果以及第三方依赖不可用。

Content

No source excerpt is available for this finding.