token-guard
Warn
Audited by Gen Agent Trust Hub on Mar 1, 2026
Risk Level: MEDIUMCOMMAND_EXECUTIONPROMPT_INJECTION
Full Analysis
- [COMMAND_EXECUTION]: Insecure Python execution bridge in
scripts/token-guard.sh. The script usespython3 -cand interpolates shell variables directly into the Python source string (e.g.,'$model','$daily_usd', and'$entry'). Because these variables are not sanitized or escaped, a crafted string containing a single quote can break the Python string literal and execute arbitrary Python code. This affects functions such ascmd_log,cmd_status, andcmd_monitor. - [COMMAND_EXECUTION]: JSON injection vulnerability in the
_switch_modelfunction. The script interpolates the$new_modelvariable directly into a JSON string payload for acurlPOST request to a local gateway. An attacker could use this to inject additional JSON keys and manipulate other agent configuration settings beyond the intended model switch. - [PROMPT_INJECTION]: Vulnerability to indirect injection through log poisoning. 1. Ingestion points: Data is read from the
$STATE_DIR/usage-log.jsonlfile in thecmd_statusandcmd_monitorfunctions. 2. Boundary markers: None are present to distinguish between trusted and untrusted log entries. 3. Capability inventory: The script has the ability to modify the agent's primary model configuration viacurland execute arbitrary logic viapython3. 4. Sanitization: None. Data from the usage log is interpolated directly into Python execution strings without validation or escaping.
Audit Metadata