Severity:

HIGH RISK

(7.3)

Injection (Improper Neutralization of Input) in Hermes-Agent

CVE-2026-9353

Deferred

Vulnerability type

Category:

Injection (Improper Neutralization of Input)

CWE:

CWE-74, CWE-707

Impact:

Guard Bypass and Unauthorized Execution of Guarded Actions

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Hermes-agent's Skills Guard Multi-Word Prompt Handler contains an injection flaw in the handling of the THREAT_PATTERNS argument, allowing untrusted input to be interpreted in a more powerful context than intended.

A remote attacker who can influence or control THREAT_PATTERNS can potentially inject crafted patterns that bypass or subvert the guard's logic, leading to unauthorized actions or unsafe prompt handling.

Affected context

The vulnerability resides in the file agent/skills_guard.py, specifically within the Skills Guard Multi-Word Prompt Handler that uses the THREAT_PATTERNS argument to detect or block unsafe content.

It is relevant wherever:

  • The agent relies on pattern-based filtering or guarding of prompts or skills
  • THREAT_PATTERNS can be influenced by external input (configuration, API parameters, or user-controlled data)
  • The guard logic interprets these patterns in a way that affects downstream behavior, routing, or execution

Exploit preconditions

  • Attack surface: Remote interfaces that accept or indirectly influence THREAT_PATTERNS (e.g., configuration APIs, plugin inputs, or user-supplied prompt metadata).
  • Required access: Ability to supply or modify THREAT_PATTERNS values or any input that the guard uses to build or extend this structure.
  • Trigger point: Invocation of the Skills Guard Multi-Word Prompt Handler in skills_guard.py where THREAT_PATTERNS is parsed, interpolated, or evaluated.
  • Why exploitation is possible: The guard logic does not sufficiently neutralize or constrain THREAT_PATTERNS before using it in pattern matching or other interpretation steps, permitting crafted input to alter control flow or neutralization behavior (CWE-74/CWE-707).

Why this happens

The underlying issue stems from improper neutralization and validation of inputs that are used as patterns or rules inside the Skills Guard.

THREAT_PATTERNS, intended to be a declarative list or structure describing threats, is treated in a way that allows embedded control characters, wildcards, or meta-syntax to influence how the guard processes content.

This maps to CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component) and CWE-707 (Improper Neutralization) where untrusted data is passed into a component (such as a pattern engine, interpreter, or router) without sufficient sanitization, causing the downstream component to execute or interpret the data differently than intended.

Potential impact

  • Attackers may craft THREAT_PATTERNS that disable or bypass the Skills Guard, allowing unsafe prompts or actions to proceed unchecked.
  • The guard may misclassify benign content as malicious or vice versa, leading to denial of service or unpredictable behavior.
  • Malicious patterns can cause the agent to route requests to unintended skills or workflows, potentially triggering unauthorized operations.
  • In broader deployments, compromised guard behavior could lead to data exposure, execution of unintended automation tasks, or integration misuse.

General mitigation guidance

Effective mitigation focuses on constraining how THREAT_PATTERNS are defined, parsed, and used:

  • Treat all pattern definitions as untrusted input and apply strict validation, allowing only a limited, documented subset of characters and structures.
  • Use safe, declarative pattern formats that avoid executable or interpretable sub-syntax, and avoid passing patterns directly into generic interpreters or evaluators.
  • Normalize and canonicalize input before pattern evaluation so that alternative encodings or obfuscations do not escape guard logic.
  • Apply least-privilege design to skills and downstream actions so that a guard failure does not automatically imply high-impact actions.
  • Centralize guard logic and enforce default-deny behavior when pattern definitions are invalid, malformed, or untrusted rather than attempting best-effort parsing.

How teams detect issues like this

Detection typically involves both code-centric and behavior-centric approaches:

  • Perform static analysis to identify use of untrusted data in pattern engines, regular expressions, or other interpretive contexts, especially where THREAT_PATTERNS or similar constructs are used.
  • During code review, look for direct inclusion of user-controlled values in pattern strings, regular expressions, or routing tables without normalization or whitelisting.
  • Add logging and monitoring around guard decisions, flagging unusual THREAT_PATTERNS or sudden shifts in classification rates that may indicate exploitation.
  • Incorporate automated policy checks in CI/CD pipelines to enforce safe pattern APIs, disallow dynamic evaluation, and ensure that pattern sources are appropriately constrained.

Sources

SourceLink
gist.github.comgist.github.com/YLChen-007/82a3539d6358842e69dfaef0a9fcf14a
vuldb.comvuldb.com/submit/812216
vuldb.comvuldb.com/vuln/365316
vuldb.comvuldb.com/vuln/365316/cti

Frequently asked

questions

Yes, if an attacker can remotely influence the THREAT_PATTERNS input through exposed APIs, configuration interfaces, or any mechanism that feeds data into the Skills Guard, they can potentially exploit this vulnerability.

The attacker must be able to control or significantly influence the values used for THREAT_PATTERNS or related guard configuration.

This could be through authenticated configuration endpoints, plugin integrations, or unvalidated user input that is reused as guard patterns.

Introduce strict validation and normalization for any data used as patterns or rules, restrict the allowed syntax to a minimal safe subset, and ensure pattern definitions cannot introduce new control structures or alter interpretation semantics.

Additionally, enforce robust default-deny behavior when pattern data is invalid or untrusted.

Design guard and policy systems to treat all external inputs as data only, never as executable or interpreter-ready syntax.

Use well-defined schemas for pattern configuration, apply rigorous input validation and encoding, and add automated checks in development pipelines to detect untrusted data flow into pattern engines or interpreters.

Find out what's already
exploitable in your codebase.