T01 · Skill Instruction Hijacking
- Location
run-task.py:513- Finding
Receiving-Agent Instruction Hijacking Through Completion Notifications
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill does what it says, but it gives a background coding agent broad unsupervised authority and exposes messaging credentials and task output in risky ways.
Install only if you are comfortable with a detached Claude Code process reading and modifying the selected project without normal permission prompts and sending prompts/results to Telegram or WhatsApp. Avoid using it on sensitive repositories or secrets-heavy environments unless it is sandboxed, tokens are scoped/rotated, and temporary output handling is fixed.
run-task.py:513Receiving-Agent Instruction Hijacking Through Completion Notifications
run-task.py:1060Claude Code Is Launched With Permission Enforcement Disabled
run-task.py:1024Telegram Bot Token Exposed in a Predictable Temporary Executable
run-task.sh:31Arbitrary Python Code Injection in the Legacy Shell Notification Wrapper
run-task.py:818Sensitive Task Results Persist in Predictable Shared Temporary Files
The documented behavior materially expands beyond the top-level description: direct Telegram messaging, session discovery, local session-file inspection, wake delivery, and iterative orchestration all introduce extra trust and data-flow boundaries. When a skill's declared purpose omits these behaviors, users and supervising agents cannot accurately assess exposure, especially where credentials, local metadata, and external messaging are involved.
The documented behavior materially expands beyond the top-level description: direct Telegram messaging, session discovery, local session-file inspection, wake delivery, and iterative orchestration all introduce extra trust and data-flow boundaries. When a skill's declared purpose omits these behaviors, users and supervising agents cannot accurately assess exposure, especially where credentials, local metadata, and external messaging are involved.
The documented behavior materially expands beyond the top-level description: direct Telegram messaging, session discovery, local session-file inspection, wake delivery, and iterative orchestration all introduce extra trust and data-flow boundaries. When a skill's declared purpose omits these behaviors, users and supervising agents cannot accurately assess exposure, especially where credentials, local metadata, and external messaging are involved.
The skill emphasizes automatic delivery to Telegram/WhatsApp but does not present this as a clear privacy and exfiltration warning. Task prompts, intermediate status, results, and possibly repository-derived content may be transmitted to third-party messaging systems, which is highly sensitive in a coding and analysis context.
Launching Claude with --dangerously-skip-permissions grants the spawned agent broad autonomous authority over the project environment, including tool execution and file modification, based on untrusted task text. In the context of a background automation skill with notification and session-routing features, this creates a powerful execution primitive that can be abused for destructive changes, data theft, or lateral movement.
The script accesses a sensitive auth token and later transmits task metadata and output using that credential, all without any user-facing notice or consent. Because the task output may include proprietary code or secrets, this creates a meaningful risk of unintended data disclosure and abuse of operator credentials.
The skill delegates the supplied task and project context to an external model tool (claude) without clearly constraining provider behavior or disclosing associated data handling. In a coding automation skill, sending repository content and prompts to an external model is expected, but it still raises confidentiality and control risks, especially when combined with disabled permission checks.
GW="http://localhost:18789"
# Run Claude Code
claude -p "$TASK" \
--dangerously-skip-permissions \
--output-format text \
> "$OUTPUT_FILE" 2>&1
Invoking Claude with --dangerously-skip-permissions disables an important safety boundary while running on a user-specified project directory. In this skill context, that materially increases the chance that model-directed actions modify files or execute risky operations without normal safeguards.
The skill exposes capabilities equivalent to shell execution, file read/write, and network messaging, but declares no explicit tool scope or permission boundaries. That makes the skill far more powerful than its metadata suggests and increases the chance of unsafe invocation, overbroad delegation, and unnoticed data exfiltration through external channels.
The skill is framed as appropriate for a very broad class of tasks, effectively acting as a general-purpose delegated agent. Overbroad invocation criteria increase the chance it is selected for sensitive tasks involving code execution, file access, web access, and external messaging, even when a narrower/safer skill should be used.
Telling operators to use the skill for "ANY complex task" invites use far outside a least-privilege model. Because this skill can read files, write files, execute commands, and send results to outside messaging platforms, such ambiguity materially increases misuse risk and accidental disclosure.
The skill advertises coding and automation abilities but does not clearly warn users that it may write files, modify repositories, initialize git state, and run shell commands. Missing this warning undermines informed consent and can lead to unexpected integrity-impacting actions on local projects.
The skill explicitly promotes ongoing context, file access, and multi-step automations, indicating persistent state and long-lived execution. In combination with external notification channels and resumable sessions, this expands the window for sensitive data retention and leakage across runs.
Claude Code is NOT just a coding tool. It's a full-powered AI agent with web search, file access, and deep reasoning. Use it for ANY complex task:
- **Research** — web search, synthesis, competitive analysis, user experience reports
- **Coding** — create tools, scripts, APIs, refactor codebases
- **Analysis** — read and analyze files, data, logs, source code
- **Content** — write docs, presentations, reports, summaries
- **Automations** — complex multi-step workflows with file system access
Using nohup to detach work and save prompts/logs in /tmp creates durable artifacts outside the immediate user interaction. Those files can contain sensitive task text or outputs, and detached background processes reduce user visibility into what continues running after launch.
write /tmp/cc-prompt.txt with your task text
# Step 2: Launch with $(cat ...)
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-prompt.txt)" \
--project ~/projects/my-project \
--session "agent:main:whatsapp:group:<JID>" \
This launch pattern creates an asynchronous detached run tied to a persistent session key, extending execution beyond the initiating turn. That persistence increases the risk of unnoticed continued access to project files and later external delivery of outputs.
# ALWAYS use the current thread session key from context:
# agent:main:main:thread:<THREAD_ID>
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-prompt.txt)" \
--project ~/projects/my-project \
--session "agent:main:main:thread:<THREAD_ID>" \
Waking an exact thread session and continuing across turns is a form of persistent conversational state that can carry sensitive context forward. If session resolution is wrong or compromised, outputs may be delivered to the wrong target or prior context may influence later actions unexpectedly.
Use --notify-session-id to wake the exact thread session:
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-prompt.txt)" \
--project ~/projects/my-project \
--session "agent:main:main:thread:369520" \
The documented use of --dangerously-skip-permissions removes confirmation gates for a general-purpose agent that can access files, run commands, and perform multi-step actions. In this context, bypassing approval increases the risk of unintended destructive actions, secret exposure, or unreviewed outbound operations.
## Claude Code Flags
- `-p "task"` — print mode (non-interactive, outputs result)
- `--dangerously-skip-permissions` — no confirmation prompts
- `--verbose --output-format stream-json` — real-time activity tracking for heartbeats
### Why NOT exec/pty?
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
cat > /tmp/cc-full-test-prompt.txt << 'EOF'
# ~10 lines, but total >4500 chars:
# 1) notify script now
# 2) create test file with repeated text (to exceed 4500 chars)
# 3) sleep 70 + notify script again
# 4) run several shell commands
# 5) return short structured report
The full E2E test flow creates long-running detached tasks, temporary prompt files, logs, and output artifacts in /tmp. Even in test mode, these persistent artifacts can expose sensitive data or normalize unsafe background execution patterns in production contexts.
--session "agent:main:main:thread:<THREAD_ID>" \
--validate-only
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-full-test-prompt.txt)" \
--project /tmp/cc-e2e-project \
--session "agent:main:main:thread:<THREAD_ID>" \
This example explicitly creates a tool and runs it asynchronously in a project context, implying repository modification plus persistent logs and background execution. Without strong consent and cleanup controls, that can leave unexpected code changes and artifacts after the initiating interaction ends.
nohup python3 {baseDir}/run-task.py \
-t "Create a Python CLI tool that converts markdown to HTML with syntax highlighting. Save as convert.py" \
-p ~/projects/md-converter \
-s "agent:main:whatsapp:group:120363425246977860@g.us" \
Detached research runs against a codebase preserve context and may later deliver findings externally, increasing both retention and disclosure risk. Users may not expect repository contents analyzed in the background to be summarized into external chat systems.
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-prompt.txt)" \
--project ~/projects/my-project \
--session "agent:main:main:thread:<THREAD_ID>" \
Threaded-mode research further couples persistent execution with routing metadata and session continuity. This broadens the attack surface from simple persistence to possible misdelivery of persisted context into a wrong thread if routing data is stale or resolved incorrectly.
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-prompt.txt)" \
--project ~/projects/my-project \
--session "agent:main:main:thread:369520" \
The mid-task update example stores task data in temp files and relies on a persistent on-disk helper script during execution. These durable artifacts can expose intermediate work product and increase risk if the temp path is accessible to other local users or processes.
STEP 2: Write summary to /tmp/summary.txt...
EOF
nohup python3 {baseDir}/run-task.py \
--task "$(cat /tmp/cc-prompt.txt)" \
--project ~/projects/my-project \
--session "agent:main:main:thread:<THREAD_ID>" \
The minimal-mode launch guidance normalizes detached execution with persistent session state as the default workflow. That increases the likelihood of background tasks continuing outside user awareness and later posting outputs into external communications channels.
> --validate-only
>
> # 2) Real launch (only 3 required params)
> nohup python3 {baseDir}/run-task.py \
> --task "$(cat /tmp/prompt.txt)" \
> --project ~/projects/x \
> --session "agent:main:main:thread:<THREAD_ID>" \
A long task with extended timeout keeps code-modifying and notification-capable automation running for up to an hour or more, increasing opportunity for unintended actions and prolonged exposure of sensitive context. The risk is operational rather than inherently malicious, but material.
nohup python3 {baseDir}/run-task.py \
-t "Refactor the entire auth module to use JWT tokens" \
-p ~/projects/backend \
-s "agent:main:whatsapp:group:120363425246977860@g.us" \
No suspicious patterns detected.