T01 · Skill Instruction Hijacking
- Location
agents/observer-loop.sh:114- Finding
Indirect Prompt Injection Against a Write-Capable Background Agent
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a local learning tool, but it broadly records Claude activity and can run a background writer that creates persistent instructions, so it needs Review before installation.
Install only if you are comfortable with local logging of Claude prompts, tool inputs, tool outputs, file paths, command output, project roots, and git remotes under ~/.claude/homunculus. Keep the observer disabled unless you have reviewed the logs and generated instincts, avoid using it in highly sensitive repositories, do not import instincts from untrusted URLs, and periodically delete observations, archives, generated artifacts, and global hooks you no longer want.
agents/observer-loop.sh:114Indirect Prompt Injection Against a Write-Capable Background Agent
scripts/instinct-cli.py:1139Persistent Agent Memory and Generated-Skill Poisoning Through Untrusted Instinct Content
hooks/observe.sh:171Broad Tool Input and Output Logging With Incomplete Secret Redaction
scripts/instinct-cli.py:514Arbitrary URL Import Allows Server-Side Request Forgery and Unbounded Response Reads
The declared description is about a learning/observation system that derives instincts and evolves them into higher-level artifacts, with project scoping as a data-isolation feature. The supplied code does not implement learning, hooks processing, confidence scoring, instinct creation, or evolution into skills/commands/agents. Instead, it is an operational guard script whose purpose is to prevent or delay observer session spawning based on time windows, recent runs for the same project, and user inactivity. While the per-project cooldown loosely relates to project scoping, it is not the declared project-scoped instinct functionality. This is therefore a material description-behavior mismatch.
The skill instructs modification of ~/.claude/settings.json, a sensitive agent configuration file that controls hooks and runtime behavior. Directing users to alter a global config expands the skill's influence beyond a single project and can enable persistent monitoring or future command execution across all sessions if misconfigured or abused.
### 1. Enable Observation Hooks
Add to your `~/.claude/settings.json`.
**If installed as a plugin** (recommended):
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
# Ensure CWD is PROJECT_DIR so the relative analysis_relpath resolves correctly
# on all platforms, not just when the observer happens to be launched from the project root.
cd "$PROJECT_DIR" || { echo "[$(date)] Failed to cd to PROJECT_DIR ($PROJECT_DIR), skipping analysis" >> "$LOG_FILE"; rm -f "$prompt_file" "$analysis_file"; return; }
# Prevent observe.sh from recording this automated Haiku session as observations.
# Pass prompt via -p flag instead of stdin redirect for Windows compatibility (#842).
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
# and writes observations to project-specific directory.
#
# Registered via plugin hooks/hooks.json (auto-loaded when plugin is enabled).
# Can also be registered manually in ~/.claude/settings.json.
set -e
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def test_validate_rejects_etc():
with pytest.raises(ValueError, match="system directory"):
_validate_file_path("/etc/passwd")
def test_validate_rejects_var_log():
The skill describes capabilities that involve shell execution, environment access, file reads/writes, and network-adjacent behavior, but it does not declare an explicit tool scope or permission boundary. In a learning/automation skill that installs hooks and writes persistent data, missing least-privilege constraints increases the chance of overbroad execution and misuse beyond the stated purpose.
The skill instructs users to enable hooks that observe prompts and tool activity, but it does not present a prominent, explicit warning that sensitive prompts, commands, file paths, and workflow metadata may be captured and stored. Silent or underemphasized telemetry in a local automation skill can lead users to expose secrets or confidential project data unintentionally.
The hook configuration is explicitly framed as capturing prompts and tool usage from every session/tool call, which creates comprehensive retention of user interaction data. Even if stored locally, this broad collection can include credentials, proprietary code context, or sensitive operational details that become a privacy and security liability if the local store is accessed or later exported.
The skill derives a portable project identifier from git remote URLs and stores project metadata in a persistent registry, enabling linkage of activity across machines and over time. Even without raw code export, persistent cross-session identifiers can reveal repository relationships, work patterns, and private infrastructure details if the local state is accessed.
The system automatically detects your current project:
1. **`CLAUDE_PROJECT_DIR` env var** (highest priority)
2. **`git remote get-url origin`** -- hashed to create a portable project ID (same repo on different machines gets the same ID)
3. **`git rev-parse --show-toplevel`** -- fallback using repo path (machine-specific)
4. **Global fallback** -- if no project is detected, instincts go to global scope
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
|-------|---------|----------|
| 0.3 | Tentative | Suggested but not enforced |
| 0.5 | Moderate | Applied when relevant |
| 0.7 | Strong | Auto-approved for application |
| 0.9 | Near-certain | Core behavior |
**Confidence increases** when:
The skill emphasizes exhaustive observation and claims hooks fire on every tool call, encouraging persistent accumulation of detailed behavioral data over time. Persistent session-level logging materially increases exposure if the storage directory is compromised, backed up insecurely, or used to derive unintended inferences about the user's work.
The manifest describes an instinct-based learning system that observes sessions, creates instincts, and evolves them into higher-level artifacts. In this file, the skill explicitly instructs the Claude subprocess to use the Write tool to create or update instinct files without confirmation, making it an autonomous file-writing agent rather than merely an observer/analyzer.
The script explicitly instructs the model to write or update files without asking for permission and grants it the Write tool. Because the model’s output is driven by observed session data, prompt injection or malformed observations could cause unintended file creation or modification inside the project, especially if INSTINCTS_DIR is misconfigured or existing files are incorrectly identified as similar.
This agent persistently analyzes and derives instincts from session observations stored on disk, including tool inputs/outputs and project metadata. Even though the file includes some privacy guidance and project scoping, the persistence and mining of cross-session behavioral data creates a real security and privacy risk: sensitive commands, file paths, secrets in tool output, or user habits may be retained and transformed into reusable artifacts that could later influence behavior or leak information across contexts.
---
name: observer
description: Background agent that analyzes session observations to detect patterns and create instincts. Uses Haiku for cost-efficiency. v2.1 adds project-scoped instincts.
model: haiku
---
The example global instinct uses the trigger "when modifying code," which is extremely broad and could match a large fraction of ordinary coding activity. Although the document advises being specific elsewhere, this concrete example demonstrates an ambiguous trigger scope without exclusions or negative examples, increasing the risk of unintended invocation.
The script starts a persistent background observer and creates project-scoped log, PID, observation, and instincts files under the user's home/project directories, but does not present an explicit consent notice at launch about what data will be stored. In a continuous-learning skill that observes sessions, silent persistence increases privacy and transparency risk because potentially sensitive project activity may be captured and retained without the user's informed awareness.
Using nohup launches the observer as a detached background process that persists beyond the initiating session, enabling ongoing collection and analysis without continuous user visibility. In this skill's context, that persistence is more sensitive because the process monitors project activity and writes observation artifacts over time, which can surprise users and expand the window for unintended data collection.
touch "$LOG_FILE"
start_line=$(wc -l < "$LOG_FILE" 2>/dev/null || echo 0)
nohup env \
CONFIG_DIR="$CONFIG_DIR" \
PID_FILE="$PID_FILE" \
LOG_FILE="$LOG_FILE" \
The script persistently stores tool inputs and outputs into project logs, including session metadata and cwd, and only applies pattern-based secret scrubbing. This creates a real risk of retaining sensitive prompts, code, tokens, proprietary data, or personal information that the regex misses, especially because logging occurs automatically on every tool event.
The hook is documented as an observation component, but it also performs side effects by starting and signaling a background observer process. In a hook that runs automatically on tool events, this expands the trust boundary and creates persistence/process-control behavior beyond passive logging, which can surprise users and increase abuse potential if the observer chain is compromised.
This hook has process-control capability: it checks PID files, validates liveness, launches a detached process with nohup, and sends signals. For an auto-executed session hook, that is more authority than needed for mere telemetry and increases the blast radius if configuration, PID files, or the launched script are tampered with.
The use of nohup to launch start-observer.sh in the background establishes persistence beyond the immediate session and is triggered from an automatic hook. Even though it appears intended for convenience, detached background execution from passive hooks can enable stealthy long-lived behavior and makes review, user awareness, and shutdown harder.
_CHECK_OBSERVER_RUNNING "${PROJECT_DIR}/.observer.pid" || true
_CHECK_OBSERVER_RUNNING "${CONFIG_DIR}/.observer.pid" || true
if [ ! -f "${PROJECT_DIR}/.observer.pid" ] && [ ! -f "${CONFIG_DIR}/.observer.pid" ]; then
nohup "${SKILL_ROOT}/agents/start-observer.sh" start >/dev/null 2>&1 &
fi
) 9>"$LAZY_START_LOCK"
else
This is a second code path that also launches the observer with nohup under a different lock fallback. Multiple fallback paths do not reduce the risk; they preserve persistent auto-start behavior across environments, increasing the chance of unintended long-running execution.
_CHECK_OBSERVER_RUNNING "${PROJECT_DIR}/.observer.pid" || true
_CHECK_OBSERVER_RUNNING "${CONFIG_DIR}/.observer.pid" || true
if [ ! -f "${PROJECT_DIR}/.observer.pid" ] && [ ! -f "${CONFIG_DIR}/.observer.pid" ]; then
nohup "${SKILL_ROOT}/agents/start-observer.sh" start >/dev/null 2>&1 &
fi
rm -f "$LAZY_START_LOCK" 2>/dev/null || true
)
This fallback branch likewise spawns a detached observer process, preserving persistence even when flock/lockfile are unavailable. Because the hook is auto-triggered, the persistence behavior is environment-independent and therefore more dangerous than a single optional code path.
_CHECK_OBSERVER_RUNNING "${PROJECT_DIR}/.observer.pid" || true
_CHECK_OBSERVER_RUNNING "${CONFIG_DIR}/.observer.pid" || true
if [ ! -f "${PROJECT_DIR}/.observer.pid" ] && [ ! -f "${CONFIG_DIR}/.observer.pid" ]; then
nohup "${SKILL_ROOT}/agents/start-observer.sh" start >/dev/null 2>&1 &
fi
)
fi
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 2. git repo root
if not project_root:
try:
result = subprocess.run(
["git", "rev-parse", "--show-toplevel"],
capture_output=True, text=True, timeout=5
)
The CLI persists project roots and git remote URLs for all observed projects in a central registry, which can expose sensitive internal repository names, filesystem layouts, and organization metadata. In multi-project or enterprise environments, this broadens data collection beyond what is necessary for local instinct management and creates a privacy and reconnaissance surface.