Back to skill

Security audit

Nvidia Model Config

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed OpenClaw NVIDIA configuration helper, but users should handle the NVIDIA API key carefully.

Install only if you want this skill to modify your OpenClaw NVIDIA provider configuration. Prefer setting NVIDIA_API_KEY in your shell or a protected secret store instead of passing --key on the command line, use --dry-run and --backup before writing, avoid --inline-key except for short-lived local testing, and ensure any gateway.env path is private and user-owned.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:27
Finding

NVIDIA API Key Exposed Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 27-29
Vulnerability Type: Secret exposure through process arguments and shell history
Risk Level: Medium

Vulnerable Code

bash
python skills/nvidia-model-config/scripts/merge_nvidia_config.py \
  --config openclaw.json --key "YOUR_KEY" --setup-env ~/.config/openclaw/gateway.env --setup-systemd --backup

Technical Analysis

The documented quick-start procedure recommends supplying the NVIDIA API key through the --key command-line argument. When a real key replaces YOUR_KEY, it can be retained in shell history. Depending on the operating system configuration and process-inspection permissions, it may also be visible in process listings while the command is running.

Although the script supports reading the key from the NVIDIA_API_KEY environment variable, the primary documented workflow encourages the more exposed command-line mechanism.

Attack Path

  1. An operator follows the documented quick-start procedure and substitutes a valid NVIDIA API key for YOUR_KEY.
  2. The shell records the complete command, including the key, in its history.
  3. Alternatively, a local process or monitoring system captures the command-line arguments while the script is running.
  4. An attacker or unauthorized local user obtains access to the history, process telemetry, or diagnostic records.
  5. The exposed key is used to make unauthorized requests against the NVIDIA API.

Impact Assessment

Exploitation discloses the NVIDIA API credential with the same API permissions and account entitlements assigned to that key. An attacker may consume API quota, access entitled NVIDIA models, incur usage costs, or cause service disruption through quota exhaustion. This issue does not independently grant operating-system privilege escalation.

Remediation
View remediation

Remediation Suggestions

  • Remove --key "YOUR_KEY" from the recommended quick-start command.

  • Recommend providing the key through a protected runtime environment or a secure secret manager.

  • If interactive entry is required, add a --key-stdin or hidden prompt option using Python's getpass module.

  • Warn users not to place credentials directly in shell commands.

  • Provide a safer example, such as:

    bash
    read -rsp "NVIDIA API key: " NVIDIA_API_KEY
    export NVIDIA_API_KEY
    python skills/nvidia-model-config/scripts/merge_nvidia_config.py \
      --config openclaw.json \
      --setup-env ~/.config/openclaw/gateway.env \
      --setup-systemd \
      --backup
    unset NVIDIA_API_KEY
    

T09 · Insecure Skill Coding Practices

Note
Location
scripts/merge_nvidia_config.py:142
Finding

Non-Atomic Secret File Write Applies Restrictive Permissions Too Late

Content
View full analysis

Vulnerability Details

File Location: scripts/merge_nvidia_config.py, lines 142-145
Vulnerability Type: Insecure sensitive-file creation and update
Risk Level: Low

Vulnerable Code

python
with path.open("w", encoding="utf-8") as f:
    f.writelines(new_lines)

os.chmod(path, 0o600)

Technical Analysis

The script writes the API key to the destination before applying mode 0600. For a newly created file, its initial permissions are determined by the process umask. With an insufficiently restrictive umask, other local users may be able to read the file during the interval between creation and chmod.

When updating an existing file, the file retains its previous permissions while it is truncated and rewritten. The direct write is also non-atomic, allowing another process to observe a partially written file or leaving incomplete content if execution is interrupted.

Attack Path

  1. An operator selects a new environment-file path under a directory accessible to another local user, or selects an existing file with permissive permissions.
  2. The script opens the destination for writing and stores the API key while the file still has permissions derived from the umask or its previous mode.
  3. A local attacker monitoring the known path opens the file before os.chmod(path, 0o600) executes.
  4. The attacker reads and retains the NVIDIA API key.
  5. The attacker uses the credential for unauthorized NVIDIA API requests.

Successful exploitation requires local access, knowledge or discovery of the destination path, and sufficient access to read the file during the exposure interval.

Impact Assessment

The primary impact is disclosure of the NVIDIA API key. The attacker receives the API permissions and model entitlements associated with that credential and may consume quota or incur costs. The vulnerable operation runs with the invoking user's privileges and does not itself provide privileges ...[truncated 40 chars]

Remediation
View remediation

Remediation Suggestions

  • Create a temporary file in the destination directory with exclusive creation and mode 0600 from the outset.
  • Write the complete content to the temporary file, flush it, and call os.fsync() before replacement.
  • Atomically replace the destination using os.replace().
  • Validate that the destination is not a symbolic link before replacement.
  • Ensure the parent directory is owned by the expected user and is not writable by untrusted users.
  • Preserve or explicitly validate expected ownership after replacement.
  • Use a pattern such as tempfile.mkstemp(dir=path.parent) followed immediately by os.fchmod(fd, 0o600), then write through the returned descriptor and atomically replace the destination.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

systemctl --user restart openclaw-gateway.service

text

You can also keep a personal `~/.config/openclaw/secrets.env` and `source` it from `~/.bashrc` for CLI-only use; that does **not** replace the gateway env above.

If you want to preview the changes before writing, add `--dry-run` and capture the printed JSON.

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

python
parser.add_argument(
        "--setup-env",
        type=Path,
        help="Write the API key to a .env file for the gateway (e.g., ~/.config/openclaw/gateway.env).",
    )
    parser.add_argument(
        "--setup-systemd",

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

python
parser.add_argument(
        "--setup-env",
        type=Path,
        help="Write the API key to a .env file for the gateway (e.g., ~/.config/openclaw/gateway.env).",
    )
    parser.add_argument(
        "--setup-systemd",

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill clearly instructs users to run a Python script, modify configuration files, write environment files, and create a systemd override, but it declares no tool scope or allowed-tools metadata. That mismatch increases the chance an agent or operator will permit broader file, shell, and environment access than intended, which weakens reviewability and least-privilege controls.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

The '--inline-key' option allows a plaintext NVIDIA API key to be written directly into the JSON config, creating persistent secret storage in a file that may be copied, backed up, committed to version control, or exposed to other local users and tooling. Although labeled legacy and not recommended, the feature still materially increases the risk of credential leakage because it normalizes an insecure storage path for the secret.

Content

Scanner excerpt · scripts/merge_nvidia_config.py (reported line 99)May include surrounding context.

python
"--inline-key",
        action="store_true",
        help=(
            "Legacy mode: write plaintext key into config. "
            "Not recommended for shared or versioned configs."
        ),
    )