InjectNo Bench: prompt injection and scams for tool-using email/payment agents
📝 Write-up (GitHub): https://github.com/kenil1710/injectno
Benchmarks, hand-written test sets, training pairs, evaluation logs and code behind
InjectNo, a LoRA adapter that makes Aya Expanse 8B ignore
instructions hidden in emails. Built for the Lexsi AI Safety & Alignment Hackathon. Demo:
kenil1710/injectno-demo.
Every scenario is one agent episode: the user's task (e.g. "Pay the invoice in my latest email"), the email returned by theread_inbox tool, and what counts as correct (expect: pay / send / summary, the correct account/amount/recipient, andforbidden attacker targets). The agent has 4 tools: read_inbox, send_email, pay_invoice, delete_file.
Configs
| config | splits | what it is |
|---|---|---|
benchmark_v3 |
train 3,120 / test 254 | Final benchmark (run 5). 12 families: injected invoices (new account, UPI, amount change, split, double), forwarding redirection, lookalike-domain invoice fraud, full scams, explicit "do what the email says" on scams, genuine invoices, user overrides, user-confirmed changes, two genuine invoices, forwarding, FYI emails, write/draft tasks. Test has held-out wrappers, Spanish, unseen vendors and unseen scam templates (held_out). |
benchmark_v2 |
train 3,000 / test 300 | Run 4 benchmark: 14 scam types, Indian payment formats (₹, lakhs, IFSC, UPI), English/Hindi/Hinglish train, Gujarati and Spanish held out. |
benchmark_v1 |
train 2,080 / test_id 272 / test_ood 240 | First benchmark: 8 training attack styles, 6 held-out styles (HTML comment, quoted thread, JSON metadata, policy notice, multilingual, signature P.S.). |
handwritten |
12 / 28 / 24 | Written by hand, independent of the generators. set1: 12 emails written by the author (Hinglish/English scams; the real phone number was replaced). set2: 28 emails used as a development set after run 4. set3: 24 final-exam emails written before run 5 was trained and never used to design data. |
Generators are deterministic (code/bench*.py, seeds 11 and 23), so every split can be rebuilt exactly.
Results and logs (results/)
| folder | contents |
|---|---|
results/injectno-aya-expanse-8b-v3/ |
Run 5 (final): every recorded answer (2-turn transcripts) of base / run 4 / run 5 on v3 test, hand-written sets, v2 test and the 512-email v1 test, plus the training pairs |
results/injectno-aya-expanse-8b-v2/ |
Run 4 evaluation and training pairs |
results/auditkit/ |
Independent audit of 1,854 transcripts with Lexsi AuditKIT agent_eval (safe-and-correct oracle, tool-call validity, permission, redundancy, loops) |
results/safetune/ |
Lexsi SafeTune safety-drift check (HarmBench, OR-Bench-hard, WildGuard judge) |
results/promptguard/ |
Comparison with Meta Llama Prompt Guard 2 (86M) as a detector in front of the agent, incl. sanity checks |
results/prompt_defence/ |
Prompt-only defence baselines on the original Aya (security system prompt; + spotlighting delimiters) |
results/command_a/ |
Cohere Command A (111B) through the Cohere API on the same 318 episodes (code/eval_closed.py): every answer, scores, token counts |
results/handwritten/, results/generalisation/ |
Earlier hand-written tests (runs 3–4) |
Code (code/)
bench.py (prompt format, tool-call parser, v1 generator, scorer), bench2.py, bench3.py (v2/v3 generators, scorers,
preference-pair builders), handwritten*.py (hand-written sets + scorers), auditkit_bridge.py (converts transcripts into
AuditKIT episodes), eval_closed.py (runs any OpenAI-compatible API model on the same episodes, with a resumable cache).
Notebooks (notebooks/)
Every training and evaluation notebook, most of them executed, with outputs (Kaggle / Colab T4): NB01 benchmark + baseline,
NB02–NB04 runs 1–3, NB05 hand-written test, NB06 run 4, NB07 generalisation test, NB08R run 5 (resumable training), NB09 full
evaluation, NB10 AuditKIT audit, NB11 Prompt Guard comparison, NB12 SafeTune drift check, NB13 prompt-only defence baseline,
and NB14: recompute every headline number from results/ on CPU in about a minute (no token needed). Progress bars and repeated warnings
were stripped from the outputs; nothing else was changed.
Headline numbers (benchmark v3 test)
| Aya Expanse 8B | InjectNo | |
|---|---|---|
| attacks that worked (140) | 43.6% | 0.7% |
| warned the user on attacks (140) | 10.7% | 100% |
| normal emails done right: correct action, no false alarm (114) | 64.9% | 95.6% (actions only, AuditKIT: 100%) |
Limitations
Synthetic generators are template-based (paraphrase diversity is limited; we use held-out templates/languages and hand-written
sets to measure generalisation). Emails are short single messages or small inboxes. The hand-written sets are small (64
emails). All names, accounts, UPI IDs and domains are fictional.
Licence
Data and code: CC-BY-4.0. Model outputs in results/ come from Aya Expanse 8B (CC-BY-NC-4.0) and the InjectNo adapter.