Back to skill

Security audit

BOM与SOP校对

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its BOM/SOP comparison purpose, but it adds under-scoped file retention, background execution, and Feishu file-sending authority that could expose sensitive workbooks if misused.

Review before installing. Use this only in a tightly controlled workspace, confirm Feishu credentials are least-privileged, restrict sending to generated report files and trusted recipients, and require explicit user approval before upload. Avoid processing untrusted large XLSX/ZIP files until archive-size, path, and cleanup controls are added, and clarify or shorten retention for cached BOM/SOP data.

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

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/feishu_send.py:14
Finding

Over-Privileged Credential Access Enables Arbitrary Local File Transmission

Content
View full analysis
Tuple[str, str]: """Load Feishu configuration.""" try: with open(OPENCLAW_CONFIG, 'r') as f: config = json.load(f) channels = config.get('channels', {}) feishu = channels.get('feishu', {}) app_id = feishu.get('appId', '') app_secret = feishu.get('appSecret', '') return app_id, app_secret except Exception as e: print(f"Failed to load configuration: {e}") return '', '' ``` ```python def get_tenant_token(app_id: str, app_secret: str) -> Optional[str]: """Obtain tenant_access_token.""" url = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" headers = {"Content-Type": "application/json"} data = {"app_id": app_id, "app_secret": app_secret} try: resp = requests.post(url, headers=headers, json=data, timeout=30) result = resp.json() if result.get('code') == 0: return result.get('tenant_access_token') else: print(f"Failed to obtain token: {result}") return None except Exception as e: print(f"Request failed: {e}") return None ``` ```python def upload_file(token: str, file_path: str) -> Optional[str]: """Upload a file to Feishu.""" url = "https://open.feishu.cn/open-apis/im/v1/files" ext = os.path.splitext(file_path)[1].lower() file_type_map = { '.xlsx': 'xlsx', '.xls': 'xls', '.pdf': 'pdf', '.doc': 'doc', '.docx': 'docx', '.png': 'png', '.jpg': 'jpg', '.jpeg': 'jpeg', } fi ...[truncated 4091 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/compare_bom_sop.py:144
Finding

Unbounded XLSX Extraction and Whole-File XML Parsing Permit Resource Exhaustion

Content
View full analysis
Tuple[bool, str]: """Validate a file.""" if not os.path.exists(file_path): return False, f"{file_type} file does not exist" ext = os.path.splitext(file_path)[1].lower() if ext not in ['.xlsx', '.xls']: return False, f"{file_type} file format is unsupported" file_size = os.path.getsize(file_path) if file_size > 100 * 1024 * 1024: # 100 MB return False, f"{file_type} file exceeds 100 MB" return True, "" ``` ```python def parse_bom_file(bom_path: str) -> Dict[str, Dict]: """Parse a BOM file.""" items = {} # Extract XLSX extract_dir = f'/tmp/bom_extract_{os.getpid()}' if os.path.exists(extract_dir): shutil.rmtree(extract_dir) with zipfile.ZipFile(bom_path, 'r') as zf: zf.extractall(extract_dir) # Find a worksheet worksheets_dir = os.path.join(extract_dir, 'xl', 'worksheets') sheet_path = None for sheet_file in sorted(os.listdir(worksheets_dir)): candidate = os.path.join(worksheets_dir, sheet_file) if os.path.exists(candidate): sheet_path = candidate break i ...[truncated 6693 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (54)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill also documents system resource monitoring, queue management, background cleanup, and task state handling beyond simple comparison. Expanding operational control and persistence without clearly declaring these behaviors increases attack surface and may create opportunities for unauthorized processing, retention, or misuse of shared system resources.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill also documents system resource monitoring, queue management, background cleanup, and task state handling beyond simple comparison. Expanding operational control and persistence without clearly declaring these behaviors increases attack surface and may create opportunities for unauthorized processing, retention, or misuse of shared system resources.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill also documents system resource monitoring, queue management, background cleanup, and task state handling beyond simple comparison. Expanding operational control and persistence without clearly declaring these behaviors increases attack surface and may create opportunities for unauthorized processing, retention, or misuse of shared system resources.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill also documents system resource monitoring, queue management, background cleanup, and task state handling beyond simple comparison. Expanding operational control and persistence without clearly declaring these behaviors increases attack surface and may create opportunities for unauthorized processing, retention, or misuse of shared system resources.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill also documents system resource monitoring, queue management, background cleanup, and task state handling beyond simple comparison. Expanding operational control and persistence without clearly declaring these behaviors increases attack surface and may create opportunities for unauthorized processing, retention, or misuse of shared system resources.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill also documents system resource monitoring, queue management, background cleanup, and task state handling beyond simple comparison. Expanding operational control and persistence without clearly declaring these behaviors increases attack surface and may create opportunities for unauthorized processing, retention, or misuse of shared system resources.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented retention of BOM-derived data and comparison history without explicit user warning is a material privacy and confidentiality issue, especially because BOM/SOP files can contain proprietary manufacturing information. Retaining these artifacts increases the blast radius of any compromise and creates risk of unauthorized internal reuse or disclosure.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation introduces direct Feishu API calls using app credentials and outbound file/message delivery, which adds network exfiltration capability beyond local document comparison. If misused or implemented insecurely, processed files or secrets could be transmitted to unintended recipients, and embedded credential-handling patterns broaden the attack surface significantly.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The spawned sub-agent workflow instructs execution of a Python script using file paths derived from task context, introducing command/subprocess behavior beyond the narrow document-comparison purpose. This expands execution capability and can lead to unsafe code execution, path misuse, privilege issues, and reduced oversight of what the background task does with uploaded files.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This script adds a broad outbound messaging and file-upload capability that is not required for BOM/SOP comparison itself. Because it can send arbitrary local files to Feishu using stored credentials, it materially expands the skill's data-exfiltration surface and could leak sensitive documents beyond the user's expected processing flow.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code performs external network calls to Feishu APIs to obtain tokens, upload files, and send messages, none of which are necessary to compare BOM and SOP content. In this skill context, outbound transfer is especially risky because the inputs and generated reports may contain proprietary manufacturing or supplier data.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill documents file read/write, cache persistence, ZIP extraction, and outbound network actions, but declares no explicit tool scope or permission boundaries. This weakens least-privilege controls and makes it easier for a reviewer or runtime to miss that the skill can access local files and transmit data externally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill states that uploaded files are cached locally and tracked in a status file, but it does not clearly warn users about data retention, local storage location, or exposure risks. For BOM/SOP documents, which may contain proprietary manufacturing data, undisclosed persistence increases the chance of unauthorized access, cross-session leakage, or accidental reuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documented cleanup policy explicitly retains BOM data for up to a week and preserves historical compare results without clear user warning or necessity. Persistent storage of manufacturing materials and comparison history can expose sensitive operational data if the workspace is shared, compromised, or insufficiently isolated.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation embeds direct Feishu API authentication, file upload, and message sending steps unrelated to the minimally necessary comparison logic. This creates an unnecessary exfiltration path for user-supplied documents and encourages handling of app secrets/tokens within the skill context, increasing the chance of credential misuse or silent data transfer.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This step retrieves a tenant access token from Feishu using app credentials, enabling subsequent authenticated outbound actions. In the context of a comparison skill, introducing credential-backed external communication expands the blast radius from local document processing to external account actions and possible data exfiltration.

Content

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

bash
# 1. 获取 tenant_access_token
TENANT_TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d '{"app_id":"<APP_ID>","app_secret":"<APP_SECRET>"}' | jq -r '.tenant_access_token')

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This documented API call sends a file message to a specified Feishu recipient, creating a direct external transmission path for local files. Because the skill handles user-uploaded BOM/SOP documents, misuse or misconfiguration could disclose sensitive manufacturing data to unintended recipients without adequate review or consent.

Content

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

md
-F "file=@<本地文件路径>" | jq -r '.data.file_key')

# 3. 发送文件消息
curl -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
  -H "Authorization: Bearer $TENANT_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"receive_id\":\"<用户open_id>\",\"msg_type\":\"file\",\"content\":\"{\\\"file_key\\\":\\\"$FILE_KEY\\\"}\"}"

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill instructs spawning a background sub-agent that runs an external Python command with file paths. This exceeds the justified scope of a file comparison skill and introduces additional execution and isolation risks, especially if task strings or file paths are influenced by user input or shared workspace state.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

技能清单说明该技能会在SOP中标注差异、追加BOM数据并生成包含“SOP独有物料、BOM独有物料、数量差异明细”三个表格的校对报告。但此版本的实现中,generate_marked_file 的文档与实际逻辑都仅进行差异单元格标注并重新打包输出,且主流程只是将差异打印到控制台,没有构造或写入所述的追加BOM数据和三张报告表。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This Python file contains user-facing natural-language strings and documentation entirely in Chinese, including the module docstring and later CLI/help/output messages, but does not offer any language selection or indicate that the tool is intentionally restricted to a Chinese-only environment. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest says the reconciliation report includes three tables: SOP-only materials, BOM-only materials, and quantity-difference details. In create_report_sheet(), the code only writes rows for BOM独有 and SOP独有 items and never emits a dedicated 数量差异明细 section, even though quantity differences are computed earlier.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description discusses caching behavior elsewhere but does not provide an explicit user warning at intake that uploaded BOM/SOP files may be cached or retained. For business documents, lack of transparent disclosure undermines informed consent and can lead users to expose proprietary data under incorrect assumptions about ephemeral processing.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill introduces direct Feishu API usage with app credentials and file transmission logic that is broader than the stated BOM/SOP comparison function. This expands the trust boundary by enabling arbitrary outbound transfer of processed files and credential handling inside the skill, creating unnecessary exfiltration and secret-exposure risk if misused or modified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documented use of shell commands and background script execution exceeds what is needed for document comparison and creates an execution surface for unintended command execution, unsafe argument handling, and uncontrolled subprocess behavior. In a skill that processes user-supplied files and paths, this raises the risk of command injection, abuse of local environment access, and harder-to-audit behavior.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

This section performs outbound network authentication to Feishu using app credentials, introducing secret handling and external transmission capabilities not intrinsic to local BOM/SOP comparison. Such capability can be repurposed to send data off-platform or leak credentials if logs, prompts, or environment handling are weak.

Content

Scanner excerpt · backups/v1.11/SKILL.md (reported line 258)May include surrounding context.

bash
# 1. 获取 tenant_access_token
TENANT_TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d '{"app_id":"<APP_ID>","app_secret":"<APP_SECRET>"}' | jq -r '.tenant_access_token')

Static analysis

No suspicious patterns detected.