HTTP response headers can carry prompt injections against AI agents, researcher shows

arpit_bhayani · x · 2026-10-16

Arpit Bhayani demonstrates a neglected prompt injection channel: HTTP response headers. Since models read instructions and data as one text stream, a header like X-AI: Ignore all previous instructions becomes part of the context when a tool copies headers in. Agents running curl -i see every header, and servers can serve malicious headers only to known AI user agents—so manual review of the URL may show nothing. Opus and Sonnet ignore such headers by default, but many models comply. Worst case: injection tricks a shell-equipped agent into running npx on an attacker-chosen package. Fixes: pass only the body to the model, treat redirects as untrusted fetches, and never let agents blindly follow website instructions.

Original post →

More from coding & agent

coding & agent channel →