Back to skill

Security audit

数学计算引擎

Security checks for vulnerabilities and agentic risk

Overview

This math skill is a remote API wrapper that asks for and stores an API key, but it also exposes administrative/status and destructive session-history functions with weak scoping.

Review this skill before installing. It may be acceptable only if you trust the XiaoBenYang service and are comfortable storing an API key in a local .env file, sending all calculation requests to a remote API, and exposing admin/status plus history/session deletion tools. Avoid using a sensitive production key until endpoint validation, safer secret storage, and confirmation prompts for destructive actions are added.

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/call_api.py:45
Finding

Environment-Controlled API Endpoint Can Exfiltrate Credentials and User Data

Content
View full analysis
HttpResult: """Call a XiaoBenYang MCP tool.""" 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 key is not configured; call set_api_key() first") headers = { "XBY-APIKEY": api_key, "func": tool_name, "mcpid": mcp_id, "Content-Type": "application/json", } t0 = time.time() try: resp = self._session.post( url=url, headers=headers, data=json.dumps(params), timeout=settings.timeout_seconds, ) ``` ### Technical Analysis The Pydantic settings model uses the `XBY_GAOKAO_` environment-variable prefix. Consequently, `XBY_GAOKAO_BASE_URL` can override the intended `https://mcp.xiaobenyang.com` endpoint. The request code constructs a URL directly from this configurable value and sends the `XBY-APIKEY` header without validating the URL scheme, hostname, port, or origin. An attacker who can influence the process environment or `.env` configuration can therefore redirect requests to an attacker-controlled endpoint. The same request body includes tool parameters. Depending on the invoked operation, those parameters may contain mathematical expressions, natural-language queries, session identifiers, session variables, or other user-provided data. Redirect beh ...[truncated 1177 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:43
Finding

API Key Is Persisted in a Plaintext File Without Explicit Permission or Symlink Protections

Content
View full analysis
bool: """Save the API key to the .env file.""" 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 except Exception as e: print(f"Failed to save API key: {e}") return False ``` ### Technical Analysis The API key is written in plaintext to `.env` in the process's current working directory. The implementation does not explicitly create the file with owner-only permissions, verify file ownership, reject symbolic links, or use an atomic secure-file creation procedure. For a newly created file, effective permissions depend on the process umask. If the umask permits group or world access, another local account or process may be able to read the secret. If `.env` already exists with permissive permissions, rewriting it does not correct those permissions. The use of a relative current-working-directory path also makes the storage location dependent on how the Skill is launched. An attacker who can prepare the working directory may create a symbolic link at `.env`, potentially causing an unintended writable target to be modified. ### Attack Path **Credential disclosure path:** 1. The Skill executes in a shared or attacker-influenced work ...[truncated 1318 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Open-Ended Dependency Constraints Prevent Reproducible, Reviewed Installations

Content
View full analysis
=2.31.0 pydantic>=2.7.0 pydantic-settings>=2.2.0 python-dotenv>=1.0.1 ``` ### Technical Analysis Every dependency is specified with an open-ended minimum version. A fresh installation may therefore retrieve a newer version than the version originally tested or audited. No lock file or package hashes are provided to verify exact artifacts. The listed package names and sources are not themselves shown to be malicious. The issue is that the dependency policy permits future, unreviewed releases and makes installations non-reproducible. This expands exposure to upstream compromise, malicious releases, regressions, and incompatible security behavior. ### Attack Path 1. A deployment installs dependencies at a later date using `pip install -r requirements.txt`. 2. The package resolver selects newer releases that satisfy the open-ended minimum constraints. 3. A selected release contains compromised installation/runtime code or an unreviewed security regression. 4. The package code executes during installation, import, or normal Skill operation with the privileges of the account running the Skill. 5. Any resulting access is bounded by that account's operating-system permissions and available secrets. This is a supply-chain risk path rather than evidence that any currently declared package is malicious. ### Impact Assessment If an allowed future dependency release is compromised, arbitrary package code may execute with the privileges of the installing or running account. That code could access the Skill's API key, user data, network connectivity, and files available to the process. The present files do not establish an active dependency compromise; therefore, the finding is rated Low and represents preventable supply-chain exposure. ]]>
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
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (37)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The advertised math-focused role conflicts with documented access to performance metrics, security status, memory statistics, optimization, and history-clearing operations. Administrative and introspection functions can reveal system state or alter retained data, which is substantially more sensitive than ordinary calculator behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The advertised math-focused role conflicts with documented access to performance metrics, security status, memory statistics, optimization, and history-clearing operations. Administrative and introspection functions can reveal system state or alter retained data, which is substantially more sensitive than ordinary calculator behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The advertised math-focused role conflicts with documented access to performance metrics, security status, memory statistics, optimization, and history-clearing operations. Administrative and introspection functions can reveal system state or alter retained data, which is substantially more sensitive than ordinary calculator behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow example references school-search behavior and the project structure references a gaokao-specific package, indicating copy-paste residue or undocumented alternate behavior. Such contradictions reduce trustworthiness and increase the risk that hidden or unintended functions exist beyond the declared purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documented toolset includes system introspection and state-management capabilities unrelated to the claimed mathematics purpose. Embedding such functions in a benign-seeming math skill makes abuse more plausible because operators may approve it without recognizing that it can inspect status, manage sessions, and manipulate retained state.

Content

No source excerpt is available for this finding.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
94% confidence
Finding

