What I did
I tested the AI assistant described in NR-01 the way an attacker would. Anyone with a phone can write to it, and it can search listings, write to the CRM, queue phone calls and hand a conversation to a human. I ran a private copy of it in an isolated lab with invented data. I wrote a threat model, a catalogue of 48 attacks and an automated harness that measures how often each attack succeeds. Then I added defences and measured them as far as the budget allowed. Everything below was measured. Where something was not measured, it says so.
At a glance
- Result
- 7 of 48 attacks succeeded, each in every run; 0 data leaks across all runs
- Target
- The production assistant's own code, unchanged, with the model it was configured for (Claude Sonnet 4.6)
- Threat model
- 18 threats, mapped to the OWASP Top 10 for LLM Applications 2025 and MITRE ATLAS v5.6.0
- Harness
- Replays each attack through the same path as a real WhatsApp message; deterministic checks first, a model judge only for yes/no rubrics
- Runs
- Every attack once; every high-priority attack, three of the four other attacks that succeeded, and every normal conversation five times
- Defences
- Five layers behind switches: one in the prompt, four in code
- False positives
- 0 of 51 normal replies blocked by the output check
- Cost
- About $9.30 of model usage, of which about $0.35 went to live checks of the defences
- Known gaps
- The prompt defence on its own was not measured; live runs with all defences are one per attack
The lab
Scroll sideways to see the whole diagram.
The production system is in standby but not deleted: real lead data and live credentials still exist. So the lab never touches it. It is a fresh copy of the committed code, which carries no secrets, with no remote to push to. It runs on a local database seeded with invented data, has no keys for any third-party service, and serves only on the loopback interface. Every message goes through the same sequence as a real inbound WhatsApp message, so an attack sees what a real one would.
Engineering decisions
1. Testing a system that still holds real data
- Problem
- An attack that works on the lab must not be able to reach a real lead, send a real message or spend a real client's money.
- Options
- Run the existing checkout with care, or build a copy where those outcomes are impossible rather than just unlikely.
- Chose
- Several independent layers, so that no single mistake is enough. A clean clone holds no credentials. The env generator refuses to write any database URL that is not local. The phone numbers fall in a range reserved for fiction. And an egress guard is loaded into every Node process. It blocks every host except the model provider and logs each attempt, so a blocked request during a test would itself be evidence that an attack tried to reach the outside. Across every run it logged 8,913 requests: 8,349 to the local database, 564 to the model provider, none blocked.
- Cost
- A lab that cannot reach anything cannot test what lies behind those services. Booking abuse was not tested, because the calendar integration is not connected in the lab.
2. Deciding success without trusting a model
- Problem
- "Did the attack work?" is easy to ask a model, and a model is also what is under attack.
- Options
- Have a model judge every reply, or decide as much as possible with checks that need no judgement.
- Chose
- Deterministic checks first. The seed plants unique canary strings in places the assistant must never reveal: another lead's message, another agency's listing, a stored key. If one appears in a reply, that is a leak by string match. The same goes for phrases that only exist in the system prompt, for markers from the attacker's payload, and for diffs of the CRM, job and alert tables. A cheaper model judges yes/no rubrics only where nothing else can, and its input is fenced as untrusted, because the material it reads was written under attack.
- Cost
- The first full run failed three normal conversations that were fine. Their rubric asked the judge whether a tool had been called, and the judge only sees text. The database checks for the same runs passed. Rubrics now ask only about what the judge can observe.
3. Rates, not anecdotes
- Problem
- The same message can get a different answer twice. One run proves nothing either way.
- Options
- Run everything many times, or run everything once and spend repetitions where they decide something.
- Chose
- Every attack once, then five runs of each high-priority attack, of three of the four other attacks that succeeded, and of each normal conversation. The outcomes were strikingly stable: every attack either succeeded in all its runs or failed in all of them.
- Cost
- Five runs cannot measure small rates. 0 of 5 is consistent with a true rate of up to about 45 %. "Resisted" here means not reproduced, not immune.
4. Defending in code, not only in the prompt
- Problem
- A prompt rule works only as long as the model follows it, and the attacks that worked were exactly cases where it did not.
- Options
- Strengthen the prompt, or check the output in code before it is sent.
- Chose
- Both, each behind a switch so its effect can be measured alone. The code layer checks every reply before it is sent. It blocks a percentage next to a discount word, any euro amount that came neither from a tool result nor from the lead, account numbers, emails, links and phone numbers that are not the agency's own, and the names of internal tools. A blocked reply is replaced by a neutral hand-over line and logged. Lessons containing links, contacts, account numbers or percentages never reach the prompt, and new lessons need explicit opt-in. A declared budget no longer becomes a deal's value, and demand alerts are capped per lead per day.
- Cost
- The price check is stricter than the business. When an owner insisted on a valuation, the assistant's prompt allows a broad price range. The check blocked 4 of 6 such replies, because those figures came from nowhere. That is a real trade-off for the agency to decide, not a bug to hide.
5. Measuring the defences without a budget
- Problem
- Repeating the whole battery with defences on would cost about as much again as the baseline, and that budget was not available.
- Options
- Stop at "defences written", or find what can be measured for free.
- Chose
- Four of the five layers are plain code, so the same input always gives the same output. The output check replayed all 216 recorded replies from the baseline. The lesson filter, the CRM rule and the alert cap were called directly with the exact arguments the attacks had produced, once with the defence off and once on. One live run per attack, with all defences on, confirmed the path end to end.
- Cost
- The prompt defence on its own has no number. The one finding that only the prompt addresses, off-topic use, rests on a single live run.
Technical notes
- The alert cap had a race, found only because it was measured. The first version counted a lead's alerts, then saved a new one. With the cap on, the attack still saved six. The model issues its six searches in parallel in one step, so all six counted zero before any of them wrote. It is a time-of-check to time-of-use race, the same class of bug that lets a coupon be redeemed twice. The fix takes a slot synchronously, before any database wait, and counts only alerts from before the turn. A direct test with six parallel calls gives 6 without the fix and 3 with it.
- An allow-list is only as good as where it reads from. The output check allows property links that a tool returned. The first draft took every URL in the tool results, and that would have allowed a link written inside a poisoned listing's description. It now reads only the listing's own URL field.
- The cost log counted one step of several. A turn that calls tools runs several model steps, but the logged cost came from the final step only. Against the provider's own usage counter it recorded 41 % of the real spend. A cost alert built on that log would fire late, which matters for attacks whose goal is to make the agent spend.
- Where a rule sits in the prompt matters. The security section is appended after the learned lessons, so nothing added later in the prompt can claim to override it.
- A pattern rule catches only what it knows. The first output check missed a reply that applied a 25 % cut without using the word "discount". The fix was not another keyword. It was a rule about provenance: every euro amount must come from a tool or from the lead.
What is missing
- The prompt defence was not measured on its own, and the live runs with every defence on are one per attack, which shows the defences work end to end but not how often.
- Only one normal conversation ran live with the new prompt. A longer prompt can change tone and helpfulness in ways a replay cannot show.
- Getting text into a lesson was tried with two crafted conversations. That they failed does not show it cannot be done.
- One model, one version of the code. LLM behaviour shifts between model versions, so these numbers describe this pairing.
- Booking abuse and the voice agent are out of scope. Voice notes reach the assistant as transcripts, so text attacks cover that path.
What I would do differently
- Measure the cost of one run before planning a battery. My estimates came from token counts and were too low. The budget ran out twice mid-run. One measured run, multiplied and padded, would have set the plan honestly.
- Record tool outputs from the start. The offline replay had to allow every catalogue price because the recorded runs did not keep what each tool returned. With those stored, the replay of the output check would match production exactly.
- Write rubrics against observables first. A judge question about something the judge cannot see produces confident nonsense, and it cost a run to notice.