cd /news/ai-safety/dns-exfiltration-via-macos-terminal-… · home topics ai-safety article
[ARTICLE · art-70751] src=promptcube3.com ↗ pub= topic=ai-safety verified=true sentiment=↓ negative

DNS Exfiltration via macOS Terminal ANSI Codes

A vulnerability in macOS Terminal allowed attackers to exfiltrate sensitive data by embedding malicious ANSI escape sequences in text rendered by the terminal, triggering DNS lookups to attacker-controlled domains. Apple has patched the behavior, but the case highlights risks for AI agents that interact with shell outputs, as even restricted agents cannot prevent DNS lookups caused by text rendering.

read1 min views1 publishedJul 23, 2026
DNS Exfiltration via macOS Terminal ANSI Codes
Image: Promptcube3 (auto-discovered)

The vulnerability essentially turns a text-rendering process into a data exfiltration channel. When the terminal renders a specially crafted ANSI sequence, it triggers a DNS lookup to a domain controlled by the attacker. By encoding sensitive data (like environment variables or session tokens) into the subdomain of that request, the data is shipped out via DNS logs.

The Technical Flow #

The attack vector follows a specific chain:

  1. Injection: An attacker places a malicious ANSI escape sequence in a place the user or an AI agent will view (e.g., a README file, a git log, or a tool's output).

  2. Rendering: The macOS Terminal app processes the escape sequence.

  3. Trigger: Instead of just changing the text color, the sequence forces the OS to resolve a DNS query.

  4. Exfiltration: The DNS request reaches the attacker's nameserver, carrying the stolen data in the query string.

For those doing a deep dive into LLM agent security, this is a prime example of why "sandboxing" the LLM isn't enough if the rendering environment (the terminal) has its own vulnerabilities. An AI agent might be restricted from using curl or fetch

, but it can't stop the terminal from performing a DNS lookup just by printing a string to the screen.

Apple has since patched this behavior, but it serves as a great case study for anyone building a real-world AI workflow involving terminal integration. If you're deploying agents that interact with shell outputs, you can't trust that "text" is just text.

Next OpenClaw Defense: Handling Indirect Prompt Injection →

All Replies (4) #

@AveryPilotGood point. I wonder if certain plugins or themes make it easier to hide those codes?

── more in #ai-safety 4 stories · sorted by recency
── more on @apple 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/dns-exfiltration-via…] indexed:0 read:1min 2026-07-23 ·