The presence of a clear_history capability introduces direct memory/state manipulation in a skill that outwardly appears to be a calculator. In an agent environment, such a function can be abused to erase audit trails, remove context needed for safe operation, or sabotage user workflows if invoked through prompt manipulation.

Content

Scanner excerpt · SKILL.md (reported line 62)May include surrounding context.

md
| List session variables | `scripts.tools.list_session_variables` |
| Delete session | `scripts.tools.delete_session` |
| Get calculation history | `scripts.tools.get_calculation_history` |
| Clear history | `scripts.tools.clear_history` |
| Optimize memory | `scripts.tools.optimize_memory` |
| List functions | `scripts.tools.list_functions` |

Memory Manipulation

High
Category
Memory Poisoning
Confidence
94% confidence
Finding

The dedicated clear_history tool documentation confirms a destructive state-manipulation primitive with no parameters, guardrails, or confirmation requirements. A zero-argument destructive action is especially risky because it is easy to trigger and difficult to scope, making unintended or malicious erasure more likely.

Content

Scanner excerpt · SKILL.md (reported line 216)May include surrounding context.

md
---

## scripts.tools.clear_history
工具描述:Clear history
### 参数定义
|参数名称|参数类型|是否必填|默认值|描述|
|------|-------|------|-----|----|

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
88% confidence
Finding

The code explicitly reads the .env file and force-loads XBY_APIKEY outside the normal settings flow, creating bespoke secret-handling logic that is harder to audit and easier to misuse. In the context of a math skill, this extra credential access is more suspicious because it is not clearly necessary for the stated purpose and bypasses clearer, centralized configuration patterns.

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
88% confidence
Finding

Checking for and reading a local .env file as part of initialization enables silent ingestion of credentials from disk, which may surprise users and broaden the exposure path for secrets. Because this skill is presented as a mathematics engine, unadvertised credential harvesting from local files is contextually more concerning than in a clearly documented authentication utility.

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

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

This function is dedicated to saving an API key into a plaintext .env file, creating durable local secret exposure. If the host is multi-user, backed up, synced, or the project directory is later committed or shared, the credential can be compromised and used to access external services under the victim's account.

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

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill markets itself as a mathematics engine but exposes operational endpoints for performance metrics, memory statistics, and security status. These capabilities expand the trust boundary beyond math computation and can leak sensitive environment or defensive-state information that is unnecessary for the declared purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

A security_status capability is unjustified for a mathematics skill and can reveal defensive posture, hardening state, or other operational metadata useful to attackers. In this context, the mismatch between claimed function and exposed capability makes the feature especially suspicious and increases the risk of information disclosure.

Content

No source excerpt is available for this finding.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
89% confidence
Finding

The history-clearing capability constitutes memory manipulation because it can erase prior interaction or calculation context. In an agent-integrated environment, this is dangerous because it can remove evidence, interfere with traceability, and conceal misuse, especially when bundled into a skill that claims only mathematical functionality.

Content

Scanner excerpt · scripts/tools.py (reported line 299)May include surrounding context.

python
def clear_history(
) -> Dict[str, Any]:
    """
    Clear history
    
    Args:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares no explicit tool scope despite documenting capabilities that involve environment access, file reads/writes, network use, and MCP calls. Missing scope boundaries increases the chance that an agent can invoke broader capabilities than users expect, especially when the skill also handles secrets and remote operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill documentation and operational instructions are entirely in Chinese and present the workflow as mandatory, without indicating that users may choose another language or locale. This can violate language/locale policy when the skill is used in broader contexts where user language preference should be respected or explicitly opted into.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill exposes destructive operations such as deleting sessions and clearing history without requiring a warning or confirmation flow. This can lead to accidental or prompt-induced data loss, especially in agentic settings where terse user input may be over-interpreted as authorization.

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 component as a different skill ('小笨羊高考Skill配置') than the manifest's mathematics engine, creating a provenance and integrity mismatch. Such mismatches are dangerous because they can indicate code reuse from another project, accidental bundling of unrelated functionality, or deceptive packaging that makes security review and user trust decisions unreliable.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This skill advertises itself as a mathematics engine, but the code persists and manages API credentials locally in a .env file, which is functionality outside the stated purpose and increases the attack surface. Hidden credential-handling behavior is risky because users may not expect secret storage or local modification, and secrets may later be exposed through logs, backups, repository commits, or other components reading the same file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The function writes the API key directly into a local .env file without any user-facing warning, consent flow, or discussion of storage risks. Persisting secrets in plaintext can expose them to accidental commits, local disclosure, backup leakage, or access by other processes/users on the host.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Performance and memory monitoring/optimization functions are context-inappropriate for a math skill and expose host or service internals that users do not need to solve calculations. Such telemetry can aid reconnaissance and the optimization action may alter runtime state in ways unrelated to the advertised purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file includes session/history management and destructive maintenance operations such as delete_session, clear_history, and optimize_memory that are not part of a minimal math-computation interface. Hidden stateful and destructive actions can be abused to erase evidence, disrupt user workflows, or manipulate retained data without clear user awareness.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

delete_session allows removal of session state without any user-facing confirmation or indication of consequences. This can lead to loss of variables, interrupted workflows, and potential abuse if an agent can delete arbitrary sessions without ownership checks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

clear_history performs a destructive action with no visible confirmation, warning, or safety friction. An agent or user could trigger it accidentally or maliciously, causing irreversible loss of calculation records that may be important for auditability, reproducibility, or user workflows.

Content

No source excerpt is available for this finding.