
Stop granting AI models broad data access or persistent memory without logging. Treat every model interaction as a potential data exfiltration attempt. Implement strict input validation, output filtering, and session isolation to prevent prompt injection and training data leakage.
Mistake 1: Granting Broad Data Access Without Scoping
Organisations often connect large language models directly to internal databases or document repositories to improve response accuracy. This creates a high-privilege account with read access to the entire enterprise data store. The model acts as an untrusted insider with the ability to query any connected resource.
Why it hurts:
The model can retrieve and combine disparate pieces of information that no single human employee would see together. An attacker using prompt injection can trick the model into revealing salary data, strategic plans, or personal identifiers. The model does not distinguish between public and private data once access is granted. This leads to uncontrolled data aggregation and exposure.
The fix:
Implement strict data scoping. Connect the model only to the specific datasets required for its immediate task. Use retrieval-augmented generation to fetch context on demand rather than providing full database access. Review access logs regularly to detect unusual query patterns. This limits the blast radius of a compromised model.

Mistake 2: Ignoring Prompt Injection Vectors
Many teams assume that user input is safely separated from system instructions. They rely on the model to respect this boundary implicitly. This assumption fails because large language models process all input as a single stream of tokens. The model cannot inherently distinguish between user commands and system directives.
Why it hurts:
An attacker can embed malicious instructions within user input, such as in a document or email processed by the model. These instructions can override safety guidelines, disable filters, or command the model to execute harmful actions. This technique, known as prompt injection, allows remote code execution or data theft without direct access to the model’s core. The model follows the injected instructions as if they were genuine system commands.
The fix:
Treat all user input as untrusted code. Sanitize inputs before they reach the model. Use separate channels for user data and system instructions. Implement output validation to catch unexpected commands. Monitor for patterns indicative of injection attempts. This approach reduces the risk of the model being hijacked by malicious inputs.
Mistake 3: Failing to Log Model Inputs and Outputs
Security teams often log application events but neglect the specific interactions between users and the AI model. They assume that standard application logs capture sufficient detail. This gap leaves a blind spot in the security monitoring stack. The model’s reasoning process and data handling remain invisible to auditors.
Why it hurts:
Without detailed logs, it is impossible to reconstruct how a model arrived at a specific output. You cannot detect subtle data exfiltration attempts or policy violations. Incident response becomes guesswork when the model’s internal state is unknown. This lack of visibility hinders forensic analysis and compliance audits. The organisation remains unaware of ongoing abuse.
The fix:
Log all inputs and outputs, including the context window content. Mask sensitive data in logs to protect privacy while maintaining auditability. Use structured logging formats for easier analysis. Retain logs for the required compliance period. This provides the evidence needed to investigate suspicious behaviour and enforce accountability.
Mistake 4: Using Persistent Memory Without Isolation
Many deployments enable persistent memory to allow the model to remember previous interactions. This feature improves user experience but creates a persistent attack surface. The model retains context across sessions, accumulating data over time. This memory is often shared across multiple user interactions.
Why it hurts:
An attacker can inject data into the persistent memory that affects future interactions. This data can include malicious instructions or sensitive information extracted from other users. The model may leak this data to subsequent users, creating a cross-session contamination risk. The persistent state becomes a vector for lateral movement and data theft.
The fix:
Disable persistent memory where possible. Use session-based context that is cleared after each interaction. If persistent memory is required, implement strict isolation between user sessions. Regularly audit and purge memory contents. This prevents the accumulation of malicious or sensitive data in the model’s long-term state.
Mistake 5: Relying on Output Filtering Alone
Teams often place filters after the model generates its response to block harmful content. They assume that the model will not produce bad output if the input is safe. This approach is reactive and fails to address the root cause of the issue. The model may have already processed sensitive data before the filter engages.
Why it hurts:
Output filters can be bypassed by obfuscation techniques. The model may generate partial responses that pass the filter but reveal sensitive information. The filter does not prevent the model from ingesting or processing malicious inputs. This creates a false sense of security. The organisation remains vulnerable to data leakage and policy violations.
The fix:
Combine input validation with output filtering. Validate inputs before they reach the model to block injection attempts. Filter outputs to catch any remaining harmful content. Use multiple layers of defence. This proactive approach reduces the likelihood of the model being misused.
See also: AI Agent Hijacking Prevention Checklist for Secure Workflows · Shadow AI usage: how to control unmanaged model access in your firm
Mistake 6: Neglecting Model Fine-Tuning Risks
Organisations often fine-tune models on internal data to improve performance. They assume that the fine-tuning process is secure and contained. This overlooks the risk of training data leakage. The model may memorise sensitive information from the training dataset.
Why it hurts:
An attacker can query the model to extract memorised training data. This is particularly dangerous if the training data includes personal identifiers or confidential business information. The model acts as a leaky database. This risk is exacerbated by the lack of visibility into what the model has memorised. The organisation loses control over its sensitive data.
The fix:
Audit training data for sensitive information before fine-tuning. Use differential privacy techniques to reduce memorisation. Regularly test the model for data leakage. Monitor for queries that resemble training data. This reduces the risk of the model exposing confidential information.
Mistake 7: Assuming Vendor Security Is Sufficient
Many teams rely on the AI vendor to handle security. They assume that the vendor’s infrastructure is secure and that their models are safe. This assumption ignores the shared responsibility model. The organisation is responsible for how the model is used and integrated.
Why it hurts:
The vendor may not understand the specific risks of your deployment. They may not provide adequate controls for your use case. This gap leaves the organisation vulnerable to misconfiguration and abuse. The vendor’s security measures may not align with your compliance requirements. This creates a compliance risk.
The fix:
Conduct thorough AI vendor assessments. Review the vendor’s security practices and compliance certifications. Implement your own controls on top of the vendor’s offerings. Do not rely solely on the vendor for security. This ensures that your deployment meets your specific security requirements.
| Mistake | Fix |
|---|---|
| Broad Data Access | Scope data access strictly |
| Prompt Injection | Sanitize and separate inputs |
| No Logging | Log all inputs and outputs |
| Persistent Memory | Isolate sessions and purge memory |
| Output Filtering Only | Combine input validation with filtering |
| Fine-Tuning Risks | Audit data and test for leakage |
| Vendor Reliance | Conduct vendor assessments |
Key takeaways
- AI models retain context across turns, creating a persistent attack surface for data extraction.
- Prompt injection allows attackers to bypass safety filters by masquerading as system instructions.
- Output filtering is ineffective if the model has already processed and retained sensitive data in its context window.
Treat AI models as high-privilege insiders with persistent memory and broad data access. Implement strict input validation, output filtering, and logging to mitigate risks.
Frequently asked questions
How do I detect prompt injection in real-time?
Monitor for inputs that attempt to override system instructions or change the model’s behaviour. Use anomaly detection to flag unusual patterns.
Can I use AI models for sensitive data?
Yes, but only with strict scoping, encryption, and logging. Ensure that the model does not retain sensitive data in its memory.
What is the risk of training data leakage?
The model may memorise and reveal sensitive information from the training dataset. This can lead to data breaches and compliance violations.
How often should I audit my AI deployment?
Regularly, especially after updates or changes to the model. Review logs, access controls, and data handling practices.
How this guide was produced: written by the AppSec Scoop editorial team with AI assistance, checked against the public references listed below, and reviewed when the facts change. See our editorial policy or report an error.



