Back to skill

Security audit

文档处理服务

Security checks for vulnerabilities and agentic risk

Overview

This skill provides documentation lookup tools, but it asks for and persistently stores an API key while showing confusing service identity mismatches.

Review this before installing. Only use it if you trust the XiaoBenYang service and are comfortable giving it an API key. Treat the key as persistent because the skill writes it to .env; avoid sharing the workspace, check file permissions, and remove the key when no longer needed. Do not use production or high-value credentials unless the publisher clarifies the Atlas Docs versus XiaoBenYang/Gaokao mismatch and constrains the API endpoint.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:42
Finding

API Key Stored in an Unprotected 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 ``` The related validation only removes leading and trailing whitespace: ```python 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() if not save_api_key_to_env(api_key): return False settings.api_key = api_key return True ``` ### Technical Analysis The supplied API key is written directly to `.env` as plaintext. The implementation does not explicitly create or enforce restrictive file permissions. Consequently, the credential may be exposed through local file access, backups, workspace sharing, or accidental source-control commits. The API key is also interpolated directly into an environment-file entry without rejecting embedded carriage-return or newline characters. Calling `strip()` does not remove newlines within the value. A crafted value such as `key-value\nADDITIONAL_SETTING=value` can therefore create additional entries in the generated `.env` file. Those entries may affect later process executions if con ...[truncated 1223 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/call_api.py:50
Finding

API Credential Can Be Redirected to an Environment-Controlled Destination

Content
View full analysis
HttpResult: """调用小笨羊MCP工具""" 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", } t0 = time.time() try: resp = self._session.post( url=url, headers=headers, data=json.dumps(params), timeout=settings.timeout_seconds, ) ``` ### Technical Analysis `SettingsConfigDict` allows `base_url` to be populated through `XBY_GAOKAO_BASE_URL` or the configured `.env` source. The client subsequently sends the API key in the `XBY-APIKEY` header to the resulting URL. No validation requires HTTPS, verifies the exact expected hostname, restricts ports, or prevents the endpoint from targeting an attacker-controlled host. Therefore, an attacker who can influence the process environment or relevant `.env` configuration can redire ...[truncated 1413 chars]
Remediation
View remediation
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)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documentation service identity is contradicted by instructions to persist API keys, read local configuration, modify environment variables, and use settings apparently tied to another service context. That inconsistency makes the skill more dangerous because it obscures sensitive credential handling and suggests the package may be repurposed from an unrelated project.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documentation service identity is contradicted by instructions to persist API keys, read local configuration, modify environment variables, and use settings apparently tied to another service context. That inconsistency makes the skill more dangerous because it obscures sensitive credential handling and suggests the package may be repurposed from an unrelated project.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill includes an API-key collection and storage workflow that is inconsistent with a simple documentation browsing service. In context, this is especially concerning because the surrounding documentation presents the skill as benign reference access while embedding credential collection and persistence behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The configuration is for an unrelated '小笨羊高考' service and manages its API key, while the skill is presented as a document-processing service. This mismatch is a strong supply-chain red flag because it can cause the skill to collect, store, and use credentials for a different backend than users expect, increasing the risk of hidden data flows or unauthorized service access.

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
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 32)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
84% confidence
Finding

The post-init hook explicitly reads .env and extracts XBY_APIKEY outside the normal settings flow, reinforcing manual secret handling for an unrelated service. In the context of a mismatched skill purpose, this custom credential retrieval increases suspicion and expands the chance of hidden or unnecessary secret collection.

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

This function is specifically designed to save an API key into a plaintext .env file on disk. Persisting secrets this way is risky because the file may be readable by other local processes, included in backups, or accidentally committed, and it is especially unjustified given the skill's declared document-processing role.

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

