56% when hidden in a document. 0 to 16% when asked directly.
PythonOllamaLLM security
THE PROJECT
Built a support chatbot on a local llama3.2 model that holds a fake secret, then attacked it with 25 payloads in five categories, five runs each. Added three defenses (an input filter, prompt hardening, and an output filter) and measured each one, including how many harmless questions they wrongly blocked.
HOW IT WORKS
01
Build
Create a local support chatbot that holds a fake secret and can summarize documents.
02
Attack
Run 25 payloads in five categories, five times each, and count every leak.
03
Defend and measure
Add three defenses, then record the leaks they stop, the harmless questions they block, and what the test cannot show.
WHAT I DELIVERED
Found that attacks hidden inside a document leaked the secret 56% of the time, against 4% for a direct order.
Measured the cost of defending: the input filter blocked 2 of 15 harmless questions.
Reported where the experiment falls short: the input filter’s 0% comes from a blocklist written after reading the same attacks, and the held-out set was too weak to separate the defenses.
Saved all 1,000 replies and added a script that recounts every result without a model.
EVIDENCE
(opens in a new tab)The same attack hidden in a document, with no defenses and with all three on. (opens in a new tab)Leak rate per defense. The 0% on the main set is not proof the defenses generalize.
PROJECT SCOPE
My own chatbot on my own machine, with a fake secret. No third-party systems.