Why 'Prompt Injection' Echoes 'SQL Injection'

Willison coined "prompt injection" by drawing a direct parallel to SQL injection, noting that LLMs, like vulnerable SQL databases, struggle to distinguish trusted system instructions from untrusted user input, as both share the same text channel.

The top 3

  1. Shared Flaw: Mixing Instructions with Data: Both prompt injection and SQL injection exploit the fundamental design flaw of concatenating untrusted user input directly with trusted system instructions or code, allowing attackers to manipulate the system's intended behavior.
  2. Parallel Impacts: Data Leakage & System Control: Similar to SQL injection enabling database exfiltration, prompt injection can lead to sensitive data leakage (e.g., system prompts, internal tools) and unauthorized actions by hijacking the LLM's instructions.
  3. Mitigation Gap: Code-Data Separation Difference: While parameterized queries provided a robust defense for SQL injection by strictly separating code from data, LLMs inherently blend instructions, context, and user content, making a similarly definitive architectural fix for prompt injection elusive.

Sources

Open the full topic