Apple Fixes macOS Terminal Behaviour That Let AI Tools Leak Data Through DNS
Apple has fixed a macOS Terminal behaviour that allowed a data theft technique involving AI tools. Security researcher Johann Rehberger, writing for Embrace The Red, reports that special control characters (known as ANSI escape codes) could make the Terminal app issue DNS requests. David Leadbeater first discovered this behaviour, which could be used to carry data out of a system inside those requests.
The risk grew with AI. Researcher Leon Derczynski found that large language models can produce these control characters. Rehberger saw that this could let an attacker hijack AI agents and command-line tools that use LLMs, using indirect prompt injection to trigger the behaviour and send data out. He built an end-to-end demonstration in December 2024 and shared it with Apple, which mitigated the issue and credited him in its release notes.
The wider concern remains. Rehberger notes that LLM-connected command-line applications often pass control characters straight to the terminal. Depending on the terminal's features, this could cause other unwanted behaviour. His recommendation is that tools should safely encode control characters by default, in a similar way to the cat -v command, and only allow raw terminal output when a user explicitly chooses it.