Back to skill

Security audit

Hermes Communication Bridge

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent local message bridge, but it uses persistent shared queues and unattended polling without enough safeguards around trust, authorization, or sensitive message contents.

Install only if you understand that messages will be stored locally in shared queue and history files and may be processed automatically. Avoid sending secrets, treat all queue contents as untrusted, do not execute command-type messages without separate confirmation, and use restrictive filesystem permissions or a safer authenticated channel for multi-user or sensitive environments.

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
scripts/communication_queue.py:49
Finding

Unauthenticated Message Impersonation and Unauthorized Status Modification

Content
View full analysis

Vulnerability Details

File Location: scripts/communication_queue.py:49-82, 105-116, 124-143 and duplicated code in temp-repo2/scripts/communication_queue.py
Vulnerability Type: Missing authentication, authorization, and input validation
Risk Level: Medium

Vulnerable Code

python
def send_message(self, 
                sender: str, 
                receiver: str, 
                content: str,
                msg_type: str = "message",
                priority: str = "normal",
                metadata: Optional[Dict] = None) -> str:
    msg_id = f"msg_{int(time.time_ns())}_{sender[:3]}"
    
    message = {
        "id": msg_id,
        "timestamp": datetime.now().isoformat(),
        "sender": sender,
        "receiver": receiver,
        "type": msg_type,
        "content": content,
        "priority": priority,
        "status": "pending",
        "metadata": metadata or {}
    }
    
    queue = self._read_queue()
    queue["messages"].append(message)
    
    queue["stats"]["total_messages"] += 1
    queue["stats"]["pending_messages"] += 1
    key = f"{sender}_to_{receiver}"
    if key in queue["stats"]:
        queue["stats"][key] += 1
    
    self._write_queue(queue)
    self._add_to_history(message)
    
    return msg_id
python
def get_messages(self, 
                receiver: str, 
                status: str = "pending",
                limit: int = 10) -> List[Dict]:
    queue = self._read_queue()
    messages = [
        msg for msg in queue["messages"]
        if msg["receiver"] == receiver and msg["status"] == status
    ]
    return messages[:limit]