The skill declares broad operational behavior involving environment access, file reads/writes, and network use, but does not define any explicit tool scope or allowed-tools boundary. In an agent setting, this increases the chance of unintended capability use, especially because the document instructs the model to collect credentials, persist them, and call remote services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs the model to ask the user for an API key and store it, but provides no warning about persistence, exposure risk, or least-retention practices. In an LLM-agent context, normalizing natural-language credential collection can cause users to disclose secrets into chat and permit storage in insecure locations like .env files.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instructions create a natural-language workflow for collecting, storing, and later using a user-provided API key. This is dangerous because secrets may be exposed in chat transcripts, persisted in plain text, and reused by the agent outside the user's clear visibility or control.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Instructing the model to directly present raw API return data creates a semantic data-leak risk because the response may contain sensitive user inputs, hidden backend fields, or operational metadata. The danger is higher here because the skill already intermediates authenticated remote calls and does not define any sanitization boundary.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The project structure references a gaokao/XBY-oriented package and workflow comments that do not match the advertised Atlas Docs identity. Such contradictions reduce auditability and make it harder for users to understand what backend they are really interacting with, increasing the risk of deceptive or unsafe operation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code includes user-facing text only in Chinese, such as the class/function docstrings and error messages, and provides no opt-in or fallback for other languages. That is a natural-language locale constraint embedded in the skill and matches the policy category for forced language without user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The file’s natural-language docstrings, comments, and user-visible print message are entirely in Chinese, which can indicate a fixed language assumption rather than offering language choice. Under the stated policy, forcing a specific language without user opt-in is a locale/language policy concern unless clearly documented as region-specific and justified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code persists an API key locally into a .env file, which is not justified by the stated purpose of converting documentation for LLM use. Local credential persistence creates a lasting secret on disk that may be exposed through accidental commit, local compromise, backups, or later reuse by unrelated components.

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 supplied API key directly into .env without any user-facing disclosure, confirmation, or warning. Users may believe they are providing a temporary token while the software silently creates persistent local secret storage, which increases the chance of credential leakage and trust violations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
71% confidence
Finding

The skill content imposes core instructions and requirements primarily in Chinese, while some tool descriptions are in English, and it does not state that the user may choose their preferred language. This can amount to an implicit language-policy constraint because the operational guidance appears tailored to a specific language without opt-in or explicit justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The skill directs the model to display raw API response data directly to the user without any filtering or safety review. If the upstream service returns unexpected fields, internal metadata, or sensitive content, the agent may disclose it verbatim.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency specification uses a lower-bound only constraint for requests, which makes builds non-reproducible and allows installation of different future versions over time. This increases supply-chain risk and makes it impossible to guarantee that a known-safe version is installed, especially given the package's advisory history.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Unverifiable Dependency: requests has 16 known advisory(ies) (CVE-2014-1830 (Exposure of Sensitive Information to an Unauthorized Actor in Requests); 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) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
93% confidence
Finding

requests has multiple known advisories, but because the manifest does not pin a version, there is no way to verify whether the installed release includes fixes. In a documentation-processing MCP service, requests is likely used for network retrieval, so unresolved version ambiguity increases the chance of exposing network-facing code paths to known flaws.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The pydantic dependency is not pinned to a specific version, so installations may resolve to different releases depending on when and where they are built. That weakens reproducibility and can unintentionally introduce vulnerable or incompatible versions into the environment.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Unverifiable Dependency: pydantic has 4 known advisory(ies) (CVE-2021-29510 (Use of "infinity" as an input to datetime and date fields causes infinite loop i); CVE-2024-3772 (Pydantic regular expression denial of service); CVE-2021-29510 (Pydantic is a data validation and settings management using Python type hinting.) +1 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
90% confidence
Finding

pydantic has known advisories, and the unpinned requirement prevents confirming that a patched release will be installed. Because this service likely processes external documentation content and configuration, relying on an unverifiable parser/validation version creates avoidable uncertainty around denial-of-service or parsing-related weaknesses.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

Using an open-ended version range for pydantic-settings means the deployed package version cannot be predicted or consistently reproduced. If upstream publishes a vulnerable or breaking release that still satisfies the constraint, environments may silently adopt it.

Content

Scanner excerpt · requirements.txt (reported line 3)May include surrounding context.

text
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1

Static analysis

No suspicious patterns detected.