Back to skill

Security audit

Universal Home Space Parser Engine (智能家居空间场景解析器)

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly disclosed, but it combines physical-action claims, persistent data logging, and an unsafe deployment example in ways users should review carefully before installing.

Install only in an isolated test environment unless you are prepared to review and harden the MCP server. Do not copy the documented Next.js exec route as written. Treat the physical-action tool as simulation unless real actuator authorization, safety checks, and verified device readback are added, and decide explicitly whether persistent training logs are acceptable.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
S2_SPACE_ARCHITECT_MANUAL.md:64
Finding
Shell Command Injection in the Recommended Next.js API Bridge<![CDATA[ ## Vulnerability Details **File Location**: `S2_SPACE_ARCHITECT_MANUAL.md`, lines 64-75 **Vulnerability Type**: OS command injection through shell interpolation **Risk Level**: High ### Vulnerable Code ```typescript import { NextResponse } from 'next/server'; import { exec } from 'child_process'; import util from 'util'; import path from 'path'; const execAsync = util.promisify(exec); export async function POST(request: Request) { try { const { space } = await request.json(); const pythonScriptPath = path.join(process.cwd(), '../s2_space_parser/s2_parser_engine.py'); const { stdout, stderr } = await execAsync(`python3 ${pythonScriptPath} --space "${space}"`); ``` ### Technical Analysis The documented API route extracts `space` from an HTTP request and directly embeds it in a command string passed to `child_process.exec`. The `exec` API invokes a system shell, so shell metacharacters and command substitutions in `space` are interpreted by that shell. Wrapping the input in double quotes is not sufficient. Shell constructs such as command substitution remain active inside double quotes, and an attacker can also terminate the quoted argument before appending another command. The Python parser itself uses `argparse` safely, but the shell processes the command string before Python receives it. Consequently, validation performed by the Python program cannot prevent this vulnerability. ### Attack Path 1. A developer implements the Next.js route exactly as prescribed by the project manual. 2. The route is made reachable through the application, with no input validation shown in the example. 3. An attacker submits a POST request whose JSON `space` property contains shell syntax, such as command substitution or a quote followed by an additional command. 4. The route interpolates that value into the command string. 5. `execAsync` starts a system shell. 6. The shell evaluates the attacker-controlled syntax before launching, or alongside, the ...[truncated 1062 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Replace `exec` with `execFile` or `spawn` and pass arguments as an array without enabling a shell: ```typescript import { execFile } from 'child_process'; import util from 'util'; const execFileAsync = util.promisify(execFile); const { stdout, stderr } = await execFileAsync( 'python3', [pythonScriptPath, '--space', space], { timeout: 10_000, maxBuffer: 1024 * 1024, windowsHide: true } ); ``` - Verify that `space` is a string before using it. - Enforce a conservative maximum length. - Prefer an allowlist of supported room names if arbitrary fallback names are unnecessary. - Resolve the Python script to a trusted absolute path and verify that it is located under the expected application directory. - Run the API service under a dedicated, unprivileged operating-system account. - Add authentication, authorization, request-size limits, rate limiting, and structured security logging to the route. - Return generic client errors rather than exposing raw process error messages. - Add automated tests containing quotes, semicolons, command substitutions, newlines, and platform-specific shell metacharacters. ]]>

T07 · Tool Hijacking and Spoofing

Error
Location
s2_mcp_server.py:42
Finding
Physical-Action MCP Tool Unconditionally Spoofs Successful and Compliant Execution<![CDATA[ ## Vulnerability Details **File Location**: `s2_mcp_server.py`, lines 42-93 **Vulnerability Type**: Tool result spoofing and fail-open physical-action reporting **Risk Level**: High ### Vulnerable Code ```python @mcp.tool() def execute_physical_action_and_log(zone: str, grid: str, s2_element: str, action_intent: str, params: dict) -> str: """ [Physical Actuation & S2-SWM Data Harvester] 在指定空间网格执行物理动作,并强制记录状态跃迁 (St -> At -> St+1) 以供世界模型训练。 参数: zone (str): 区域 (如 "Master_Bedroom") grid (str): 4㎡ 网格 ID (如 "U_Bed_01") s2_element (str): 调用的六要素基元 (LUMINA, CLIMATE, SENTINEL 等) action_intent (str): 动作意图 (如 "Set_Temperature", "Turn_Off_Light") params (dict): 动作参数 (如 {"temperature": 24}) """ logging.info(f"⚡ [MCP Execution] 接收到物理执行请求: {zone}/{grid} -> {action_intent}") # ================================================================= # 🌟 远近结合的核心:收集世界模型 (S2-SWM) 训练数据 # ================================================================= # 1. 抓取动作执行前 (t 时刻) 的空间状态 S_t state_t = { "temp_c": 26.5, "lux": 150, "noise_db": 30, "occupancy": True # (真实情况这里调用感知层探针获取当前读数) } # 2. 模拟调用底层执行器 (Adapter) 进行真实物理执行 # from main_actuator import ... execution_status = "SUCCESS" # 3. 抓取动作执行后 (t+1 时刻) 的空间状态 S_{t+1} # 假设空调调到了 24度,温度开始下降 state_t_plus_1 = { "temp_c": 26.0, "lux": 150, "noise_db": 45, "occupancy": True } # 4. 将这段完整的【因果链】打包写入 Chronos 时空阵列 causal_event = { "timestamp": datetime.now().isoformat(), "S_t": state_t, "A_t": {"element": s2_element, "intent": action_intent, "params": params}, "S_t_plus_1": state_t_plus_1, "world_model_ready": True } # 落盘:这就是未来训练 S2-SWM 世界模型的“真金白银”! chronos_memory.inject_timeline_fragment(causal_event) return json.dumps({ "status": execution_status, "message": f"Action {action_intent} execute ...[truncated 2891 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - If the function is intended only as a demonstration, rename it to make simulation explicit, such as `simulate_physical_action_and_log`. - Return an explicit status such as `SIMULATED_NOT_EXECUTED`; never use `SUCCESS` for an unperformed action. - Include a machine-readable field such as `"simulation": true`. - Remove claims that a security or compliance gate passed unless such a gate is actually implemented and its result is verified. - If real actuation is introduced: - Authenticate and authorize every caller. - Bind callers to permitted zones, devices, and action types. - Use strict schemas and allowlists for actions and parameters. - Require idempotency tokens and replay protection. - Apply safety limits to temperature, power, locks, motors, and other physical controls. - Obtain signed or authenticated device acknowledgement. - Read back actual device state before reporting success. - Distinguish requested, accepted, executing, succeeded, failed, timed out, and indeterminate states. - Fail closed if the policy service, actuator, sensor, or log writer is unavailable. - Propagate persistence failures from `inject_timeline_fragment` instead of always reporting successful logging. - Keep simulated and real datasets in separate stores and mark provenance clearly. - Require independent confirmation or human approval for safety-critical actions. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
s2_chronos_memzero.py:14
Finding
Unbounded Plaintext Persistence of Caller-Controlled MCP Data<![CDATA[ ## Vulnerability Details **File Location**: `s2_mcp_server.py`, lines 78-86; `s2_chronos_memzero.py`, lines 14-27 **Vulnerability Type**: Unvalidated sensitive-data logging, unbounded file growth, and unsafe relative-path persistence **Risk Level**: Medium ### Vulnerable Code From `s2_mcp_server.py`: ```python causal_event = { "timestamp": datetime.now().isoformat(), "S_t": state_t, "A_t": {"element": s2_element, "intent": action_intent, "params": params}, "S_t_plus_1": state_t_plus_1, "world_model_ready": True } chronos_memory.inject_timeline_fragment(causal_event) ``` From `s2_chronos_memzero.py`: ```python class S2ChronosMemzero: def __init__(self): self.logger = logging.getLogger("S2_Chronos") # 专门用来存放世界模型训练数据的本地语料库 self.dataset_file = "s2_swm_training_data.jsonl" def inject_timeline_fragment(self, causal_event: dict): """ 核心功能:记录 [状态 S_t] -> [动作 A_t] -> [状态 S_t+1] 的因果链 """ try: with open(self.dataset_file, "a", encoding="utf-8") as f: f.write(json.dumps(causal_event, ensure_ascii=False) + "\n") self.logger.info(f"💾 [S2-SWM Data Harvested] 一条空间因果数据已写入训练集: {self.dataset_file}") except Exception as e: self.logger.error(f"写入记忆阵列失败: {e}") ``` ### Technical Analysis The MCP tool accepts arbitrary `params`, `action_intent`, and `s2_element` values and inserts them directly into a causal event. The event is serialized in full and appended to a plaintext JSONL file. The implementation has no: - Input schema or nesting-depth validation. - Per-field or total serialized-size limit. - Secret or personal-data redaction. - Log rotation or retention policy. - Storage quota. - Encryption or explicit restrictive file permissions. - Authentication or caller-specific access policy in the shown server code. - Safe, application-owned absolute storage path. - Symlink rejection or atomic secure file creation. Becaus ...[truncated 2612 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Define strict typed schemas for `zone`, `grid`, `s2_element`, `action_intent`, and `params`. - Allowlist supported action names and parameter keys. - Enforce limits on string length, object depth, array length, and total serialized event size. - Reject non-finite numbers and unexpected data types. - Redact or reject fields likely to contain passwords, tokens, keys, personal data, or free-form prompts. - Store data under a configured absolute directory owned by a dedicated service account. - Create the directory with restrictive permissions and create files with mode `0600` where supported. - Reject symbolic links and non-regular files. On compatible systems, use secure open flags such as `O_NOFOLLOW`. - Add file rotation, maximum storage quotas, and an explicit retention/deletion policy. - Encrypt sensitive records at rest when real sensor or health data is collected. - Authenticate MCP clients and authorize access per tool, zone, and action. - Return a structured success or failure value from `inject_timeline_fragment`. - Do not report `s2_swm_causality_logged: true` unless the write has completed successfully. - Consider using a database or managed append-only event store with access control, quotas, integrity checks, and lifecycle management. ]]>

T08 · Insecure Dependencies

Warning
Location
skill.md:8
Finding
Unpinned Third-Party MCP Dependency Creates Supply-Chain Exposure<![CDATA[ ## Vulnerability Details **File Location**: `skill.md`, lines 8-9 and line 29 **Vulnerability Type**: Unbounded dependency resolution without lockfile or integrity verification **Risk Level**: Medium ### Vulnerable Code ```yaml dependencies: - python (>= 3.10) - mcp (>= 1.0.0) ``` ```text * Dependency declaration: Python 3.10+ must be available and `pip install mcp` must be run in advance. ``` The project provides no reviewed lockfile, exact package version, package hash, or reproducible environment configuration. ### Technical Analysis The constraint `mcp (>= 1.0.0)` allows any present or future version accepted by the package resolver. The installation command `pip install mcp` similarly resolves the latest matching release and its transitive dependencies from the configured package index. Python package installation and subsequent imports can execute package-controlled code. Therefore, the effective codebase is not fixed at review time. A compromised future release, compromised transitive dependency, or malicious package supplied through a misconfigured package index could execute locally. The audit found no evidence that the currently referenced package is malicious. The vulnerability is the absence of version and integrity controls, not a confirmed malicious dependency payload. ### Attack Path 1. A user follows the Skill's installation instructions. 2. `pip` queries the configured package index and selects the latest package satisfying the open-ended constraint. 3. The selected release and transitive dependencies may differ from those reviewed or tested by the project author. 4. If a future release, dependency, mirror, or configured index is compromised, malicious package code is installed. 5. Package-controlled code may execute during build or installation, or when `s2_mcp_server.py` imports `mcp.server.fastmcp`. 6. The code runs with the privileges of the user or service performing installation or starting the MCP server. ### Impa ...[truncated 588 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Pin `mcp` to a reviewed exact version rather than using `>=`. - Supply a lockfile covering all transitive dependencies. - Require hashes for downloaded artifacts, for example through a hash-locked requirements file. - Build and test in a clean, isolated virtual environment. - Use an explicitly configured trusted package index instead of relying on ambient pip configuration. - Consider maintaining an internally reviewed package mirror for production deployments. - Disable unnecessary source builds and prefer verified wheels where operationally appropriate. - Run dependency vulnerability and provenance checks in CI. - Regularly update the pinned version through a controlled review and testing process. - Perform installation and runtime under a dedicated, unprivileged account with restricted filesystem and network access. - Document the exact tested Python and MCP package versions. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • 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 (33)

Missing User Warnings

High
Confidence
91% confidence
Finding
The changelog states that cloud or local LLM agents can directly connect to the system and execute physical actions, yet it mentions no authorization boundaries, human approval, sandboxing, rate limits, or emergency-stop constraints. In a skill meant for agent integration, direct physical actuation materially increases danger because misuse, prompt injection, or model error could cause unsafe real-world actions affecting people, property, or connected systems.

Intent-Code Divergence

High
Confidence
98% confidence
Finding
The documented Next.js API route builds a shell command using user-controlled input (`space`) and executes it via `exec`, which invokes a shell. An attacker can supply crafted input containing shell metacharacters to achieve command injection and arbitrary code execution on the server hosting the app.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The changelog explicitly describes automatic interception, recording, and persistence of causal state/action/state streams to .jsonl during AI-triggered physical execution, but provides no indication of notice, consent, minimization, retention controls, or protection of captured data. In an agent skill context, this is dangerous because the recorded state may include sensitive environmental, behavioral, or operational data, creating privacy, surveillance, and secondary-use risks if collected by default.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The deployment instructions encourage subprocess execution of a Python script using request-derived input without any warning or input-safety guidance, and the example itself is unsafe. In practice this normalizes a dangerous integration pattern that can directly expose backend command execution to remote users through the frontend API.

Intent-Code Divergence

Medium
Confidence
88% confidence
Finding
L44 的硬件名称明确写着“【严禁部署任何视觉摄像头】”,表达了强约束性的意图说明;但该条目仍把它作为 hardware_matrix 中的一个“视/感知”设备项,与清单应列出实际配置能力的语义相冲突。虽然这更像数据内容层面的矛盾而非可执行代码行为,但就文档意图与所声明能力而言存在明显背离。

Intent-Code Divergence

Medium
Confidence
89% confidence
Finding
At L06, the entry explicitly states '【严禁使用视觉摄像头】(保护老人生活隐私)', which is an active prohibition against using visual cameras. However, the overall dictionary later includes camera/video-based hardware such as '驻车 360 度环视安防哨兵系统' and '视频车牌反寻导航探头' for other spaces, so the file-level content contradicts the apparent blanket wording of 'strictly prohibited' if read as module guidance rather than only a local preference.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The component simulates activity with random local log entries while the surrounding UI language strongly implies real MCP-driven physical-world monitoring and data harvesting. This is deceptive functionality: users or operators could believe real device telemetry is being collected or verified when it is not, which can lead to unsafe operational decisions, privacy misunderstandings, or false assurances about system capabilities.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The UI states that it is continuously listening to physical actions and harvesting state-transition data for training, but it provides no notice, consent, control, or disclosure to affected users. Even if currently mock-only, this normalizes undisclosed surveillance/data collection behavior and would become a privacy and compliance issue immediately if connected to real sensors or backend services.

Ssd 3

Medium
Confidence
89% confidence
Finding
The comments, naming, and implementation all indicate an intentional design to collect and retain world-model training data from causal events in a local corpus. In this context, the skill is more dangerous because agent event streams frequently include sensitive behavioral traces, prompts, responses, and possibly secrets, so the data-harvesting purpose increases the likelihood of over-collection and unintended retention.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The method appends arbitrary `causal_event` data to a persistent local JSONL dataset explicitly described as training data, but provides no consent, notice, minimization, or access controls. In an agent skill context, causal events can easily contain prompts, outputs, identifiers, or other sensitive interaction data, making silent retention a real privacy and data-governance risk.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
Most user-visible docstrings, comments, and descriptions are written in Chinese, including tool descriptions and parameter documentation, while the file does not indicate that the skill is intentionally region-specific or provide a language choice. This can violate a language/locale policy when users are not given an explicit opt-in or alternative locale.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The tool is named and documented as executing physical actions, but it never invokes a real actuator and always returns SUCCESS while persisting a fabricated causal record. In an agent-control context, this can mislead upstream automation into believing safety- or security-relevant actions were completed, causing dangerous state divergence between the physical environment and the recorded system state.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The physical-action tool persistently records detailed before/after environmental and occupancy data without any user-facing notice, consent flow, or confirmation. In a smart-space setting, this can silently create behavioral and presence logs that expose sensitive information about occupants and space usage.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The code comments and interface imply collection of live sensor readings and real physical execution, but the implementation uses hardcoded mock state and no hardware adapter. This creates deceptive telemetry and false audit/history data, which can corrupt downstream decision-making, analytics, or safety investigations.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest presents the skill primarily as a space parser, but the content also declares a local MCP server and an `execute_physical_action_and_log` capability that can drive real-world actions and persist data. This scope expansion is security-relevant because agents or operators may authorize the skill for passive analysis while unintentionally enabling action execution and behavioral logging.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The skill headline and surrounding operational description are presented as Chinese-only user-facing guidance, and the invocation example uses a Chinese-only space name. This creates a locale constraint without any opt-in or alternative language option, which can violate language-choice policy for broadly scoped skills.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The agent-facing instructions say the skill is for designing, planning, or analyzing spaces, then direct the agent to use `execute_physical_action_and_log`, which crosses from advisory behavior into real-world actuation. In an agent environment with `exec`, `write_file`, and a local server, this mismatch materially increases the chance of unintended physical operations and covert collection of action/state data.

Natural-Language Policy Violations

Medium
Confidence
81% confidence
Finding
The operational instructions are written to handle the task in a specific language context and provide only a Chinese example input, but do not say whether other languages are supported. For a general-purpose smart-space skill, that is an undocumented locale restriction.

Natural-Language Policy Violations

Low
Confidence
71% confidence
Finding
The changelog switches between English and Chinese in headings and feature descriptions without stating that the skill documentation is bilingual or offering a language choice. This can be a natural-language policy issue if organizational policy requires not forcing a language or locale without user opt-in.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
SQP-3 applies to all file types and covers language or locale policy violations. This whitepaper presents all user-facing natural-language content only in Chinese, and nowhere indicates that the skill is region-specific or that users may opt into this language.

Natural-Language Policy Violations

Low
Confidence
0% confidence
Finding
No actionable natural-language policy violation is present. The bilingual text does not force a single language on the user without opt-in.

Missing User Warnings

Low
Confidence
84% confidence
Finding
This Python file declares a perimeter AI camera for the garden, which is a privacy-sensitive monitoring capability. There is no adjacent comment, docstring, or other user-facing disclosure in the file indicating that video surveillance is part of the skill behavior.

Missing User Warnings

Low
Confidence
86% confidence
Finding
The file includes a pet-tracking AI camera with an interactive laser pointer, which introduces monitoring and potentially safety-relevant behavior. No confirmation, explanatory comment, or documented warning is present in this code file.

Missing User Warnings

Low
Confidence
88% confidence
Finding
This entry specifies a video monitoring system for a wine cellar's valuable collection area, which is a surveillance-related capability. The file contains no visible disclosure or warning to users that monitoring is part of the configuration.

Missing User Warnings

Low
Confidence
91% confidence
Finding
A license-plate recognition AI camera processes identifiable vehicle information, making it privacy-sensitive. The code provides no user-facing warning, comment, or explanatory text disclosing this data-processing capability.

Static analysis

No suspicious patterns detected.