Back to skill

Security audit

find bearings skill

Security checks for vulnerabilities and agentic risk

Overview

The skill does not look malicious, but its script reads bearing data from an unexpected directory outside the skill package and the package overstates what it can actually do.

Review before installing. The skill appears to be a simple local bearing lookup helper with no network or persistence, but it should be fixed to read only packaged skill data and to accurately describe its limited implemented capabilities. Avoid using it in environments where unrelated or sensitive JSON files may exist in the ancestor-level data/models path.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (1)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/search_model.py:20
Finding

Out-of-Scope JSON File Access Caused by Incorrect Data-Directory Resolution

Content
View full analysis

Vulnerability Details

File Location: scripts/search_model.py, lines 20–33
Vulnerability Type: Out-of-scope filesystem access
Risk Level: Medium

Vulnerable Code

python
script_dir = Path(__file__).resolve().parent
skill_dir = script_dir.parent
project_dir = skill_dir.parent.parent.parent
return project_dir / "data"


def load_all_models():
    """加载所有型号数据"""
    data_dir = get_data_dir()
    models_dir = data_dir / "models"

    all_models = []
    if models_dir.exists():
        for json_file in models_dir.glob("*.json"):
            try:
                with open(json_file, 'r', encoding='utf-8') as f:

Technical Analysis

The script intends to locate a data directory associated with the Skill, but it traverses three parent directories above the Skill root. Given the audited deployment path, script_dir resolves to the artifact/scripts directory and skill_dir resolves to artifact. Consequently, skill_dir.parent.parent.parent resolves to the filesystem root, causing the effective data path to become /data.

The script therefore reads every matching /data/models/*.json file instead of files under the Skill's own data directory. This violates the least-privilege boundary and conflicts with the data layout documented in SKILL.md.

Files are opened using the permissions of the process running the Skill. The code does not itself elevate operating-system privileges, but it can access unrelated files that the invoking process is already authorized to read. Parsed records are trusted without schema validation and are subsequently used as model data.

Attack Path

  1. An attacker or another application creates or modifies a JSON file under /data/models.
  2. The attacker supplies a document containing a models collection with crafted, misleading, or malformed model records.
  3. A user or Agent invokes scripts/search_model.py for a bearing model.
  4. `get_data_di ...[truncated 1283 chars]
Remediation
View remediation

Remediation Suggestions

Resolve the data directory directly relative to the Skill root:

python
def get_data_dir():
    skill_dir = Path(__file__).resolve().parent.parent
    return skill_dir / "data"

Apply the following additional hardening measures:

  1. Resolve both the trusted data root and each candidate file with Path.resolve().
  2. Verify that every resolved candidate remains beneath the trusted Skill data directory before opening it.
  3. Reject symbolic links if model data may be stored in a directory writable by untrusted users.
  4. Validate JSON documents against a strict schema before using model records.
  5. Replace direct required-field access such as model['model'] with validated access after confirming field types and presence.
  6. Package the documented data/models directory with the Skill or fail explicitly when it is absent.
  7. Add automated tests asserting that get_data_dir() resolves to the Skill-local data directory and never to /data or another ancestor directory.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (4)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

代码与声明在“轴承型号搜索”和“部分型号解析”方面是一致的,但声明明显比实际实现更广。实际代码只有一个命令行脚本,核心功能是:读取本地 JSON 型号库、查找指定型号、对带后缀型号做基础型号回退、并对部分类似 6204 的编码做简单拆解。它没有任何品牌检索或产品线查询逻辑,也没有根据工况进行选型建议或应用场景匹配的实现。因此,声明的多个核心能力未在代码中体现,属于描述与实际行为不符。不过,代码没有发现额外的、未声明的敏感或无关能力;问题主要是声明过度。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The description says the skill triggers whenever a user asks about bearing models, brands, specifications, or selection problems, but it does not define specific trigger phrases, exclusions, or boundaries for when general mechanical questions should not invoke the skill. This broad natural-language condition could overlap with ordinary product or engineering questions and cause unintended activation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code file contains user-facing usage text entirely in Chinese and continues that pattern throughout runtime messages, which forces a specific language experience without user opt-in. Under the policy, locale or language restrictions should either be optional or clearly justified as region-specific.

Content

No source excerpt is available for this finding.