Skip to main content
Security operations center (SOC) agents that read threat intelligence from a replication endpoint face a specific adversarial risk: an attacker who gains write access to the endpoint can silently replace your stored indicators of compromise (IOCs) with forged ones. The agent then operates on poisoned data — suppressing real threats or flagging friendly IPs — with no visible error. This cookbook applies the Verified Semantic Recall pattern to close that gap: every restored snapshot is cryptographically checked before your agent code ever sees it.

The attack scenario

Your agent checkpoints threat intelligence (malicious IPs, file hashes, attack patterns) via client.snapshot() and restores it on other devices or after a restart. Memory poisoning happens when an adversary modifies the replication database to inject false IOCs:
  1. False negatives — the attacker replaces a CRITICAL record for a known command-and-control IP with a benign entry, so the agent ignores traffic that should alert.
  2. Denial of service — the attacker flags legitimate internal IPs as malicious, halting automated routing.
Because a substituted record can be fully valid ciphertext (something you genuinely encrypted at an earlier point), an auth-tag check alone is not enough — a hash comparison against what you expect is required too.

Implementation

Neither SDK verifies this automatically. You call restore(), get back ciphertext and a receipt, and decide what “fail closed” means for your agent. See Verified Semantic Recall for why.
Create soc_agent.ts. Each threat indicator is one agent identity, so sequence_number gives you a natural update history per IOC, and agent_id is a stable hash of the IP you’re tracking — never the raw IP itself, since agent_id is visible to the server.
soc_agent.ts

Operational guidance for SOC environments

Treat any verification failure as a security incident, not a transient error. It means either your replication endpoint has been compromised or an attacker is actively serving forged records. Do not retry. Do not degrade gracefully. Surface the error, quarantine the agent, and page a human immediately.
1

Fail closed — do not apply the record

The agent must not load the modified threat database or make routing decisions from unverified data. queryThreatDatabase above throws before returning — decision logic downstream never receives the poisoned payload.
2

Preserve the forensic trail

Log the expected and received hashes immediately — the delta is the primary evidence for pinpointing which replication log entry was compromised.
3

Recover via lineage rollback

Once the endpoint is secured, walk client.lineage(agentId) to find the last known-good sequence_number and resume writes from there.

Attacks this catches

This pattern only matters for state that crosses the network via restore(). If your SOC agent instead uses store_memory / recall_memory for free-text threat notes, those run entirely against the local index and are inside your trust boundary — see Verified Semantic Recall § Where this applies.