Back to skill

Security audit

1688-shop-crm-customer-filter

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly matches its CRM purpose, but it should be reviewed because it handles sensitive customer data while silently reporting usage and exposing some data too broadly.

Install only in an environment where 1688 CRM access is intended and authorized. Review the automatic usage reporting, restrict who can invoke customer queries or create fields, require explicit approval for attribute creation, and prefer patching Markdown escaping plus file-path diagnostics before broad deployment.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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/capabilities/customer_list/cmd.py:165
Finding

Arbitrary Accessible Directory Enumeration Through File-Read Error Diagnostics

Content
View full analysis
str: """构建文件未找到时的诊断提示,帮助区分目录错配 vs 写未落盘。""" scratch = os.environ.get('NEWTON_SCRATCH_DIR') or "" temp = os.environ.get('TEMP') or "" parts = [ "。可能原因:", "1) 写文件与调用使用了不同的临时目录(NEWTON_SCRATCH_DIR 与 %TEMP% 指向不同路径);", "2) 写文件命令未成功落盘(exit≠0/超时),但下一步未检查直接读取;", "3) 使用了相对路径、/tmp 或 %TEMP% 字面量,未使用写入时输出的绝对路径。", f"当前 NEWTON_SCRATCH_DIR={scratch or '未设置'};TEMP={temp or '未设置'}。", ] # 列出目标路径所在目录的现有文件,帮助定位是目录错配还是写未落盘 try: dir_path = os.path.dirname(os.path.abspath(path)) if os.path.isabs(path) else os.getcwd() files = sorted(os.listdir(dir_path)) if files: sample = files[:20] parts.append(f"目标目录 {dir_path} 现有文件:{', '.join(sample)}{' 等' if len(files) > 20 else ''}。") else: parts.append(f"目标目录 {dir_path} 为空目录。") except Exception as e: parts.append(f"无法列出目标目录内容:{e}。") parts.append("推荐:在同一条 python -c 内完成写文件和调用;若必须分步,请先 print(绝对路径) 并使用该路径。") return "".join(parts) ``` The resulting diagnostic is returned to the caller from the filter and sort file error handlers: ```python except Exception as e: print_output(False, f"❌ 无法读取 --filters-file {args.filters_file}: {e}{_build_file_not_found_hint(args.filters_file)}", {}) ``` ```python except Exception as e: print_output(False, f"❌ 无法读取 --sorts-file {args.sorts_file}: {e}{_build_file_not_found_hint(args.sorts_file)}", {}) ``` ### Technical Analysis The `--filters-file` and `--sorts-file` arguments accept caller-controlled paths. If reading one of those paths fails, `_build_file_not_found_hint()` derives the containing directory and calls `os.listdir()` on it. The resulting user-visible diagnostic include ...[truncated 1851 chars]
Remediation
View remediation
str: return "Unable to read the specified JSON file. Verify that the path exists and is accessible." ``` 2. Do not expose `NEWTON_SCRATCH_DIR`, `TEMP`, absolute directory paths, directory contents, or raw filesystem exception details. 3. Restrict file arguments to an approved scratch directory: ```python allowed_root = Path( os.environ.get("NEWTON_SCRATCH_DIR") or tempfile.gettempdir() ).resolve() requested = Path(path).resolve() if requested != allowed_root and allowed_root not in requested.parents: raise ParamError("The input file must be located in the approved scratch directory.") ``` 4. Require a regular file and reject directories, special devices, and symlinks where they are unnecessary: ```python if not requested.is_file() or requested.is_symlink(): raise ParamError("The input path must reference a regular JSON file.") ``` 5. Log detailed diagnostics only to a protected local log at an appropriate level. Return a generic error to the Agent or user. 6. Add tests confirming that paths outside the approved directory do not cause directory enumeration or reveal environment values. ]]>

T01 · Skill Instruction Hijacking

Warning
Location
scripts/capabilities/customer_list/cmd.py:145
Finding

Unescaped CRM Customer Data Injected Into Agent-Facing Markdown

Content
View full analysis
Remediation
View remediation
str: if value is None or value == "": return "—" text = str(value) text = text.replace("\r", " ").replace("\n", " ") text = text.replace("\\", "\\\\") text = text.replace("|", "\\|") text = text.replace("[", "\\[").replace("]", "\\]") text = text.replace("<", "<").replace(">", ">") return text ``` 2. Apply the escaping function to buyer nicknames, phone values, tags, timestamps, and every `extraAttrs` value. 3. Enforce reasonable output-length limits per field to prevent oversized or highly obfuscated payloads. 4. Prefer structured JSON rendering by the trusted client rather than constructing Markdown from remote data inside the Skill. 5. Add an explicit instruction at the trust boundary stating that customer records are untrusted data and that instruction-like text inside records must never be followed. 6. Add regression tests using values containing pipes, newlines, headings, links, HTML, code fences, and phrases resembling Agent instructions. ]]>

