Back to skill

Security audit

XRRobot ROS2

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed robot-control skill, but it needs review because some paths could move or disrupt a real robot without enough local safety checks.

Install only on a supervised XRRobot host where operators can see the robot, clear the area, and stop it manually. Review the movement wrapper and ros2kill guidance before allowing autonomous or scripted motion, and prefer explicit speed/duration limits plus a guaranteed stop command on every failure path.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/xr-call:37
Finding
Insufficient Validation and Failure-Stop Enforcement for Physical Movement Commands<![CDATA[ ## Vulnerability Details **File Location**: `scripts/xr-call:37-61`, `scripts/xr-call:128-164` **Vulnerability Type**: Missing input validation and incomplete fail-safe handling for actuator commands **Risk Level**: High ### Vulnerable Code Argument parsing at `scripts/xr-call:37-61`: ```python def _parse_args() -> dict[str, Any]: """解析 argv[2:] 中的 --key value 参数。""" kwargs: dict[str, Any] = {} i = 2 while i < len(sys.argv): arg = sys.argv[i] if not arg.startswith("--"): print(json.dumps({"ok": False, "message": f"参数必须以 -- 开头: {arg}"}), file=sys.stderr) sys.exit(1) key = arg[2:].replace("-", "_") if i + 1 < len(sys.argv) and not sys.argv[i + 1].startswith("--"): raw = sys.argv[i + 1] i += 2 # 尝试转数值 try: raw = int(raw) except ValueError: try: raw = float(raw) except ValueError: pass kwargs[key] = raw else: kwargs[key] = True i += 1 return kwargs ``` Movement and turning dispatch at `scripts/xr-call:128-164`: ```python elif cmd == "move": import rclpy from xrrobot_offline_voice.mcp_handlers import move as _move ctx = _init_ros_and_context("xrrobot_offline_voice") kwargs = _parse_args() direction = kwargs.pop("direction", "") if direction not in ("forward", "backward"): print(json.dumps({"ok": False, "message": "direction 必须是 forward 或 backward"})) _shutdown(ctx.ros_node, rclpy) sys.exit(1) try: result = _move(direction=direction, context=ctx, **kwargs) print(json.dumps(result, ensure_ascii=False, default=str)) except Exception as e: print(json.dumps({"ok": False, "message": str(e)})) _shutdown(ctx.ros_node, rclpy) eli ...[truncated 3811 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Define an explicit argument schema for every subcommand. Reject unknown keys rather than forwarding arbitrary `**kwargs`. 2. Require movement parameters to be real, finite numbers: ```python import math def require_finite_number(value, name): if isinstance(value, bool) or not isinstance(value, (int, float)): raise ValueError(f"{name} must be numeric") value = float(value) if not math.isfinite(value): raise ValueError(f"{name} must be finite") return value ``` 3. Enforce conservative ranges appropriate for the hardware, such as administrator-defined maximum duration, linear speed, and angular speed. Reject zero or negative durations. 4. Do not rely exclusively on the imported handler for safety validation. Validate parameters again at the local actuator boundary. 5. Guarantee stop-on-failure and stop-on-interruption. For `move` and `turn`, invoke the stop handler in exception recovery and handle `KeyboardInterrupt`, termination signals, and shutdown failures. If the normal movement handler already stops on success, preserve that behavior while ensuring that exceptional paths also stop. 6. Use a motor-controller or ROS watchdog that automatically commands zero velocity when fresh bounded commands stop arriving. Application-level exception handling should not be the only safety mechanism. 7. Return a nonzero exit status when handler execution fails so orchestration layers cannot mistake a JSON error printed with exit status zero for successful execution. 8. Add tests covering excessive values, negative values, `nan`, positive and negative infinity, valueless flags, unknown arguments, handler exceptions after movement starts, process interruption, and verification that every failure path sends a stop command. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (16)

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The manifest description and the entire skill instructions are written in Chinese, which effectively constrains interaction to a specific language. The file does not state that users may choose another language or that the locale restriction is intentional and justified for a region-specific tool.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The file provides concrete motion commands that can immediately move a physical robot chassis, including forward, reverse, turning, and lateral movement, but it does not include an explicit human-safety warning such as ensuring the area is clear, maintaining an emergency stop, or verifying no person is nearby before actuation. Although it does mention time-bounded motion and command-source conflicts, those are operational safeguards rather than motion-safety controls, so misuse could cause collisions or injury in the real world.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill explicitly captures and returns camera images for agent analysis, but the documentation provides no warning that images may contain sensitive personal, environmental, or proprietary visual data. In a robotics context, this can lead to unintentional collection or transmission of private information from homes, workplaces, screens, documents, or bystanders, especially because the output is packaged for further automated analysis.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The file’s user-facing instructions and descriptions are entirely in Chinese, including the title, capability, invocation, and compatibility sections. This can violate a language/locale policy when the skill forces a single language without giving users an explicit choice or documenting a justified region-specific constraint.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This markdown file uses Chinese throughout for headings, instructions, and warnings, but does not indicate that the skill is region-specific or provide any user opt-in for language preference. Under the policy, forcing a specific language without user choice is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
This markdown file is written as an operational skill and its instructions are presented entirely in Chinese, effectively imposing a specific language on users. Under the policy rule, forcing a language without opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not stated here.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill explicitly instructs running `ros2kill` before launching workflows, which is a broad process-kill action that can terminate unrelated or safety-critical ROS processes without confirmation or scope limits. In a robotics orchestration context, this can disrupt active navigation, control, sensing, or monitoring nodes and create denial-of-service or unsafe state transitions on a live robot.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The document explicitly supports testing and running workflows on a real robot, including navigation, perception, grasping, and placement, but provides no safety warning, operator supervision guidance, or mention of physical hazards. In a robotics context, this omission can lead users to execute workflows that cause collisions, unintended motion, or damage to nearby people, property, or the robot itself.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
This markdown file uses Chinese throughout for the skill name, capabilities, safety guidance, and invocation instructions. Under the policy rule, forcing a specific language without user opt-in or justification is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The entire skill documentation and invocation guidance are presented only in Chinese, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This code file contains natural-language documentation and CLI output entirely in Chinese, including usage instructions and error/help text. Under the policy, forcing a specific language without offering a user choice or documenting a justified locale constraint is a language/locale policy violation.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
A language-only presentation can violate locale or language-choice policy when it implicitly forces one language without offering alternatives or documenting a justified regional constraint. This file contains all operational instructions in Chinese and does not indicate that the language is optional, selectable, or region-specific.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The file’s title and all operational instructions are written only in Chinese, which imposes a language constraint on users. The policy allows locale constraints only when there is explicit opt-in or a documented, justified regional limitation, neither of which appears here.

Natural-Language Policy Violations

Low
Confidence
90% confidence
Finding
The entire skill description and user-facing guidance are written in Chinese, including the exact text to tell the user at L32-L49, with no indication that another language may be used or that the skill is intentionally restricted to Chinese-speaking operators. This is a natural-language locale policy concern because it imposes a language choice without user opt-in.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
SQP-3 applies to all file types and covers language or locale policy violations. This file presents all user-facing instructions in Chinese only, with no indication that the skill is region-specific or that users can choose another language, which may conflict with organizational language-choice requirements.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
The script emits all human-readable status messages in Chinese string literals, with no option for the user to choose another language and no indication that the skill is intentionally region-specific. This is a natural-language locale policy concern because the file hard-codes a single language for user-facing output.

Static analysis

No suspicious patterns detected.