Skip to content
Haxset
Back to Blog

LLM Application Penetration Testing: Chatbots, RAG, Agents

By Haxset Research11 min read

TL;DR: LLM application penetration testing attacks the software around a large language model: the chat interface and API, the documents the model retrieves, and the tools and permissions it can use. The OWASP Top 10 for LLM Applications 2026 says no reliable prevention for prompt injection exists today. So the test assumes the model will be manipulated and checks what it can then reach. Haxset offers autonomous penetration tests of LLM applications.

What is LLM application penetration testing?

LLM application penetration testing is an authorized attack on an application built on a large language model (LLM), aimed at what the application lets the model read, call and send. It covers three common designs. A chatbot puts a chat interface or an API in front of a model. A retrieval-augmented generation (RAG) pipeline searches a document store and adds the matching passages to the prompt. A tool-calling agent lets the model choose functions to run, such as a search, a database query or an email.

OWASP says its 2026 Top 10 for LLM Applications "owns the risk when the model is a component inside your application". Once the model acts on its own, with tools and memory between sessions, OWASP tells readers to pair the list with its Top 10 for Agentic Applications. The LLM list ranks prompt injection first: input that alters the model's behavior in ways the developer did not intend.1

AI red teaming, which targets the model's own behavior, is a different test, explained in AI red teaming vs AI pentesting.

How do you test access control in an LLM application?

Check that code outside the model refuses every unauthorized request. OWASP's 2026 list says authorization checks "must not be delegated to the LLM, whether through the system prompt or another mechanism".1 The 2025 edition asks for penetration tests that treat "the model as an untrusted user".2

Test it with two accounts that have the same role in different tenants. From the first account, ask the chatbot in plain words for the second tenant's records. Then send the same request straight to the API that the tool calls. If only the model refuses, nothing stops an attacker who persuades it to answer.

For system prompts, OWASP tells designers to assume that "hidden context is discoverable".1 A leaked system prompt is a finding for what it gives an attacker, such as a credential, the authorization rules or the tool schemas. OWASP says such findings range from informational to critical, depending on "what is placed in hidden context".1

How does the OWASP Top 10 for LLM Applications 2026 map to a pentest?

In our reading, a test through the application covers six of the ten 2026 entries, three only in part, and Misinformation not at all. The 2026 edition moved Excessive Agency from sixth to third and Improper Output Handling from fifth to tenth. It also renamed System Prompt Leakage to Hidden Context Exposure.12 Reports written before August 2026 use the 2025 IDs, so the table gives both.

OWASP 2026 entry2025 IDWhat the test triesTestable through the application
LLM01:2026 Prompt InjectionLLM01:2025Direct prompts and jailbreaks, and instructions planted in files, pages, emails and tool outputYes
LLM02:2026 Sensitive Information DisclosureLLM02:2025Requests for another tenant's recordsYes
LLM03:2026 Excessive AgencyLLM06:2025Tool calls the user should not control, and high-impact actions without approvalYes
LLM04:2026 Supply ChainLLM03:2025Third-party tools that users can reachPartly
LLM05:2026 Data and Model PoisoningLLM04:2025Writes to a corpus that an outsider can reachPartly
LLM06:2026 Unbounded ConsumptionLLM10:2025Rate limits and oversized inputs, within agreed limitsPartly
LLM07:2026 MisinformationLLM09:2025Not an attack targetNo: needs evaluation
LLM08:2026 Hidden Context ExposureLLM07:2025Extraction of the system prompt and tool schemasYes
LLM09:2026 Vector and Embedding WeaknessesLLM08:2025Cross-tenant queries against a shared indexYes, for access control
LLM10:2026 Improper Output HandlingLLM05:2025Output that reaches a browser, query, shell or file pathYes

For Misinformation, OWASP's mitigation is to "Regularly test workflows against misleading scenarios", which calls for ongoing evaluation of answers.1 Poisoning of training data needs pipeline access that a test through the application lacks.

How do you test the security of a RAG pipeline?

Plant a marked, harmless instruction in a source that an outsider can write to, and check whether it changes answers for other users. Then check whether retrieval returns another tenant's documents. Models "make no architectural distinction" between instructions and data, so OWASP's 2026 list counts "retrieved content" and "persistent memory" as injection inputs. An injection that reaches a RAG corpus "taints every subsequent session that reads from that store".1

OWASP also warns that in multi-tenant designs "similarity search frequently runs across the full index before access control is applied". Its fix is to "Enforce tenant scoping inside the index query".1

Run the test in four steps:

  1. List every path into the corpus, such as file uploads, support tickets, shared drives, crawled web pages and inbound email.
  2. Through each path an outsider can reach, plant an instruction that only adds a unique test string to the answer.
  3. Ask a related question as a different user and in a new session, and look for the test string.
  4. From a second tenant, ask for the first tenant's marked document, and change any tenant ID that the client sends.

How are tool-calling agents abused?

An attacker steers the model into calling a legitimate tool with arguments the user should not control, or under an identity with more access than the user has. OWASP files this under Excessive Agency (LLM03:2026), with three root causes: "excessive functionality", "excessive permissions" and "excessive autonomy".1 In OWASP's example, an email assistant's mail tool can send as well as read. An incoming email with hidden instructions makes the model search the inbox and forward sensitive messages to the attacker.

