Back to skill

Security audit

ROS2 Execution

Security checks for vulnerabilities and agentic risk

Overview

This ROS 2 execution skill is purpose-related but its claimed safety wrapper has real validation and command-execution weaknesses that should be reviewed before use.

Treat this as a Review item rather than a clearly malicious package. It does not show exfiltration, destructive behavior, remote payload loading, or hidden background persistence, but do not rely on it as a strong sandbox until the setup-path quoting, JSON generation, workspace containment checks, service/action disclosure, and unrestricted argument passthrough are fixed. Use only in an isolated ROS environment with explicitly reviewed package allowlists and non-secret parameter profiles.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/safe_ros2_execution.py:57
Finding

Shell Command Injection Through an Unquoted ROS Setup Path

Content
View full analysis
&& env`. 4. A user invokes `scripts/safe_ros2_execution.py`. 5. The wrapper runs `bash -c` with the attacker-controlled command text. 6. The injected command executes with the operating-system privileges of the user running the wrappe ...[truncated 535 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/safe_ros2_execution.py:71
Finding

Approved Workspace Boundary Bypass Through String Prefix Matching

Content
View full analysis
` returns the attacker-controlled or unintended package prefix. 5. The `startswith()` check incorrectly accepts that prefix. 6. The wrapper invokes the selected ROS target from a packa ...[truncated 697 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/setup.sh:17
Finding

Unsafe JSON Generation From Unescaped Environment Values

Content
View full analysis
"$(dirname "$0")/../config/config.json" { "ros_setup_path": "$ROS_SETUP_PATH", "workspace_roots": [$JSON_ARRAY] } EOF ``` ### Technical Analysis The script constructs JSON by surrounding environment-derived strings with quotation marks. It does not apply JSON escaping to quotation marks, backslashes, or control characters in either `AMENT_PREFIX_PATH` entries or `ROS_SETUP_PATH`. A crafted value can therefore produce invalid JSON or alter the generated JSON structure. Because Python JSON parsers commonly retain the final occurrence of a duplicate object key, sufficiently controlled injected JSON could potentially overwrite configuration fields such as `ros_setup_path`. The colon-to-newline conversion also preserves empty path components as empty strings. Such an empty workspace root interacts with the wrapper's prefix validation because every path starts with an empty string. ### Attack Path 1. The attacker influences the environment from which the user runs `scripts/setup.sh`, including `AMENT_PREFIX_PATH` or the location returned for `ros2`. 2. The attacker inserts JSON-significant characters into an environment-derived path or supplies an empty path component. 3. The setup script writes the value directly into `config/config.json` without JSON encoding. 4. The resulting file is malformed or contains attacker-influenced configuration structure. 5. The wrapper either becomes unavailable due to a parse failure or consumes altered security configuration. 6. If an empty workspace root is introduced, package workspace validation ...[truncated 687 chars]
Remediation
View remediation
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • 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 (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description says the skill executes ROS 2 commands in a sandboxed allowlisted environment, but the documented setup also performs environment discovery, workspace validation, and configuration changes. That mismatch hides materially broader behavior, which can mislead users and automated governance into approving a skill with more access to the host environment than advertised.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill clearly requires shell execution and file access but does not declare any explicit tool scope or permission boundary. This makes the effective authority of the skill ambiguous and can lead an agent runtime to invoke broader capabilities than reviewers or operators expect.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The skill instructs users to store parameter profiles in a persistent directory under ~/.openclaw/workspace/ros_profiles/. Persistent agent-managed files can retain sensitive operational parameters, endpoints, or credentials across sessions and may be reused unintentionally in later executions.

Content

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

./scripts/setup.sh

text
3. **Whitelist Packages:** Edit `config/packages.json` to explicitly allow the packages you want the agent to execute.
4. **Parameter Profiles (Optional):** Create YAML parameter files in `~/.openclaw/workspace/ros_profiles/` for quick execution using the `--profile` flag.

## Overview

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The security constraint claims only run/launch/call are permitted, but the interface additionally exposes service_call and action_send_goal. Inconsistent security documentation weakens trust in the wrapper's policy and may enable higher-risk ROS interactions than reviewers believe are allowed, including sending commands to live systems via services or actions.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The guidance explicitly recommends writing parameters to files and saving recurring configurations persistently under ~/.openclaw/workspace/ros_profiles/. In the ROS context, parameter files may include network settings, topic/service names, calibration values, or credentials, so persistence increases the chance of data leakage, stale unsafe configs, or unauthorized reuse.

Content

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

md
## Handling Parameters (--ros-args)
Avoid passing complex strings (like nested arrays or JSON dictionaries) directly in the command arguments. Instead:
1. Write the parameters to a temporary YAML file.
2. Use the `--params-file /path/to/file.yaml` flag to safely load them.
3. For recurring setups, save the YAML file to `~/.openclaw/workspace/ros_profiles/<name>.yaml` and use `--profile <name>`.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
93% confidence
Finding

This uses bash -c with a command string that interpolates ros_setup_path without shell escaping. If config/config.json is modified or attacker-controlled, a crafted path containing shell metacharacters or command substitution can execute arbitrary commands before the wrapper even applies its ROS package restrictions. In this skill context, the wrapper is specifically intended to be a security boundary, so compromising its config turns this into code execution inside the sandboxed execution environment.

Content

Scanner excerpt · scripts/safe_ros2_execution.py (reported line 63)May include surrounding context.

python
# Build the environment by sourcing the bash file
    env_command = f"source {ros_setup_path} && env"
    try:
        env_proc = subprocess.run(['bash', '-c', env_command], stdout=subprocess.PIPE, text=True, check=True)
        ros_env = {}
        for line in env_proc.stdout.splitlines():
            if '=' in line:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/safe_ros2_execution.py (reported line 75)May include surrounding context.

python
# Check package path
    try:
        pkg_proc = subprocess.run(['ros2', 'pkg', 'prefix', args.package], env=ros_env, stdout=subprocess.PIPE, text=True, check=True)
        pkg_path = pkg_proc.stdout.strip()
    except subprocess.CalledProcessError:
        print(f"SECURITY BLOCK: Package '{args.package}' not found.", file=sys.stderr)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
84% confidence
Finding

The final ros2 execution uses a safe argv list, but it appends unrestricted extra arguments from parse_known_args() directly to the command. This allows callers to pass arbitrary ROS flags, remappings, node names, parameter overrides, and potentially file-based options, undermining the wrapper's claim of a strict allowlisted execution surface. In a skill meant to safely constrain ROS 2 actions, unrestricted passthrough materially weakens the security boundary.

Content

Scanner excerpt · scripts/safe_ros2_execution.py (reported line 117)May include surrounding context.

python
cmd_array.extend(extra)

    # Execute safely without shell=True
    sys.exit(subprocess.call(cmd_array, env=ros_env))

if __name__ == "__main__":
    main()

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description limits the skill to executing ROS 2 commands "(run, launch, call)" in an allowlisted environment. However, the file later documents an additional capability, action_send_goal, meaning the described behavior is narrower than the advertised usage in the same skill documentation.

Content

No source excerpt is available for this finding.