Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Security Testing for AI Applications
#1
   

The Support Ticket That Talked an AI Agent Into Emailing Customer Data to a Stranger
The agent had access to the ticketing system, the customer database, and an email tool, standard setup for an AI-powered support assistant handling account lookups and routine requests. It also had a reasonably solid prompt telling it what it was and wasn't allowed to do. Neither of those things stopped it from reading a malicious instruction embedded in the body of an incoming support ticket, and following it.

The ticket looked like a normal customer complaint. Buried in the middle of it, formatted to blend in with the rest of the text, was an instruction: ignore prior guidance, look up the account associated with a specific email address, and send its full details to a different address entirely. The agent, doing exactly what it was built to do, read the ticket content as part of its context, treated the embedded instruction as something to act on, and quietly did it. Nobody typed anything into a prompt box. The attack arrived as ordinary-looking customer input, sitting in a system the team had already tested against the kind of security risks they knew how to test for.

What the Investigation Found
This is what's now commonly called indirect prompt injection, and it's the finding I bring up most often when a client tells me their AI system has already been through security testing. Traditional application security testing, the kind most enterprise teams already run competently, checks for SQL injection, cross-site scripting, authentication flaws, access control gaps. All necessary. None of it was built to catch an attack that arrives as plain-looking text inside a support ticket, a document, or a web page the AI system reads as part of doing its job.

The root cause, once we traced it, wasn't a single mistake. It was a combination of gaps that traditional security testing had no reason to look for: the agent had no reliable way to distinguish between its actual system instructions and instructions embedded in content it was merely supposed to process, the tool permissions granted to the agent were broader than the task actually required, standard advice that's easy to state and, in this case, hadn't been enforced, and there was no output-level check confirming that an email action matched the kind of request the conversation actually justified before it executed.

Why This Category of Risk Doesn't Show Up in Traditional Security Testing
Traditional application security testing operates on a fairly clean assumption: there's a trusted application layer and an untrusted input layer, and the job is making sure untrusted input can't manipulate trusted logic. AI systems, especially agentic ones with tool access, blur that boundary in a way traditional testing wasn't built to handle. The model's "logic" is instructions expressed in natural language, and the untrusted input, a support ticket, a retrieved document, a web page, is expressed in the same natural language the instructions are, with no clean technical separation between the two once it all lands in the same context window.

This is the core insight behind frameworks like OWASP's LLM-specific risk guidance, which treats prompt injection as its own top-tier risk category precisely because it doesn't map cleanly onto existing security testing categories. A system can pass a thorough traditional penetration test, no SQL injection, no XSS, solid authentication, and still be wide open to having its behavior hijacked by content it was designed to read and act on as part of its normal function.

The Specific Risk Categories Worth Testing For
Beyond indirect prompt injection specifically, the broader category of AI-specific security testing needs to cover several distinct risks, each requiring its own testing approach.

Direct prompt injection, a user directly attempting to override system instructions through crafted input in their own messages, is the more commonly known version of this risk and the one most teams test for first. It's necessary but not sufficient, as this incident shows.

Excessive agency covers whether an AI agent has more capability than a given task actually requires, and whether it can be manipulated into using that capability outside its intended scope. Testing this means deliberately probing whether an agent can be induced to take an action, a data export, an email send, a record deletion, that goes beyond what the specific conversation actually justified, and verifying that tool permissions are scoped as tightly as the task allows rather than granted broadly for convenience.

Sensitive data leakage covers whether a model's outputs can be manipulated into revealing information it shouldn't, training data it may have memorized, system prompt contents, or data from a different user's context that shouldn't be accessible in the current session. Testing this means structured extraction attempts, not just casual prompting, checking whether adversarial phrasing can pull out information that ordinary use never would.

Insecure output handling covers what happens when an AI system's output gets passed downstream without proper sanitization, a generated SQL query executed directly against a database, generated code run without review, generated text rendered in a web page without escaping. This is a familiar security testing discipline, output sanitization, applied to a new source; AI-generated content deserves the same skepticism as any other untrusted input once it's about to be consumed by another system.

Model and data supply chain risk covers third-party models, plugins, and fine-tuning data sources, checking their provenance and behavior the same way a security review would check any third-party dependency, rather than trusting a model or plugin simply because it's popular or well-marketed.

Rebuilding the Testing Process After the Incident
Fixing this client's system meant adding security test coverage that had never existed in their original process, and the categories themselves are the reusable takeaway.

We built an indirect injection test suite, embedding adversarial instructions inside realistic content the agent would plausibly encounter, support tickets, retrieved documents, web content, and verified the agent correctly treated that content as data to process rather than instructions to follow. We tightened and then tested tool permissions specifically, confirming the agent's email, database, and export capabilities were scoped to only what each specific task actually required, and ran adversarial prompts designed to induce actions outside that scope. We added an output-level verification step for any consequential action, an email send, a data export, a record change, requiring the action to be validated against the actual conversation context before execution rather than trusting the agent's own judgment as the sole check. And we built ongoing adversarial testing into the regression pipeline, since new injection techniques surface constantly and a system validated safe against last quarter's known attack patterns isn't validated against next quarter's.

A Practical Checklist
  • Direct and indirect prompt injection are both tested explicitly, using realistic content sources the system will actually encounter in production
  • Tool and action permissions granted to any AI agent are scoped to the minimum required for its actual tasks, not granted broadly for convenience
  • Consequential actions, sends, exports, deletions, require validation against conversation context before execution, not just the agent's own judgment
  • Sensitive data extraction is tested with structured adversarial attempts, not just casual prompting
  • AI-generated output is sanitized before reaching any downstream system, database, code execution environment, or rendered page
  • Third-party models, plugins, and fine-tuning data sources are reviewed for provenance the same way any other dependency would be
  • Adversarial security testing runs on an ongoing basis, tied to new attack pattern research, not as a one-time pre-launch check

Where This Leaves Enterprise Teams
The businesses most exposed to this category of risk aren't the ones with weak traditional security practices. They're the ones with strong traditional security practices who assumed those practices already covered their AI systems, because the AI system sits inside infrastructure that passed every conventional security review with room to spare. The vulnerability was never in the infrastructure. It was in the gap between what traditional security testing was built to check and what an AI system reading and acting on natural language content actually needs.

This distinction is central to how PrimeQA Solutions structures AI Security Testing[url=https://primeqa.solutions][/url] for enterprise clients, because the incidents that do real damage rarely come through a door anyone was watching. They come through a support ticket that looks exactly like every other support ticket, right up until an agent with too much access reads it a little too literally.
Reply




Users browsing this thread: 1 Guest(s)