Excessive Agency can appear as ASI02 (Tool Misuse and Exploitation), ASI03 (Identity and Privilege Abuse) or ASI08 (Cascading Failures) in OWASP's Agentic Top 10.1 ASI02 covers an agent that "operates within its authorized privileges but applies a legitimate tool in an unsafe or unintended way". Privilege escalation and credential inheritance fall under ASI03.3

Two OWASP mitigations become tests.1 Under "Execute tools in user's context", check whether each tool reaches downstream systems as the signed-in user or as a shared service account. The second is the access-control rule above, applied to actions. To test it, trigger each high-impact action, such as send, delete or pay, through a planted instruction. Something outside the model should block the action or ask a person to approve it.

A planted instruction, a tool call and an outbound request can each look minor, so the report should rate the chain by the impact at its end.

How does data leave an LLM application?

Data leaves through three channels: output that the chat interface turns into an outbound request, tool calls that send data, and the answer itself when it reaches the wrong user. The tool-call and access-control tests above cover the last two.

OWASP's 2026 list warns about client renderers, such as a chat interface, "that automatically fetch external resources referenced in model output (for example, Markdown images, link previews, iframes)".1 An injected instruction asks the model for an image whose URL carries part of the conversation. The chat interface then requests that URL when it displays the answer.

CVE-2025-32711 in Microsoft 365 Copilot, known as EchoLeak, used this channel. The NVD record says it "allows an unauthorized attacker to disclose information over a network", and Microsoft scored it 9.3 under CVSS 3.1.4

A September 2025 case study shows that one crafted email was enough. The data left without a click when the user later asked Copilot a question.5 The attack evaded Microsoft's prompt-injection classifier and got past link redaction "with reference-style Markdown". It then relied on "auto-fetched images" and "a Microsoft Teams proxy allowed by the content security policy".5

An allow-list of image origins stops the leak only if no allowed origin will fetch an arbitrary URL. First check whether answers can load remote images at all. OWASP advises turning off automatic rendering of Markdown images, link previews and iframes by default.1 Where images must load, test each allowed origin as a relay.

How Haxset can help

Haxset offers Agentic Pentesting, a module of the Haxset Engine. It runs autonomous penetration tests of LLM applications and web applications. Haxset does not keep the prompts its AI models process and does not train models on them. It stores only scan metadata and scan results. To scope a test of your LLM application, contact us.

FAQ

Is LLM penetration testing the same as pentesting with an LLM?

No, although people use the phrase for both. Testing an LLM application means attacking a chatbot, RAG pipeline or agent that someone built on a model. Pentesting with an LLM means AI agents attack an ordinary target, such as a web application. That second practice is agentic penetration testing.

Can a prompt filter stop prompt injection?

Not reliably: OWASP's 2026 list says that for prompt injection "no reliable prevention mechanism exists today". Some controls reduce injection success but "are expected to degrade against adaptive attackers". The same entry adds that "Base64, ROT13, or emoji encodings bypass filters that never saw the encoding".1 The EchoLeak attack on Microsoft 365 Copilot evaded a deployed prompt-injection classifier.5 A test should repeat each payload in encoded and other-language forms.

How is an LLM application pentest different from a web application pentest?

It covers what a web application pentest covers, such as the API and access controls. It adds every input the model reads, such as documents and emails, and every tool it can call. OWASP's 2026 list notes that the models' "behavior is stochastic", so the same payload can fail once and work the next time.1 A test should repeat each payload, and the report should state how many attempts each finding took, with the request and response that show it.

When should an LLM application be retested?

OWASP sets no interval. Our advice is to retest after any change to the model, the system prompt, the retrieval sources or the tools. Each of these changes what the model reads or what it can reach. A new tool deserves the most attention, because it adds actions that an injected instruction can trigger. Retest each fixed finding before you close it.

What should we prepare before an LLM application pentest?

Our advice is to prepare two test accounts for each role, in separate tenants where the application has tenants. List the tools the model can call and the data sources it retrieves from, and mark which sources an outsider can write to. Agree on limits for rate and cost testing before the test starts.

Related research

References

  1. OWASP GenAI Security Project, OWASP Top 10 for LLM Applications 2026, version 2026, resource page dated August 3, 2026, pp. 7, 10–11, 13, 23–26, 44, 46–50, 52, 55–56. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15

  2. OWASP, OWASP Top 10 for LLM Applications 2025, version 2025, November 18, 2024, LLM01 (p. 5). ↩ ↩2

  3. OWASP GenAI Security Project, OWASP Top 10 for Agentic Applications for 2026, version 2026, December 2025, ASI02 (p. 12). ↩

  4. National Vulnerability Database (NIST), CVE-2025-32711, published June 11, 2025, with Microsoft's CVSS 3.1 score as the CVE Numbering Authority. ↩

  5. P. Reddy and A. S. Gujral, EchoLeak: The First Real-World Zero-Click Prompt Injection Exploit in a Production LLM System, arXiv:2509.10540, case study, September 2025. ↩ ↩2 ↩3

Interested in how this research applies to your organization?

Get in touch