psf-iterm2-kitty-check(8)

Script: /opt/psf-security-patches/developer/iterm2/iterm2-kitty-check.sh. Tool page: iTerm2 (macOS). Script source. With the package installed: man psf-iterm2-kitty-check.

Overview

iTerm2 terminal-reply command execution, November 2026: check and file scan (v1) No CVE when this manual was published (researcher ii4gsp; fixed in iTerm2 3.7.9, 20 November 2026)

The rest of this collection is for GNU/Linux. iTerm2 is a macOS terminal, and this flaw reaches the machines administrators use to run everything else, so this tool checks Macs. Its scan command runs on GNU/Linux as well, to look through repositories and downloads.

iTerm2 3.6.1 to 3.7.8 answer a Kitty graphics file-transfer request with an error reply that keeps the control characters from the request. A file that carries such a request, shown with "cat README.md", makes iTerm2 type the attacker's text into your shell, which runs it: in bash, zsh and fish, on a default install. All you see is a few shell errors. The setting "Disable potentially insecure escape sequences" does not cover it. 3.7.9 (macOS 13 or later) strips control characters from every reply; macOS 12.4 to 12.x has no fixed release, because its newest iTerm2 is 3.6.11.

Command reference

The original help text below includes the command syntax, options, environment variables and exit codes supplied with this tool. Review the source and test any change before applying it to a production system.

Original command-line help
iTerm2 terminal-reply command execution, November 2026: check and file scan (v1)
No CVE at time of writing (researcher ii4gsp; fixed in iTerm2 3.7.9, 20 November 2026)

If this software is helpful, consider a donation to our 501c3 nonprofit:
https://privacysafe.foundation
Help and documentation: https://privacysafe.app/docs/security-patches/developer/iterm2/

The rest of this collection is for GNU/Linux. iTerm2 is a macOS terminal, and this flaw
reaches the machines administrators use to run everything else, so this tool checks Macs.
Its scan command runs on GNU/Linux as well, to look through repositories and downloads.

iTerm2 3.6.1 to 3.7.8 answer a Kitty graphics file-transfer request with an error reply
that keeps the control characters from the request. A file that carries such a request,
shown with "cat README.md", makes iTerm2 type the attacker's text into your shell, which
runs it: in bash, zsh and fish, on a default install. All you see is a few shell errors.
The setting "Disable potentially insecure escape sequences" does not cover it. 3.7.9 (macOS
13 or later) strips control characters from every reply; macOS 12.4 to 12.x has no fixed
release, because its newest iTerm2 is 3.6.11.

Usage:
  ./iterm2-kitty-check.sh [command] [arguments]

  check (default)  Read-only. Finds every iTerm2 copy (/Applications, each
                   user's ~/Applications, Homebrew's Caskroom, and Spotlight
                   where it answers), reads its version and judges it
                   against 3.6.1 to 3.7.8, and says whether this macOS can
                   run the fix. Exit 0 = no affected copy, 1 = an affected
                   copy, 2 = a copy whose version could not be read.
  scan PATH...     Read-only. Looks through files under each PATH for the
                   Kitty graphics escape sequence the attack hides in text
                   (ESC _ G), and lists files with other escape sequences
                   that make a terminal answer (APC, DCS, device status
                   requests) for a look by hand. Runs on macOS and GNU/Linux.
                   Exit 0 = nothing found, 1 = files found, 2 = bad argument.
  version          Prints the script version.

The fix is iTerm2 3.7.9 or later (iTerm2 > Check for Updates), then quit and reopen it:
a window that is still open runs the old code. Until then, read files from others with
"less" (which shows escape characters as ^[ instead of sending them to the terminal) or in
an editor, not with cat, head or tail.

Env overrides:
  APP_DIRS="/Applications /Users/*/Applications"   where to look for iTerm.app
  MACOS_VERSION      the macOS version, instead of sw_vers (testing only)
  SCAN_MAX_SIZE=20   largest file scan reads, in MB
Works with the bash 3.2 that macOS ships.

The Security Patches software and this documentation are dedicated to the public domain under CC0 1.0 Universal. Other pages on privacysafe.app/docs are CC BY-SA 4.0 unless the page says otherwise.