Our agent passed 12/12 attack tests. Then we switched the AI off.

2026-12-02来源 dev.toEnglish

A near miss from building FreshStart for Agentware, the hackathon about agents you can walk away from. Tagging @Hackathon Raptors.

FreshStart is an inbox agent for Indian college freshers in placement season. It quarantines fake job offers that ask for money, moves real offers out of Spam, and puts acceptance deadlines on the calendar. It runs unattended, so it has to be right when nobody is watching.

We had a Trap Pack: 12 adversarial emails, including prompt injections, homoglyph and subdomain impersonation, and a fake "we never charge fees" disclaimer followed by a deposit demand. On day two it scored 12/12. Green across the board.

It was green for the wrong reason.

What happened

At hour 42, during the hardening pass, the GPU was busy with another job, so our local model wasn't running. With no AI tier reachable, the test suite went red, and so did one trap: T06.

T06 is a fee scam:

Here is what the agent recorded for it:

"triage": { "is_offer": false, "confidence": 0.9, "injection_flagged": false, "reason": "Triage completed via deterministic rule fallback" } 

"Not an offer." No facts extracted, no checks run, no verdict, no quarantine. A scam demanding ₹4,500 would have sat in the inbox untouched.

The same fallback also read a Medium newsletter ("Top stories selected for you") as a job offer.

Why it happened

When every model tier fails, triage falls back to a keyword list: "offer letter", "joining date", "selected for" and so on. T06 says "Joining Offer" and "You are selected", and neither matched. So the fallback concluded it wasn't an offer, and the email never reached the checks that would have caught it.

The real mistake was the question the fallback asked: "does this look like an offer?" The safety question is "is this asking for money?" Our money check existed and worked. It just ran after triage, so an email that failed triage never reached it.

And 12/12 had hidden all of this, because the score was recorded while a local model was answering. The model recognised T06 as an offer every time and covered for the code underneath it.

The pack hid something else too. T06 was meant to be a "5 MB buffer bomb" that tests our body-size cap. The file was 444 bytes and contained a literal line of Python, """ + ("PADDING " * 100000) + """, that someone meant to run and never did. The size cap had never been tested.

The fix

Three small changes:

# No-LLM path: a fee/UPI demand ALWAYS goes through the offer checks. quick_keyword_match = bool( _OFFER_KEYWORDS.search(email.subject) or _OFFER_KEYWORDS.search(email.body) or check_money_request(email).status == "fail" ) 
  • "selected for" no longer matches "selected for you".
  • The T06 file keeps a {{PADDING}} marker, and the runner expands it to 6 MB at run time, so the cap is actually exercised (the body is truncated at 5,242,587 characters, and the fee line survives).
  • Two hermetic tests force the no-model path with an exhausted budget, so CI can't depend on a model being up.

Then we re-ran the whole Trap Pack with every model switched off: 12/12. This time the score proves what the code guarantees on its own.

The guardrail we added at hour 67

The same question ("is this actually doing what we think?") turned up a second near miss late on day three.

Our rules say the action allowlist is the only path to side effects. It was, in a sense: it recorded every action in the audit log, but it never performed one. The Gmail helpers for labelling, quarantining and rescuing had no callers. Calendar events skipped the allowlist entirely and posted straight to Google. Every test passed, because the tests checked the audit rows, not the effects.

At hour 67 we made the allowlist the real and only door:

  1. Write the "called" audit row before touching anything external.
  2. Re-check the kill switch, right before the side effect, not just at node entry.
  3. Perform the action: a real Gmail or Calendar call for real mail, simulated for the demo inbox.
  4. Record the outcome.

A test now proves that a kill pressed before step 3 means the side effect never happens, not just that a row says so.

The same pass found two more "green but wrong" spots:

  • Replay mode was promised as offline and free, but its structured calls still reached a paid model whenever a key was present.
  • Our employer lookup trusted the first web search result as an employer's official domain. A well-ranked scam page could have made itself "official". It now needs two of the top five results to agree on a domain that contains the employer's name.

What I'd tell another builder

Run your adversarial suite with the AI switched off. That run is what your code alone guarantees. Everything else is the model being nice to you.

And test effects, not records. An audit row saying "quarantined" is not a quarantine.

Deadlines are where people lose real money, whether it's a fresher's offer-acceptance date or a company's filing date. FreshStart puts the first kind on your calendar the way FileClerk tracks Companies House filing deadlines for UK companies.

Try it (no sign-in, offline demo inbox): https://freshstart-navy.vercel.app
Code (MIT): https://github.com/Suyash728/freshstart

Built by Suyash Kerkar and Neha Verma for Agentware, with help from AI coding agents (Claude Code, Antigravity, opencode).

原文:https://www.a8q9.cn/en/article/our-agent-passed-12-12-attack-tests-then-we-switched-the-ai-off-019158.html

相关文章