python
def mark_as_processed(self, msg_id: str, status: str = "completed"):
    queue = self._read_queue()
    
    for msg in queue["messages"]:
        if msg["id"] == msg_id:
            old_status = msg["status"]
            msg["status"
...[truncated 3026 chars]
Remediation
View remediation

Remediation Suggestions

  1. Define strict allowlists for senders, receivers, message types, priorities, and statuses.
  2. Reject unknown fields, malformed records, oversized content, and invalid value types before storing or processing messages.
  3. Assign each participating agent a separate secret or asymmetric signing key.
  4. Sign canonicalized message records and verify the signature before returning them to consumers.
  5. Bind the authenticated identity to the sender field instead of trusting a caller-supplied sender value.
  6. Require the authenticated intended receiver to perform status transitions.
  7. Implement an explicit state machine, such as pending to processing, followed by completed or failed, and reject all other transitions.
  8. Use separate operating-system identities and restrictive filesystem permissions for the two agents where practical.
  9. Treat command, file, and task records as untrusted data. Never execute their contents without separate authorization and validation.
  10. Apply the same changes to the duplicated implementation under temp-repo2/scripts/communication_queue.py.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/communication_queue.py:173
Finding

Plaintext Queue Storage with Non-Atomic and Unlocked File Updates

Content
View full analysis

Vulnerability Details

File Location: scripts/communication_queue.py:17-28, 85-97, 173-200 and duplicated code in temp-repo2/scripts/communication_queue.py
Vulnerability Type: Insecure file permissions, race conditions, and unsafe file replacement
Risk Level: Medium

Vulnerable Code

python
def __init__(self, queue_dir: Optional[str] = None):
    self.queue_dir = Path(queue_dir or os.environ.get(
        "HERMES_COMM_QUEUE_DIR", 
        Path.home() / ".hermes" / "shared" / "communication"
    ))
    self.queue_file = self.queue_dir / "queue.json"
    self.history_file = self.queue_dir / "history.json"
    
    self.queue_dir.mkdir(parents=True, exist_ok=True)
    self._init_queue_file()
python
queue = self._read_queue()
queue["messages"].append(message)

queue["stats"]["total_messages"] += 1
queue["stats"]["pending_messages"] += 1
key = f"{sender}_to_{receiver}"
if key in queue["stats"]:
    queue["stats"][key] += 1

self._write_queue(queue)
python
def _add_to_history(self, message: Dict):
    history = self._read_json(self.history_file, default={"messages": []})
    history["messages"].append(message)
    if len(history["messages"]) > 1000:
        history["messages"] = history["messages"][-1000:]
    self._write_json(self.history_file, history)

@staticmethod
def _read_json(filepath: Path, default=None):
    if not filepath.exists():
        return default if default is not None else {}
    try:
        with open(filepath, 'r', encoding='utf-8') as f:
            return json.load(f)
    except (json.JSONDecodeError, IOError):
        return default if default is not None else {}

@staticmethod
def _write_json(filepath: Path, data: Dict):
    try:
        with open(filepath, 'w', encoding='utf-8') as f:
            json.dump(data, f, ensure_ascii=False, indent=2)
    except IOError as e:
        print(f"写入文件失败: {e}")

...[truncated 3270 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create the queue directory with mode 0700 and queue/history files with mode 0600, verifying permissions after creation.
  2. Validate that the queue directory and destination files are owned by the expected account.
  3. Reject symbolic links and unexpected non-regular files before reading or writing.
  4. Protect every read-modify-write transaction with an inter-process file lock held across the complete transaction.
  5. Serialize updates to a temporary file in the same directory, flush the contents, call fsync, and atomically replace the destination with os.replace.
  6. Synchronize the containing directory after replacement where durability is required.
  7. Do not silently substitute an empty dictionary for malformed queue data. Preserve the corrupt file, report a clear error, and recover from a validated backup.
  8. Validate the complete queue schema after every read before using it.
  9. Consider SQLite with transactions and restrictive file permissions instead of a shared JSON file if multiple processes must update the queue.
  10. Encrypt sensitive message content at rest when local disclosure is within the threat model.
  11. Apply equivalent hardening to history.json and the duplicated code in temp-repo2/scripts/communication_queue.py.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (21)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill documents and depends on reading and writing shared queue files and invoking a Python script, but it does not declare any explicit tool scope or permissions. That gap makes the skill's effective capabilities opaque to users and policy enforcement, increasing the risk of unintended file access or message injection through the shared communication channel.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger phrases are broad and conversational, covering generic actions like sending messages, receiving messages, and viewing queues. Ambiguous activation can cause the skill to run in unintended contexts, which is especially risky here because the skill enables cross-agent communication and writes to a shared file-based queue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly supports shared-file messaging and includes sensitive message types such as command and file, yet provides no warning about data exposure, trust boundaries, or the operational impact of consuming queue contents. In this context, another agent or local process could place untrusted instructions or file references into the queue, creating a path to indirect command execution, data leakage, or unsafe automation if downstream consumers trust the messages.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code file contains natural-language strings exclusively in Chinese, including the module docstring and user-visible log output. The file does not indicate that the skill is region-specific or that users can choose the language, which can violate language/locale policy requirements for user-facing behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings that present the skill description and interface only in Chinese. Under the stated policy, forcing a specific language without offering a language/locale choice is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script logs message content to stdout and also includes user-supplied content in an automatic reply. In a shared-file messaging skill, queue contents may contain sensitive or untrusted data; printing them can leak secrets to logs, and echoing them back propagates potentially sensitive content or abusive payloads across the communication channel.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
76% confidence
Finding

This duplicate finding points to the same cron-based persistence behavior: a scheduled task runs every hour to process a shared queue automatically. Because the bridge is designed for bidirectional communication between agents, persistent unattended execution makes any weakness in queue integrity or access controls more consequential, especially on multi-user systems or where local compromise already exists.

Content

Scanner excerpt · temp-repo2/README.md (reported line 40)May include surrounding context.

Hermes 侧配置 Cron(每小时自动处理)

bash
hermes cron create --script ~/.workbuddy/skills/hermes-communication-bridge/scripts/process_queue.py "every 1h"

队列存储

Session Persistence

Medium
Category
Rogue Agent
Confidence
76% confidence
Finding

This duplicate finding points to the same cron-based persistence behavior: a scheduled task runs every hour to process a shared queue automatically. Because the bridge is designed for bidirectional communication between agents, persistent unattended execution makes any weakness in queue integrity or access controls more consequential, especially on multi-user systems or where local compromise already exists.

Content

Scanner excerpt · temp-repo2/README.md (reported line 40)May include surrounding context.

Hermes 侧配置 Cron(每小时自动处理)

bash
hermes cron create --script ~/.workbuddy/skills/hermes-communication-bridge/scripts/process_queue.py "every 1h"

队列存储

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly documents that messages and history are stored in predictable files on disk, but provides no warning about persistence, access control, or the sensitivity of message contents. In a cross-agent communication bridge, this can expose prompts, replies, tokens, or user data to other local users, backups, or unrelated processes if filesystem permissions are weak or users assume the channel is ephemeral.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrases are broad and overlap with ordinary communication tasks, which can cause the skill to activate in unintended contexts. Because this skill enables cross-agent message exchange through a shared queue, accidental activation could send or retrieve sensitive data or initiate downstream actions without clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill describes direct use of shared queue and history files but does not warn users that messages will be written to persistent inter-agent storage. This can expose sensitive prompts, data, or operational context to another agent or to anyone with access to those files, increasing the risk of unintended disclosure and cross-agent prompt injection.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented message schema explicitly allows a 'command' type but provides no safety warning or restriction around system-command communication. In an inter-agent bridge, command-style messages materially increase the chance that one agent can induce unsafe execution or that users will treat queued commands as trusted, enabling command injection or unauthorized actions downstream.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This JSON defines user-facing natural-language descriptions exclusively in Chinese across all message types. Because the file does not indicate that the skill is region-specific or that users can opt into this locale, it appears to enforce a specific language, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file contains user-facing natural-language text exclusively in Chinese, including the module docstring and runtime log message. Under the stated policy, forcing a specific language without user opt-in or a documented regional justification is a language/locale policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Natural-language strings such as the module description, CLI descriptions, and status messages are presented exclusively in Chinese. This effectively forces a specific language for users without offering a language choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code appends arbitrary message content to the queue and then records the full message again in history, creating persistent local copies of user-supplied data. While the file contains success prints for CLI actions, there is no explicit disclosure in comments, docstrings, or prompts that message contents will be stored on disk under the user's home directory.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script logs and reuses queue message content directly, including printing message excerpts and embedding untrusted content into automated replies. In a shared file-queue communication channel, messages may contain sensitive data, secrets, or terminal-control/log-forging payloads, so echoing them increases exposure and can leak data to logs or downstream consumers.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The JSON config uses Chinese-only natural-language descriptions for all message types. Per the policy, forcing a specific language without user opt-in or documented justification is a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring, CLI description, help text, and user-facing output are all hard-coded in Chinese, which effectively forces a specific language for interaction. The file does not offer any user opt-in, alternate locale, or justification for a Chinese-only constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The user-facing docstring, status messages, and reply content are all hard-coded in Chinese, which imposes a specific language choice. The policy requires either user opt-in or a clearly documented justification for a locale restriction, neither of which appears in this file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring is written as a fixed Chinese-language operational description, and all user-facing output strings in the script are also in Chinese. This indicates a locale/language constraint without any visible opt-in, alternative language support, or documented justification for being Chinese-only.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.