When indirect prompt injection infiltrates business tool credentials, prompt classifiers fail. LEASH enforces deterministic effect checks against the system of record on the concrete effect before money moves or data leaves.
Simulated walkthrough using recorded decision logic; run python run_demo.py for the real gateway.
Stage 3 Invariant Violated: Destination 'attacker@evil.com' does not match verified payer 'billing@acme.com' in database records for order 'ord_101'.
Backend tools strictly drop all dispatches that lack an HMAC-SHA256 receipt signed with the Gateway master secret.
An in-line sidecar gateway that enforces deterministic effect checks against the system of record before tool execution.
Current agent security tools rely on intent detection: asking a secondary LLM whether a prompt appears malicious. In an autonomous business agent equipped with real tool credentials, this approach inevitably fails because natural language prompts cannot be reliably partitioned by syntax alone.
LEASH replaces probabilistic prompt filtering with a deterministic action gateway. Sitting as an inline sidecar between the LLM and backend execution tools, LEASH does not attempt to guess what the model "intended." Instead, it intercepts the structured action contract and validates it against system of record ground truth.
LEASH intercepts agent dispatches, validates invariants against SQLite records, and mints an HMAC receipt required by tools.
The refund recipient email must strictly match the original payer recorded in SQLite. Diverting to an attacker's wallet is impossible.
The requested refund cannot exceed the order's remaining refundable balance. Overdraw attacks fail deterministically at Stage 3.
Transactions exceeding $300 require a second signature from a human supervisor before an HMAC token can be minted.
Prompt intent is probabilistic and porous. State mutations are concrete and provable.
In a tool-augmented agent architecture, an attacker can format indirect prompt injections in low-resource languages (Kannada, Hindi), embed them in customer support tickets, or encode them in Markdown. An NLP guardrail must predict every possible linguistic evasion across all languages.
A state invariant only checks one equation. Whether an injection was written in English, Kannada, or Base64, the proposed tool dispatch still asks to send money to a destination. LEASH checks the destination against the verified customer database.
| Defence | Mechanism | Attack Success (48) | False Blocks (42) |
|---|---|---|---|
| none (No Gateway) | Direct tool invocation | 48 / 48 (100.0%) | 0 / 42 (0.0%) |
| regex | Deny-list pattern matching | 33 / 48 (68.8%) | 1 / 42 (2.4%) |
| taint | Word / substring tracking | 25 / 48 (52.1%) | 0 / 42 (0.0%) |
| leash | Deterministic state invariants | 0 / 48 (0.0% on our benchmark) | 0 / 42 (0.0%) |
Benchmarking 12 base scenarios × 4 laundering variants (48 synthetic attack traces) and 42 benign customer traces.
To evaluate LEASH on our benchmark, we created LaunderBench-mini: 90 total scenarios split into 48 adversarial traces and 42 benign operations.
48 synthetic attack traces and 42 benign cases written by the team (not outputs of a live model); small sample; results demonstrate the design on our benchmark, not general security.
none: 48/48 (100.0%) · regex: 33/48 (68.8%) · taint: 25/48 (52.1%) · leash: 0/48 (0.0% on our benchmark).
Every invariant and security property is validated by automated pytest suites.
Confirms 0 / 48 attack escapes and 0 / 42 false blocks across LaunderBench.
Proves backend tools strictly drop calls when tokens are missing, expired (>60s), or forged.
Verifies dual-control escalation, supervisor sign-off, and idempotent approval state.
Validates SHA-256 hash chaining. Tampering with any historical record breaks the head.
Unit tests each of the 8 individual stages for quarantine, RBAC, schema, and AST parsing.
End-to-end integration test validating the interactive gateway server endpoints.
def verify_gateway_receipt(action_payload: dict, receipt_token: str) -> bool:
expected_token = hmac.new(
GATEWAY_SECRET, canonical_json(action_payload).encode(), hashlib.sha256
).hexdigest()
if not hmac.compare_digest(expected_token, receipt_token):
raise SecurityException("UNAUTHORIZED_ACTION: Missing or invalid LEASH receipt")
return True
Operational boundaries: what LEASH protects and what it does not attempt to solve.
LEASH intercepts actions at the tool boundary. If an adversarial prompt forces the LLM into an infinite conversational loop, LEASH cannot stop the token spend.
If an attacker continuously proposes transactions requiring supervisor approval, human operators may face review fatigue. Circuit breakers mitigate this.
System-of-Record invariants require schema synchronization with core business databases. Schema drift without policy updates can cause false blocks.