Understanding Prompt Injection: An Experience-Based Lecture
When I first began studying AI security, prompt injection was one of the first vulnerabilities that caught my attention. At first glance, it seemed rather simple: someone writes a clever instruction, and the AI follows it instead of its original rules. But the deeper I looked, the more I realised that this was not merely a problem with clever wording. It was a problem with how AI systems handle trust.
To understand prompt injection, we first need to understand how an LLM processes information. It receives instructions from developers, questions from users, and information from external sources such as websites, emails, documents, and tools. All this information is processed within what is called a context window. Developers use structures such as ChatML and Harmony to distinguish between these sources and establish which instructions should take priority.
However, these boundaries are not perfect security barriers.…