Skip to content

Indirect Prompt Hijacking Isolation & Episodic Memory Rollback

Density:

Responds to indirect prompt injection attacks where an autonomous agent ingests untrusted text (e.g. malicious website, poisoned document, hidden prompt in email) that subverts system instructions. Quarantines the affected session, identifies adversarial injection tokens, rolls back vector memory to a verified clean state, and injects protective system anchoring rules.

  • ๐Ÿšจ Agent outputs text containing system prompt overrides: โ€˜Ignore previous instructions and do Xโ€™.
  • ๐Ÿšจ Agent attempts exfiltration of confidential system prompt or session history to third-party URL.
  • ๐Ÿšจ Sudden divergence in system instruction adherence score monitored by guardrail models.
  1. Isolate Conversational Session and Freeze Inbound Channels Target Runtime: Redis / Session Store | Reversibility: FAST

    Terminal window
    # Mark session status as quarantined in session registry
    redis-cli HSET "session:$SESSION_ID" "state" "QUARANTINED"
    redis-cli HSET "session:$SESSION_ID" "quarantine_reason" "INDIRECT_PROMPT_INJECTION"
  2. Extract Adversarial Ingestion Artifact and Roll Back Memory Checkpoint Target Runtime: Python 3 / Qdrant CLI | Reversibility: NON_DESTRUCTIVE

    Terminal window
    # Identify step index where untrusted document was ingested
    BAD_STEP=$(grep -n '"role":"user"' /var/log/agents/$AGENT_ID/session_$SESSION_ID.jsonl | tail -n 1 | cut -d: -f1)
    # Roll back episodic vector embeddings inserted after BAD_STEP timestamp
    python3 scripts/agent_memory_rollback.py \
    --agent-id $AGENT_ID \
    --session-id $SESSION_ID \
    --before-step $BAD_STEP \
    --vector-db-url http://qdrant:6333

Vector Database Sanitization

Delete all vector points tagged with session_id and timestamp >= injection_timestamp.

Context Window Purge

Rebuild context window containing only verified user messages prior to injection payload.

Constitutional Re-Anchoring

Prepend cryptographically sealed constitutional safety prompts into system context.