Back to skill

Security audit

菜谱推荐服务

Security checks for vulnerabilities and agentic risk

Overview

This recipe skill appears purpose-aligned overall, but it asks for an API key and persists it in a local plaintext .env file without adequate storage disclosure or permission controls.

Review before installing. Use a disposable or tightly scoped Xiaobenyang API key if possible, avoid entering valuable credentials in shared workspaces, and rotate the key if a generated .env file may have been exposed. The publisher should replace plaintext persistence with host-managed secret storage or require explicit consent and restrictive file permissions.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/config.py:44
Finding

API Key Persisted in Plaintext Without Restrictive File Permissions

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 except Exception as e: print(f"保存API key失败: {e}") return False ``` ### Technical Analysis The function stores the API key directly in a plaintext `.env` file. `Path.write_text()` creates the file using permissions derived from the process umask and preserves the permissions of an existing file. The code neither creates the file with an explicit owner-only mode such as `0600` nor verifies that an existing `.env` file is not readable by other users. Consequently, in a shared or incorrectly configured runtime environment, another local user or process may be able to read the API key. The relative path also means the secret is written into the current working directory, which may be a shared location or inadvertently included in backups, archives, or source-control operations. The key is additionally placed in the process environment. Although this is not ordinarily exposed to unrelated users on a correctly secured operating system, privileged processes, crash diagnostics, or process-inspection facilities may reveal it. ### Attack Path 1. A user supplies a vali ...[truncated 1027 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unbounded and Unhashed Third-Party Dependencies

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 specifies only a minimum version. A fresh installation can therefore select any later version available from the configured package index, including a release that has not been reviewed or tested with this project. The manifest also provides no package hashes, so the installer does not verify artifacts against a project-approved set of cryptographic digests. This configuration produces non-reproducible builds and expands the supply-chain trust boundary to future package releases. It does not, by itself, prove that any listed package is malicious or currently vulnerable. Exploitation depends on a compromised package release, compromised package index or mirror, dependency-resolution manipulation, or an incompatible future release. ### Attack Path 1. An attacker compromises an allowed dependency release, its maintainer account, or the package source used by the deployment environment. 2. The attacker publishes a later version that still satisfies the unrestricted `>=` constraint. 3. A developer or deployment system performs a fresh dependency installation or upgrade. 4. The resolver selects the attacker-controlled or otherwise unsafe release because no exact version or approved artifact hash is required. 5. Malicious package behavior may execute during installation, import, or application runtime with the privileges of the installation or application process. This path is conditional on an external supply-chain compromise; no evidence of a currently malicious dependency was identified during the audit. ### Impact Assessment If a dependency were compromised, code from that package could execute with the same privilege ...[truncated 415 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 (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented purpose is recipe recommendation, but the file also instructs the model to collect and persist an API key and contains remnants of an unrelated gaokao/school-search skill. This mismatch is dangerous because it obscures real capabilities from reviewers and users, increasing the chance that credential handling or other side effects occur without informed consent.

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

The custom post-init logic force-reads .env and extracts a specific API key outside the normal settings framework, creating unnecessary direct secret handling. This makes credential flow less transparent and can bypass safer host expectations about how secrets should be provided and audited.

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

The explicit filesystem read of .env is part of custom credential access logic and unnecessarily increases exposure of plaintext secrets in application code. In this skill context, direct secret scraping from local files is more suspicious because recipe recommendation functionality does not require bespoke credential file inspection.

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

This function explicitly saves an API key to a local .env file in plaintext, creating a durable secret exposure point that can be leaked through local compromise, backups, logs, packaging, or accidental commit. In a recipe recommendation skill, such credential persistence is unnecessary to core functionality and therefore more suspicious and risk-prone.

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

The skill declares no explicit tool scope or permissions despite documented capabilities that include environment access, local file read/write, and network use. In an agent environment, missing scope declarations weakens least-privilege controls and can allow broader execution than users would reasonably expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to ask the user for an API key and persist it via configuration without explaining storage location, retention, access controls, or risks. Collecting secrets through conversational flow and writing them to local configuration can expose credentials to logs, other tools, other skills, or future sessions if the environment is shared or insufficiently protected.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example call references a school-search function unrelated to the recipe skill, indicating copy-pasted or stale operational instructions. Misaligned examples can cause the agent to invoke unintended tools or normalize hidden capabilities that are outside the advertised skill boundary.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file contains user-facing docstrings and error/message strings only in Chinese, including the API client description and runtime error messages. This imposes a specific language on users without any visible opt-in, fallback, or documentation that the skill is intentionally region- or locale-specific.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The module provides functionality to persist an API key into a local .env file and update process environment state, which exceeds the expected read-only behavior of a recipe recommendation skill. Persisting secrets to disk increases the chance of accidental disclosure through local file exposure, source packaging, backups, or misconfigured repository handling.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

Writing credentials to .env and modifying os.environ is not directly justified by the stated recipe recommendation purpose and adds unnecessary secret-handling capability. This broadens the attack surface by allowing sensitive values to be stored in plaintext on disk and propagated within the runtime environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code persists an API key to .env without any visible confirmation, consent flow, or warning that a plaintext secret will be written to disk. Users or integrators may assume the key is used transiently, leading to unanticipated long-term credential exposure on the filesystem.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The function sends potentially sensitive health-related preferences, including allergy and dietary avoidance data, to a remote API via call_api without any visible notice, consent flow, minimization, or documentation of handling in this file. Allergy data can reveal health information, and transmitting it off-process or off-device without clear disclosure increases privacy and compliance risk if users are unaware or if the backend is not appropriately protected.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
71% confidence
Finding

The entire skill description and operating instructions are written only in Chinese, with no indication that users may interact in other languages or that the skill is intentionally restricted to a Chinese-speaking context. Under the language/locale policy, a forced locale should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

L123 将项目根目录写为 xiaobenyang_gaokao_skill/,而当前清单与全文均描述的是菜谱推荐服务。该文档内容与技能身份直接冲突,容易让使用者误解代码用途与预期实现。

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency is specified with a lower-bound only constraint, so future installs may resolve to different versions over time. This weakens reproducibility and makes it difficult to verify whether a deployed version includes a vulnerable release or an unexpected breaking change.

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

The manifest references requests without pinning a specific release, while the package has multiple known advisories. Because the resolved version is unknown, it is impossible to confirm from this file alone whether deployments will avoid affected versions, creating an avoidable supply-chain risk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

Using pydantic>=2.7.0 allows installation of any newer version, which prevents deterministic builds and complicates security assurance. If an affected version is later resolved by the package manager, the application could inherit vulnerabilities without any source change.

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

pydantic has known advisories, but the requirement is not pinned, so the actual installed version cannot be verified from the manifest. This leaves open the possibility of resolving to a vulnerable version in some environments.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

An unpinned pydantic-settings dependency means the actual installed package version is not fixed, reducing supply-chain predictability. This makes security review weaker because the runtime version may differ across environments and may include vulnerable releases.

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

Unverifiable Dependency: pydantic-settings has 1 known advisory(ies) (CVE-2026-58203 (pydantic-settings: NestedSecretsSettingsSource follows symlinks outside secrets_)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
92% confidence
Finding

Because pydantic-settings is not pinned, the project cannot demonstrate that installations exclude advisory-affected versions. This is especially relevant for configuration-handling libraries, where defects can affect secrets loading or filesystem interactions.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

python-dotenv>=1.0.1 does not guarantee a specific installed version, which can introduce inconsistent behavior and uncertain exposure to dependency vulnerabilities. In security-sensitive environments, this is a supply-chain hygiene issue even if no direct exploit is present in the manifest itself.

Content

Scanner excerpt · requirements.txt (reported line 4)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: python-dotenv has 2 known advisory(ies) (CVE-2026-28684 (python-dotenv: Symlink following in set_key allows arbitrary file overwrite via ); CVE-2026-28684 (python-dotenv reads key-value pairs from a .env file and can set them as environ)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
92% confidence
Finding

python-dotenv has published advisories, and the current requirement does not constrain installs to a verified safe release. As a result, environments may end up with a vulnerable version, particularly if dependency resolution changes over time.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

Settings 类的文档字符串写明是“小笨羊高考Skill配置”,但当前技能 manifest 明确是“菜谱推荐服务”。这表明注释/文档与代码所属技能意图不一致,容易误导审计者和维护者对该模块服务对象与配置语义的理解。

Content

No source excerpt is available for this finding.