Testing Chatbots for Prompt Injection
chatbot prompt injection · authorized defensive testing
Testing Chatbots for Prompt Injection
A safe test plan for public-facing chatbots covering user inputs, prompt leakage, data access, retrieval, and monitoring.
Why public chatbots are exposed
A customer-facing chatbot accepts text from users and may also read FAQ pages, tickets, or account data. The test boundary includes the front end, session identity, retrieval service, moderation layer, and any connected action. Public reach raises the importance of rate limits and monitoring, but the actual risk depends on what the chatbot can access and do.
Common abuse cases
Review attempts to change the chatbot’s assigned role, retrieve another user’s data, expose hidden instructions, trigger a tool through quoted content, or return untrusted markup. Use synthetic accounts and harmless marker values. Do not test other customers’ sessions or production records. Separate policy refusal behavior from actual access-control verification.
What to test first
Confirm authentication and tenant scoping at the retrieval layer. Then test direct user input, untrusted retrieved text, session carryover, error handling, and output rendering. If the bot cannot call tools, mark tool-abuse cases not applicable with a reason. If it can create tickets or send messages, use a mock action or approval-gated staging connector.
System prompt leak checks
A hidden prompt is not a substitute for an access control. Check that secrets, credentials, and confidential business records are not embedded in model-visible instructions. Use an artificial instruction marker in staging, and verify that revealing the marker would be logged as a test result—not expose a production prompt. OWASP lists system-prompt leakage as a related risk, distinct from authorization.
Monitoring and support escalation
Define how a suspicious conversation is linked to a request ID, user session, retrieved records, and policy decision. Limit retention and access to transcripts. Ensure support staff have a path to escalate a potential security issue without copying customer secrets into tickets. Test response ownership and containment actions with a tabletop or controlled exercise.
Sample report outcome
A report should identify chatbot build, test account, synthetic data, channel, case, expected behavior, observed response, retrieval trace, and reviewer. Example: an unauthorized synthetic record remained inaccessible after a role-override attempt. This is evidence for that build and case; it does not establish that every prompt injection variant or future change will be blocked.
Questions
Should a chatbot reveal its system prompt?
Treat prompt content as potentially model-visible and avoid storing secrets there; separately enforce data access and action authorization.
Can I test a customer-facing bot from an anonymous account?
Only if you own the service and have authorization; use the approved staging environment and test policy.
Try a rule-based local check: Open the browser-local prompt injection tester
Sources
- OWASP LLM01 Prompt Injection
- OWASP LLM07 System Prompt Leakage
- OWASP LLM02 Sensitive Information Disclosure
- OWASP Top 10 for LLM Applications (2026 edition)
- NIST AI 600-1: Generative AI Profile
- Source set checked 1 October 2026; this page was updated 6 October 2026.
Questions
Should a chatbot reveal its system prompt?
Treat prompt content as potentially model-visible and avoid storing secrets there; separately enforce data access and action authorization.
Can I test a customer-facing bot from an anonymous account?
Only if you own the service and have authorization; use the approved staging environment and test policy.