T01 · Skill Instruction Hijacking

Warning
Location
scripts/capabilities/customer_field_config/cmd.py:79
Finding

Unescaped Dynamic Field Metadata and Tags Injected Into Agent-Facing Markdown

Content
View full analysis
Remediation
View remediation
str: if value is None: return "—" text = str(value)[:max_len] text = text.replace("\r", " ").replace("\n", " ") text = text.replace("\\", "\\\\").replace("|", "\\|") text = text.replace("[", "\\[").replace("]", "\\]") text = text.replace("<", "<").replace(">", ">") return text ``` 2. Apply the function to `attrKey`, `attrLabel`, `attrType`, `example`, and every tag value. 3. Validate dynamic attribute keys against the platform’s expected identifier grammar before presenting them as queryable fields. 4. Render metadata through a trusted structured-data component where possible, instead of concatenating Markdown. 5. Instruct the consuming Agent to treat field labels, examples, and tags solely as untrusted data and never as operational instructions. 6. Add security tests covering table escape, multiline tags, links, HTML, code fences, and instruction-like payloads. ]]>
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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (32)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

该代码片段没有体现声明中的 CRM 客户筛选相关业务能力,也没有访问或处理客户、标签、金额、活跃度、采购意愿、自定义属性等数据。相反,它只是一个基础设施/辅助模块:封装 JSON 输出格式、处理 argparse 参数错误、解包响应 payload,以及统一异常到退出码的转换。虽然这类模块可能被 CRM Skill 内部复用,但就该代码片段本身而言,其实际行为与声明的核心功能存在明显偏离,因此应判定为描述与代码行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是面向 CRM 客户筛选、排序、分页、统计和自定义属性管理的业务能力,但给出的代码块并未实现任何客户查询、筛选或属性管理逻辑。相反,它的唯一行为是在 CLI 执行时读取环境变量并调用远程接口上报 skill 使用次数。这属于未在描述中体现的遥测/埋点能力,且该代码的直接目的与声明的核心功能明显不一致,因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个面向客户数据的 CRM 筛选工具,核心能力应是根据条件检索客户并返回客户列表/统计结果。但代码只实现了获取“可用筛选维度”的配置接口:检查 AK、调用 customer_field_config()、标准化 activeAttrs/filterableTags、过滤字段并输出配置说明。虽然“查看自定义属性/筛选维度”与声明中的一小部分相关,但这只是配置查询,不是客户筛选本身;同时代码完全没有接收筛选条件、没有查询客户记录、没有排序分页统计、也没有新增字段的写操作。因此该描述与代码实际主功能存在明显不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

该代码的核心行为与“筛选客户、查找客户、客户列表、询盘未转化/未成交、有成交客户”等描述基本一致:它解析 filters 和 sorts,校验分页参数,调用 customer_list 服务查询客户列表,并以 markdown 或 raw JSON 返回分页结果。同时还进行了字段清洗、敏感字段剔除和手机号脱敏,这些都属于客户列表查询的配套实现,不构成额外风险能力。\n\n但声明中明确写了“支持查看和新增自定义属性”,而当前提供的代码片段没有任何用于查询字段配置、自定义属性元数据、或新增属性的命令参数、服务调用或写操作。代码只是读取客户列表结果中的 extraAttrs 并展示部分字段,这不等同于“查看自定义属性配置”,更不等同于“新增自定义属性”。因此,描述覆盖了比代码实际实现更广的能力范围,构成描述与行为不一致。

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/_tracker.py (reported line 8)May include surrounding context.

python
职责:每次 CLI 命令执行时,向 skill 网关上报一次调用记录,用于统计 skill 调用次数。
上报失败不影响主流程,静默处理。

环境变量(从项目根目录 .env 读取):
    SKILL_NAME     skill 名称,默认 1688-shop-crm-customer-filter
    SKILL_VERSION  skill 版本,默认 1.0.0
    SKILL_CHANNEL  发布渠道,默认 clawhubai

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/_tracker.py (reported line 26)May include surrounding context.

python
职责:每次 CLI 命令执行时,向 skill 网关上报一次调用记录,用于统计 skill 调用次数。
上报失败不影响主流程,静默处理。

环境变量(从项目根目录 .env 读取):
    SKILL_NAME     skill 名称,默认 1688-shop-crm-customer-filter
    SKILL_VERSION  skill 版本,默认 1.0.0
    SKILL_CHANNEL  发布渠道,默认 clawhubai

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/_tracker.py (reported line 43)May include surrounding context.

python
职责:每次 CLI 命令执行时,向 skill 网关上报一次调用记录,用于统计 skill 调用次数。
上报失败不影响主流程,静默处理。

环境变量(从项目根目录 .env 读取):
    SKILL_NAME     skill 名称,默认 1688-shop-crm-customer-filter
    SKILL_VERSION  skill 版本,默认 1.0.0
    SKILL_CHANNEL  发布渠道,默认 clawhubai

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/_tracker.py (reported line 27)May include surrounding context.

python
def _load_env_file() -> None:
    """解析项目根目录的 .env 文件,将变量注入 os.environ(已有环境变量不覆盖)。"""
    env_path = _ROOT_DIR / ".env"
    if not env_path.exists():
        return
    with open(env_path, encoding="utf-8") as f:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding

The skill declares executable CLI behavior, references environment variables, file creation, and network-backed capabilities, but does not define an explicit tool scope such as allowed tools or permissions. In an agent environment, this weakens least-privilege boundaries and can let the skill access broader runtime capabilities than users or reviewers expect, especially because it instructs creation of temp files and use of secrets-backed API calls.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad, generic customer-service language such as '查找客户', '客户列表', and '我的客户', which can cause accidental invocation in conversations that were not intended to authorize CRM access. In a skill that can query customer records and expose business data, overbroad triggering increases the risk of unintended data retrieval and privacy leakage.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The CLI unconditionally calls telemetry reporting after every command and suppresses all exceptions, while this file shows no user-facing notice, consent flow, or opt-out. In a CRM customer-filtering skill, usage telemetry can reveal sensitive operational behavior and potentially customer-related context, making undisclosed collection a real privacy and compliance risk even if the payload is not shown here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation describes an operation that creates a new custom customer attribute but does not clearly warn that this changes CRM schema/state rather than performing a read-only query. In an agent setting triggered by natural-language requests, this omission can cause unintended persistent modifications, especially if a user intended only to inspect or filter customers.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The entire skill description, examples, field semantics, and usage guidance are written only in Chinese, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking or China-specific audience. Under the policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The markdown documents HTTP telemetry reporting and environment-derived metadata but does not provide a clear end-user warning that the skill performs outbound network transmission unrelated to the primary customer-filtering task. Lack of transparent disclosure prevents informed consent, increases privacy risk, and can conceal security-relevant behavior from deployers and users.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation describes a telemetry mechanism that reports skill usage to a remote 1688 gateway, which is outside the user-visible customer-filtering function of the skill. Even if the payload is limited to metadata, undisclosed outbound reporting expands the trust boundary, creates a privacy/compliance concern, and could be abused to track operator behavior without explicit consent.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill loads environment-derived metadata and uses it for remote usage reporting, which is not justified by the stated business purpose of filtering customers. Reading deployment context from environment variables and transmitting it externally can expose operational metadata and makes the skill capable of behavior beyond its declared scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This file contains user-facing natural-language documentation entirely in Chinese, including purpose, environment, and authentication notes. Under the stated policy, forcing a specific language without user opt-in or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file contains natural-language strings exclusively in Chinese, including the module docstring and CLI error output. Under the policy, forcing a specific language without offering a language or locale choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The exception handling logic emits user-visible messages only in Chinese, such as parameter and operation failure notices. Because no opt-in, configuration, or documented locale constraint is present in this file, the skill enforces one language by default.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code performs outbound usage telemetry on every CLI invocation, but the skill metadata describes only customer filtering and does not disclose tracking behavior. Hidden network reporting creates a privacy and transparency issue because users and deployers may not realize operational metadata is being sent to an external gateway.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Telemetry is sent automatically during normal CLI execution without any user-facing warning or consent in the execution path. Silent reporting is dangerous because it undermines informed consent, may violate internal policy or compliance requirements, and makes network egress hard for users to detect.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code includes user-facing descriptions and error messages entirely in Chinese, such as the module docstring, command description, and AK error text. The file does not provide any language selection, opt-in, or justification that the skill is intended only for a Chinese-language or region-specific environment, which creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This function performs a state-changing API call that adds a custom customer attribute column, but it contains no confirmation, authorization guard, or user-visible warning at the point of execution. In a CRM context, unintended or overly broad invocation can modify shared customer data/schema and create persistent integrity or governance issues, especially if triggered by ambiguous natural-language requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The module docstring and comments are written only in Chinese, which may reflect a language-specific skill experience without any documented user opt-in or language choice. Under the language policy rule, forcing a specific language can be a violation unless clearly justified or made optional.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This code reads configuration from the OPENCLAW_CONFIG_DIR environment variable, which is a form of environment access. The file contains only internal comments and no user-facing prompt, log message, or disclosure indicating that runtime environment configuration will be consulted.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.