iTerm2 Vulnerability Allows Remote Code Execution via Crafted Files
A critical vulnerability in macOS terminal emulator iTerm2 allows attackers to execute arbitrary commands by tricking users into displaying specially crafted files.

A security flaw discovered in the popular macOS terminal emulator iTerm2, affecting versions 3.6.1 through 3.7.8, presents a significant remote code execution risk. The vulnerability allows attackers to run malicious commands on a user's system simply by having the user display the contents of a specially crafted file within a vulnerable terminal session. Crucially, this exploit does not require the user to actively run the file as a script or even paste commands provided by an attacker; merely viewing the file's output is sufficient to trigger the flaw.
The issue has been addressed by the iTerm2 development team with the release of version 3.7.9, which was built on November 20, 2026. The vulnerability stems from a logic bug within iTerm2's implementation of the Kitty graphics protocol. This protocol normally allows programs to display images directly within the terminal. However, in this case, failed image request error messages were mishandled, leading to the preservation of untrusted text and line breaks. These preserved elements could then be interpreted by the terminal as commands.
When iTerm2 processes these error messages, it sends the potentially malicious reply back through the pseudoterminal, the same channel used for keyboard input. The system's shell can then interpret the line breaks within this reply as presses of the 'Return' key, executing the text as commands. This bypasses typical file validation mechanisms and security controls, as the user's action appears to be a benign file display rather than an intentional command execution.
Minseong Kim of NSHC Red Alert Labs is credited with reporting this vulnerability. While the vendor's release notes confirm the fix and detail the execution risk, there have been no reports of this flaw being exploited in the wild. The vulnerability is distinct from a previously disclosed iTerm2 SSH integration flaw, but both highlight the potential dangers of untrusted terminal output being processed as executable input.
Security controls such as file validation and terminal trust checks were found to be bypassed by this vulnerability. The fix implemented in iTerm2 3.7.9 involves replacing line breaks and other control characters with spaces in Kitty graphics replies before they are sent to the pseudoterminal. This ensures that the error messages remain readable without containing characters that the shell could interpret as commands. A subsequent update extended this filtering to other areas, including drag-and-drop replies and terminal title reports.
Users of iTerm2 on macOS are strongly advised to update to version 3.7.9 or a later release immediately. Until an update can be applied, users should exercise extreme caution when displaying the raw contents of files from unfamiliar sources, such as downloaded archives or email attachments. Instead of printing to the terminal, it is recommended to use a graphical text editor for inspecting potentially suspicious files. For organizations managing multiple macOS devices, it is crucial to verify that the update has been successfully deployed to all machines, as simply assuming a central deployment has reached every endpoint is insufficient.