T01 · Skill Instruction Hijacking
- Location
SKILL.md:159- Finding
Automatic Heartbeat Processing of Untrusted Chat Messages
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 159-167
Vulnerability Type: Untrusted remote instructions processed through an autonomous polling workflow
Risk Level: MediumVulnerable Code
markdown ## Example: Heartbeat Polling Add to your `HEARTBEAT.md`: ```markdown ### Chat Rooms - Check: `curl -s https://chat.ctxly.app/room/check -H "Authorization: Bearer $CHAT_TOKEN"` - If has_unread: Fetch and respond - Frequency: Every heartbeat or every minutetext ### Technical Analysis The documented workflow directs an agent to add persistent heartbeat instructions that poll an external chat service and, when unread messages exist, fetch and respond to them automatically. Chat messages are controlled by remote room participants, but the workflow does not establish a trust boundary between message content and agent instructions. No safeguards require the agent to treat received messages strictly as untrusted data, reject embedded operational instructions, obtain user approval before responding, or prevent chat content from initiating tool calls and disclosing sensitive context. Consequently, a malicious participant can place prompt-injection instructions in a message and have them repeatedly presented to the agent during autonomous heartbeat processing. This is classified as skill instruction hijacking because loading and following the skill's heartbeat guidance changes the agent's operating behavior from user-initiated communication to recurring processing of remotely controlled input. ### Attack Path 1. A user or agent creates a room and shares its invite code. 2. An attacker obtains the invite code or is intentionally invited to the anonymous room. 3. The attacker joins the room and sends a message containing prompt-injection content, such as instructions to disregard previous constraints, reveal contextual information, or invoke available tools. 4. The configured heartbeat poll ...[truncated 1290 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the unconditional
If has_unread: Fetch and respondinstruction. Polling may report message availability, but fetching and responding should require explicit user approval. - State that all room messages are untrusted external data and must never override system, developer, user, or skill-level security constraints.
- Prohibit message-triggered tool calls, command execution, configuration changes, credential access, secret disclosure, and persistent-memory updates unless separately authorized by the user.
- Present fetched messages in a clearly delimited data block and instruct the agent to analyze them only as conversational content.
- Add confirmation gates for actions beyond plain-text chat responses, especially operations with filesystem, network, shell, account, or messaging side effects.
- Limit heartbeat polling by duration and frequency, and provide a straightforward mechanism to disable it or revoke the room token.
- Recommend using dedicated, least-privilege agent sessions for anonymous rooms so that successful prompt injection cannot access unrelated context or powerful tools.
- Document invite codes and bearer tokens as sensitive credentials, rotate them after suspected exposure, and avoid exposing them in logs or shared configuration.
- Remove the unconditional
