A critical vulnerability has been discovered in **iTerm2**, a popular terminal emulator for macOS, allowing for **arbitrary code execution** through a seemingly innocuous command like `cat readme.txt` 【1】. This exploit targets users of **iTerm2** 【1】.
### What Happened
The vulnerability stems from iTerm2's SSH integration feature, which uses terminal escape sequences to communicate with a remote "conductor" script. iTerm2 fails to validate that these sequences originate from a trusted source, enabling malicious terminal output to impersonate the legitimate conductor 【1】. Essentially, an attacker can craft a file that, when viewed with `cat` in iTerm2, tricks the terminal emulator into believing it's interacting with a secure SSH session 【1】. The exploit file contains a fake conductor transcript, including forged `DCS 2000p` and `OSC 135` sequences, which prompts iTerm2 to initiate its conductor workflow 【1】. iTerm2 then sends commands like `getshell()` and `pythonversion()`, which the malicious file "answers" with forged replies 【1】.
### Who is Affected
**Users of iTerm2** are affected by this vulnerability 【1】.
### Security Implications
The primary security implication is **arbitrary code execution** on the victim's machine 【1】. By exploiting iTerm2's trust failure, an attacker can gain control over the user's system. This could lead to data theft, installation of malware, or further compromise of the system.
### Technical Details
The exploit leverages iTerm2's handling of terminal escape sequences. A malicious file can contain sequences that initiate a conductor session. The attacker controls the `sshargs` field within the forged `DCS 2000p` hook, which iTerm2 uses to construct a `run` command 【1】. By carefully crafting `sshargs`, the attacker ensures that the final base64-encoded `run` command ends with a string that is both a valid relative path and an executable file on the victim's system 【1】. When iTerm2 writes these commands to the pseudo-terminal (PTY), they are received by the local shell as plain input. While most commands appear as nonsense, the final crafted chunk is executed as a local program, leading to code execution 【1】.
### What Defenders Should Know
Defenders should be aware that even simple commands like `cat` can be dangerous if executed within a vulnerable iTerm2 environment. The vulnerability was reported on March 30, 2026, and a fix was committed on March 31, 2026 (commit `a9e745993c2e2cbb30b884a16617cd5495899f86`). However, as of the article's publication, the fix had not yet been released to stable versions 【1】. Therefore, users should **update iTerm2 to the latest available version** once the fix is incorporated into a stable release to mitigate this risk. Until then, users should exercise extreme caution when viewing files from untrusted sources within iTerm2.