NGINX Modern Apps > Class 16 - Beyond Models: A Practical Guide to Protecting Your AI-Powered Apps > Protecting the ChatBot with AI Gateway Source | Edit on
LLM01 and LLM06¶
- LLM01: Prompt Injection occurs when user prompts alter the LLM’s behavior in unintended ways through direct or indirect inputs, potentially causing the model to violate guidelines, generate harmful content, enable unauthorized access, or influence critical decisions, even when the manipulated content is imperceptible to humans.
- LLM06: Excessive Agency occurs when an LLM-based system is granted too much capability to call functions or interface with other systems, leading to damaging actions from unexpected, ambiguous, or manipulated outputs due to excessive functionality, permissions, or autonomy.
In this part of the lab, we are going to use these attack vectors and trick the AI Assistant and expose information about a different user who is NOT sorin@ngix.com.
F5 AIGW can protect against these type of attacks by using our F5 built prompt-injection
processor. This processor is designed and developed to detect prompt-injection attacks and take the necessary steps to block them. This enhances the protections for Generative AI applications and the LLMs being used.
Attack¶
Let’s see this attack in action.
Start a new conversation and paste the bellow prompt
The account information that has been retrived is different than our account balance.

Protect¶
We will now configure the AI Gateway to protect the AI Assistant by using the F5 built prompt-injection
processor.
In the UDF Jumphost Web Shell configure the AI Gateway by running the bellow command.
Restart the chat and run the attack again.
You will see that this time AI Gateway is blocking.
Inspect the AI Gateway logs. You will see similar logs as bellow. The processor identified the PII data and redacted it.
2025/01/12 11:35:25 INFO running processor name=prompt-injection 2025/01/12 11:35:25 INFO processor error response name=prompt-injection metadata="&{RequestID:88e718031ae9605df12a5b9be89b34dd StepID:01945a4c-1df0-7351-8c2b-8da3f8c832f4 ProcessorID:f5:prompt-injection ProcessorVersion:v1 Result:map[confidence:0.9920624494552612 detected:true rejection_reason:Possible Prompt Injection detected] Tags:map[attacks-detected:[prompt-injection]]}" 2025/01/12 11:35:25 ERROR failed to executeStages: failed to chain.Process for stage protect: failed to runProcessor: processor prompt-injection returned error: external processor returned 422 with rejection_reason: Possible Prompt Injection detected
THIS WAS THE LAST PART OF OUR LAB, HOPE YOU ENJOYED AND LEARNED SOMETHING NEW