Back to skill

Security audit

Profile Model Manager

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its Hermes model-management purpose, but it can change live profile settings and includes credential checks that may print API keys into agent or terminal logs.

Review before installing. Use the skill only for intentional Hermes model administration, require confirmation before config changes or gateway restarts, and replace the .env grep examples with quiet presence checks that never print secret values. Do not let an agent echo or collect API keys from profile .env files.

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

Warning
Location
SKILL.md:461
Finding

Plaintext API Credentials May Be Exposed by Diagnostic Commands

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 461-464; repeated variants at lines 635 and 721
Vulnerability Type: Plaintext credential disclosure through overbroad file inspection
Risk Level: Medium

Vulnerable code:

bash
# Step 1: Confirm which profile is missing a key
grep "API_KEY\|_KEY=" ~/.hermes/profiles/<name>/.env

# Step 2: Check whether the target key exists
grep "ZHIPU_API_KEY" ~/.hermes/profiles/<name>/.env

Equivalent unsafe or related examples appear elsewhere:

bash
grep "ZHIPU\|XIAOMI\|DEEPSEEK" ~/.hermes/profiles/<name>/.env

grep "ZHIPU_API_KEY" ~/.hermes/profiles/diary/.env && \
  hermes -p diary config set model.provider zhipu || \
  echo "Add ZHIPU_API_KEY to .env first"

Technical Analysis

The Skill's legitimate diagnostic requirement is only to determine whether a particular environment-variable name is present. Standard grep output includes the entire matching line, however, so these commands reveal both the variable name and its plaintext value.

The broad pattern at line 461 is particularly excessive because it can enumerate all key-like entries in the selected profile's .env file rather than checking only the credential required by the requested provider. The commands therefore exceed the minimum data access necessary for the declared model-management functionality.

No command in the audited file directly transmits the credentials to an external destination. Nevertheless, plaintext output may be incorporated into Agent context, command-execution records, terminal transcripts, screenshots, or other logs. The issue is an insecure credential-handling practice rather than confirmed malicious exfiltration.

Attack Path

  1. A user asks the Agent to diagnose a missing provider credential or a provider-switching failure.
  2. The Agent follows the Skill's troubleshooting instructions and runs one of the documented `gre ...[truncated 1183 chars]
Remediation
View remediation

Remediation Suggestions

Replace value-printing checks with quiet, name-anchored existence tests:

bash
if grep -qE '^ZHIPU_API_KEY=' ~/.hermes/profiles/<name>/.env; then
  echo "ZHIPU_API_KEY is configured"
else
  echo "ZHIPU_API_KEY is missing"
fi

Apply the following hardening measures:

  1. Never print complete credential assignments during diagnostics.
  2. Avoid broad patterns such as API_KEY|_KEY= that enumerate unrelated secrets.
  3. Anchor checks to an exact variable name at the beginning of a line.
  4. Prefer a Hermes-native credential-status command if one is available and guarantees value redaction.
  5. Ensure .env files have restrictive permissions, such as mode 600.
  6. Redact credential values from Agent tool output, application logs, and terminal recordings.
  7. For credential creation, avoid unconditional commands such as:
    bash
    echo "ZHIPU_API_KEY=your_key_here" >> ~/.hermes/profiles/<name>/.env
    
    Instead, securely prompt for the value without echoing it, update the existing assignment atomically, prevent duplicate entries, and preserve restrictive permissions.
  8. Rotate any credentials that may already have appeared in retained Agent or terminal logs.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

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 · SKILL.md (reported line 85)May include surrounding context.

default: mimo-v2.5-pro # 模型名称 provider: xiaomi # provider 名称 base_url: https://... # API 端点(部分 provider 可省略) api_key: xxx # 可选,也可放 .env context_length: 200000 # 上下文窗口大小 api_mode: chat_completions # API 模式

text

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 · SKILL.md (reported line 776)May include surrounding context.

default: mimo-v2.5-pro # 模型名称 provider: xiaomi # provider 名称 base_url: https://... # API 端点(部分 provider 可省略) api_key: xxx # 可选,也可放 .env context_length: 200000 # 上下文窗口大小 api_mode: chat_completions # API 模式

text

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The skill instructs using grep against a profile .env to inspect API key material. Even if intended for troubleshooting, this encourages the agent to access secret-bearing files and may expose credential names or values in logs, terminal output, or chat responses.

Content

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

修复步骤:

bash
# Step 1: 确认哪个 profile 缺 key
grep "API_KEY\|_KEY=" ~/.hermes/profiles/<name>/.env

# Step 2: 检查目标 key 是否存在
grep "ZHIPU_API_KEY" ~/.hermes/profiles/<name>/.env

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

This command checks for a specific API key in .env, which still requires reading a credential file and may reveal secret-bearing lines if executed carelessly. In agent workflows, normalizing secret-file inspection increases the risk of accidental disclosure or overcollection.

Content

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

md
grep "API_KEY\|_KEY=" ~/.hermes/profiles/<name>/.env

# Step 2: 检查目标 key 是否存在
grep "ZHIPU_API_KEY" ~/.hermes/profiles/<name>/.env
# 如果没有输出 → 缺少该 key

# Step 3: 添加缺失的 key(以智谱国内版为例)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

The skill instructs appending an API key directly into a .env file via shell command. This promotes handling raw secrets in command history and agent-visible text, creating a concrete credential exposure path if outputs, prompts, or shell history are retained.

