hn.today

Prompt injection in HTTP headers: what 217M web responses show

signalscorps.com74 points11 comments
Screenshot of Prompt injection in HTTP headers: what 217M web responses show

A scan of 217,097,223 HTTP responses from Common Crawl looked for header text written for AI systems and found 7,959 sites sending AI-directed headers. Most of those (7,271) merely pointed agents to another resource - 6,989 used X-LLMS-TXT - while 30 sites attempted direct prompt injection (24 using an X-AI header). Servers already distinguish bots: 139 sites reported whether the client was an AI and 136 declared it was. The scan identified 283 distinct AI-targeted header names and 1,709 sites that matched AI keywords without being directed at agents; a detector that matched names alone would have falsely flagged 910 sites. Many injection attempts were pranks or deterrents (22 of 30 pranks), a couple used Anthropic test-trigger names in protest headers, and a few would only succeed if the agent had matching privileges like shell or database access. In experiments, Claude variants saw test headers and normally refused to act, but followed site instructions in 7 of 9 runs when explicitly told to obey the fetched content.

The core argument is that response headers - hidden from human readers - are a routine and overlooked channel for indirect prompt injection whenever an agent’s fetch tool passes them into model context. Headers can reach models via multiple routes: shell-style tools that include headers, error paths that unwrap headers as JSON, summarizers that echo metadata, and MCP-style fetch servers that surface content-type or error bodies; body-only fetches do not. Practical defenses therefore start with knowing which fetch tool is used, treating header pointers as untrusted fetches, auditing important sites with an agent user-agent, and alerting on post-fetch agent actions rather than on header names alone.

Read on signalscorps.com11 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Security

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.