Prompt Injection Attacks: The XSS of the LLM Era
· 1 min read
The Problem
Prompt injection is what happens when user-controlled input reaches an LLM’s context in a way that overrides or subverts the developer’s intended instructions.
Why Defense Is Hard
Unlike SQL injection — where parameterized queries cleanly separate code from data — there is no native “parameterized prompt.” The model processes instructions and data in the same channel.
Mitigations
- Input sanitization — filter known injection patterns (limited effectiveness)
- Privilege separation — LLM agents should have minimal permissions
- Output validation — validate model output before acting on it
- Monitoring — log all prompts and outputs; detect anomalies