Content

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

md
# 如果没有输出 → 缺少该 key

# Step 3: 添加缺失的 key(以智谱国内版为例)
echo "ZHIPU_API_KEY=your_key_here" >> ~/.hermes/profiles/<name>/.env

# Step 4: 重启 Gateway
hermes -p <profile> gateway restart

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The preventive check again encourages the agent to read from .env and report on credential presence. While less severe than printing values, it still expands the agent's interactions with secret storage and can leak details about configured providers.

Content

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

预防: 切换 provider 前先检查目标 profile 的 .env:

bash
# 快速检查:目标 profile 是否有目标 provider 的 key
grep -l "ZHIPU_API_KEY" ~/.hermes/profiles/<name>/.env && echo "✅ 有智谱 key" || echo "❌ 缺智谱 key"

🔴 错误 2:"context too small"

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The FAQ repeats advice to inspect .env for keys, reinforcing a workflow where the agent accesses secret material. Repetition matters here because it normalizes credential-file reads as standard operation, increasing the chance of accidental exposure.

Content

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

A: 每个 profile 有独立的 .env 文件,需要确保目标 profile 的 .env 中有对应 key:

bash
# 检查 key 是否存在
grep "ZHIPU\|XIAOMI\|DEEPSEEK" ~/.hermes/profiles/<name>/.env

# 如果没有,手动添加
echo "ZHIPU_API_KEY=your_key_here" >> ~/.hermes/profiles/<name>/.env

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

This FAQ example tells the user to append a raw API key to .env, which risks disclosure through shell history, terminal logs, and any agent transcript. For an agent skill, that is especially dangerous because the agent may be tempted to handle or repeat the secret in plaintext.

Content

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

grep "ZHIPU|XIAOMI|DEEPSEEK" ~/.hermes/profiles//.env

如果没有,手动添加

echo "ZHIPU_API_KEY=your_key_here" >> ~/.hermes/profiles//.env

text

### Q3: 辅助模型设为空会怎样?

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

This example promotes conditional logic based on reading a secret file, again extending agent access to credential storage. Even though it checks presence rather than value, it is still unnecessary secret-file interaction for routine model switching.

Content

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

hermes -p diary config set model.provider zhipu

✅ 正确:先检查 key 存在

grep "ZHIPU_API_KEY" ~/.hermes/profiles/diary/.env &&
hermes -p diary config set model.provider zhipu ||
echo "❌ 先添加 ZHIPU_API_KEY 到 .env"

text

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 · SKILL.md (reported line 723)May include surrounding context.

✅ 正确:先检查 key 存在

grep "ZHIPU_API_KEY" ~/.hermes/profiles/diary/.env &&
hermes -p diary config set model.provider zhipu ||
echo "❌ 先添加 ZHIPU_API_KEY 到 .env"

text

### ❌ 反模式 4:default profile 加了 -p 参数

Chaining Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

bash
# ❌ 错误:管道执行时 $0 变成 'bash',dirname "$0" 返回 /usr/bin
sed '14a\echo DEBUG' ~/.hermes/scripts/profile-model-overview.sh | bash

# ✅ 正确:直接执行
bash ~/.hermes/scripts/profile-model-overview.sh

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs the agent to auto-load on very broad phrases like asking what model is in use or diagnosing generic issues. In an agentic environment, overbroad triggers can activate configuration-management behavior during ordinary conversation, increasing the chance of unintended access to profile state or follow-on config changes without clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documented flow tells the agent to execute operations and then restart the gateway, but it does not consistently require warning or confirmation before applying destructive configuration changes. Because these actions alter live model routing and service state, accidental invocation could disrupt service, break profiles, or switch traffic to unintended providers.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
| `xiaomi` | `XIAOMI_API_KEY` | `https://token-plan-cn.xiaomimimo.com/v1` | 小米 MiMo |
| `zhipu` | `ZHIPU_API_KEY` | `https://open.bigmodel.cn/api/coding/paas/v4` | 智谱 Coding Plan(国内,订阅制) |
| `zhipu-direct` | `ZHIPU_API_KEY` | `https://open.bigmodel.cn/api/paas/v4` | 智谱 Direct API(国内,按量计费) |
| `zai` | `ZAI_API_KEY` | `https://api.z.ai/api/coding/paas/v4` | 智谱 Coding Plan(国际版,订阅制) |
| `zai-direct` | `ZAI_API_KEY` | `https://api.z.ai/api/paas/v4` | 智谱 Direct API(国际版,按量计费) |

**智谱四通道说明:**

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
| `xiaomi` | `XIAOMI_API_KEY` | `https://token-plan-cn.xiaomimimo.com/v1` | 小米 MiMo |
| `zhipu` | `ZHIPU_API_KEY` | `https://open.bigmodel.cn/api/coding/paas/v4` | 智谱 Coding Plan(国内,订阅制) |
| `zhipu-direct` | `ZHIPU_API_KEY` | `https://open.bigmodel.cn/api/paas/v4` | 智谱 Direct API(国内,按量计费) |
| `zai` | `ZAI_API_KEY` | `https://api.z.ai/api/coding/paas/v4` | 智谱 Coding Plan(国际版,订阅制) |
| `zai-direct` | `ZAI_API_KEY` | `https://api.z.ai/api/paas/v4` | 智谱 Direct API(国际版,按量计费) |

**智谱四通道说明:**