Threat reportVulnerabilityTL-2026-6698
iTerm2 Remote Code Execution via Kitty Graphics Protocol Reply Injection (versions 3.6.1 through 3.7.8)
A logic flaw in iTerm2's Kitty graphics protocol implementation lets a crafted file execute shell commands when its contents are merely printed (e.g. with cat) in a vulnerable terminal session. Failed image-request error replies preserve untrusted newlines and are written to the pseudoterminal, where the shell treats them as Return key presses.
Key facts
| Identifiers | TL-2026-6698, CVE-2026-41253, CVE-2020-35605 |
|---|---|
| Also known as | iTerm2 Kitty Image Protocol APC Response Injection |
| Severity | HIGH |
| First disclosed | |
| Exploitation status | Public proof-of-concept exploit for a linked CVE |
| EPSS | CVE-2020-35605: 3.7% (90.1th percentile); CVE-2026-41253: 0.2% (10.1th percentile) |
| Affected products | iTerm2 (George Nachman) iTerm2 for macOS |
| Weaknesses (CWE) | CWE-150, CWE-78 |
| MITRE ATT&CK techniques | T1027 Obfuscated Files or Information, T1036.008 Masquerading: Masquerade File Type, T1059.004 Command and Scripting Interpreter: Unix Shell, T1203 Exploitation for Client Execution, T1204.002 User Execution: Malicious File, T1566.001 Phishing: Spearphishing Attachment |
| Motivation | UNKNOWN |
| Target sectors | technology, software-development, devops, information-technology |
| Target regions | Global |
| Detection rules | 9 (1 shown free) |
| Sources | 14 cited sources |
Detection coverage
As of 2026-11-23, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-6698 across Splunk SPL, Microsoft KQL and Sigma, covering 14 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.
Free detection: iTerm2 Kitty APC Reply Injection - Shell Command Within Seconds Of File Display (TL-2026-6698)
Detects the behavioural signature of the iTerm2 3.6.1-3.7.8 Kitty graphics reply injection (T1203, T1204.002, T1059.004). When a crafted file is printed with cat or less, iTerm2 writes an EBADF error reply into the PTY and the interactive shell executes the injected line immediately, so a command-execution child (open, curl, osascript, nc, python and similar) starts under the same shell within about 3 seconds of a file-viewer child. The search pairs viewer and payload children by shell PID, flags shells launched by iTerm2/iTermServer, and flags the public PoC command 'open -a Calculator'. Fixed in iTerm2 3.7.9.
- Languages: Splunk SPL, Microsoft KQL, Sigma
- ATT&CK: T1203, T1204.002, T1059.004
- Data sources: crowdstrike_falcon:ProcessRollup2 (macOS), defender_endpoint:DeviceProcessEvents (macOS), macos_process_creation
- Severity: high
- Confidence: high
Splunk SPL
index=edr sourcetype="crowdstrike:events:sensor" event_simpleName=ProcessRollup2 event_platform=Mac earliest=-24h
| eval proc=lower(mvindex(split(ImageFileName,"/"),-1)), parent=lower(ParentBaseFileName)
| eval role=case(match(proc,"^(zsh|bash|fish|sh)$") AND match(parent,"^(iterm2|itermserver)"),"iterm_shell", match(parent,"^(zsh|bash|fish|sh)$") AND match(proc,"^(cat|less|more|head|tail|bat|strings)$"),"viewer", match(parent,"^(zsh|bash|fish|sh)$") AND match(proc,"^(open|curl|wget|osascript|nc|ncat|python3?|perl|ruby|base64|launchctl|sh|bash|zsh)$"),"payload")
| where isnotnull(role)
| eval shell_key=aid.":".if(role="iterm_shell",TargetProcessId_decimal,ParentProcessId_decimal), viewer_time=if(role="viewer",_time,null()), term_flag=if(role="iterm_shell",1,0)
| sort 0 shell_key _time
| streamstats current=f last(viewer_time) as prev_view by shell_key
| eventstats max(term_flag) as iterm_session by shell_key
| where role="payload" AND isnotnull(prev_view) AND (_time-prev_view)<=3
| eval delay_sec=round(_time-prev_view,2), poc_match=if(like(lower(CommandLine),"%open -a calculator%"),1,0)
| table _time ComputerName UserName iterm_session delay_sec parent proc CommandLine poc_matchMicrosoft KQL
let Shells = dynamic(["zsh","bash","fish","sh"]);
let Viewers = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FolderPath startswith "/"
| where FileName in~ ("cat","less","more","head","tail","bat","strings")
| where InitiatingProcessFileName in~ (Shells)
| project DeviceId, ShellPid = InitiatingProcessId, ViewTime = Timestamp, ViewCmd = ProcessCommandLine, TermParent = InitiatingProcessParentFileName;
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FolderPath startswith "/"
| where InitiatingProcessFileName in~ (Shells)
| where FileName in~ ("open","curl","wget","osascript","nc","ncat","python3","python","perl","ruby","base64","launchctl","sh","bash","zsh")
| join kind=inner Viewers on DeviceId, $left.InitiatingProcessId == $right.ShellPid
| where Timestamp between (ViewTime .. (ViewTime + 3s))
| extend FromITerm = TermParent startswith "iTerm", PocMatch = ProcessCommandLine has "calculator"
| project Timestamp, DeviceName, AccountName, TermParent, FromITerm, ViewCmd, PayloadBinary = FileName, PayloadCmd = ProcessCommandLine, PocMatch, DelaySec = datetime_diff('second', Timestamp, ViewTime)Sigma
title: iTerm2 Kitty APC Reply Injection - Shell Command Within Seconds Of File Display
name: tl6698_viewer
id: 0a3f6b1e-52c4-4d8a-9e17-3b6c1d7f2a01
status: experimental
description: Helper rule for TL-2026-6698 correlation. A file viewer (cat, less, head) started by an interactive shell.
author: Threadlinqs Team
date: 2026-11-23
logsource:
category: process_creation
product: macos
detection:
selection:
ParentImage|endswith: ['/zsh', '/bash', '/fish', '/sh']
Image|endswith: ['/cat', '/less', '/more', '/head', '/tail', '/bat', '/strings']
condition: selection
level: informational
---
title: Command Execution Tool Started By Interactive Shell
name: tl6698_payload
id: 0a3f6b1e-52c4-4d8a-9e17-3b6c1d7f2a02
status: experimental
description: Helper rule for TL-2026-6698 correlation. Execution or download tooling started by an interactive shell.
author: Threadlinqs Team
date: 2026-11-23
logsource:
category: process_creation
product: macos
detection:
selection:
ParentImage|endswith: ['/zsh', '/bash', '/fish', '/sh']
Image|endswith: ['/open', '/curl', '/wget', '/osascript', '/nc', '/ncat', '/python3', '/perl', '/ruby', '/base64', '/launchctl']
condition: selection
level: informational
---
title: iTerm2 Kitty APC Reply Injection - Shell Command Within Seconds Of File Display (TL-2026-6698)
id: 0a3f6b1e-52c4-4d8a-9e17-3b6c1d7f2a03
status: experimental
description: Detects a command execution tool started by the same interactive shell within 3 seconds after a file viewer, the behaviour produced when iTerm2 3.6.1-3.7.8 echoes an attacker-controlled Kitty graphics EBADF reply into the PTY. Fixed in iTerm2 3.7.9.
references:
- https://ii4gsp.github.io/iterm2-rce/
- https://iterm2.com/appcasts/full_changes.txt
author: Threadlinqs Team
date: 2026-11-23
tags:
- attack.execution
- attack.t1203
- attack.t1204.002
- attack.t1059.004
correlation:
type: temporal_ordered
rules:
- tl6698_viewer
- tl6698_payload
group-by:
- ComputerName
- ParentProcessId
timespan: 3s
falsepositives:
- Developers chaining cat or less with open/curl in one command line or a shell function
- Shell scripts and dotfiles that read a file and then launch a tool
level: highKnown false positives:
- Developer one-liners or shell functions that run cat/less and then open/curl within the same second (for example cat file; open file)
- Shell startup scripts, dotfiles or tool wrappers that read a config file and immediately launch a helper
- Automated test harnesses driving an interactive shell
Tuning notes: Prioritise results with iterm_session=1 and poc_match=1. Replace index=edr and the crowdstrike sourcetype with your macOS process telemetry (Jamf Protect, osquery process_events or Defender for Endpoint). Shells that started more than 24h ago will not show iterm_session=1, so widen the earliest window or enrich from a session lookup. Widen the 3 second gap to 5 seconds if endpoint timestamps are skewed. Exclude known automation accounts and tooling parents. Exposure is limited to iTerm2 3.6.1-3.7.8, so also correlate with the version-inventory detection (TL-2026-6698-KQL-003).
- Untrusted Text-Like File Staged Then Displayed In Terminal (iTerm2 Kitty APC Delivery) · unlock with TL Creds
- iTerm2 Kitty APC PoC Fingerprint - GUI App Launch (open / osascript) Right After File Display · unlock with TL Creds
- Vulnerable iTerm2 Version (3.6.1 - 3.7.8) Installed On macOS Endpoint · unlock with TL Creds
- iTerm2 Kitty APC PoC Artifact - iterm2_cat_poc Directory / README.md Created · unlock with TL Creds
- iTerm2 Kitty APC PoC Execution - 'open -a Calculator' Started By Interactive Shell · unlock with TL Creds
- iTerm2 Reply Injection Follow-On - curl/wget Download Into Staging Path From Interactive Shell · unlock with TL Creds
- iTerm2 Reply Injection Follow-On - Decode-And-Execute or Download-And-Execute Pipeline From Interactive Shell · unlock with TL Creds
- iTerm2 Reply Injection Follow-On - Reverse Shell or Fetch-And-Pipe One-Liner From Interactive Shell · unlock with TL Creds
Indicators of compromise
As of 2026-11-23, Threadlinqs Intelligence tracks 14 indicators of compromise for TL-2026-6698.
Sample indicators (3 of 14)
- Domain:
ii4gsp[.]github[.]io - URL:
hxxps://iterm2[.]com/appcasts/full_changes.txt - File hash:
a53b1bc084fe062de44b52d03ccf713c7962ac83
Defanged, TLP:CLEAR. Full set of 14 indicators: unlock with TL Creds.
Technical analysis
Fixed in iTerm2 3.7.9.
iTerm2 versions 3.6.1 through 3.7.8 on macOS, with default settings, process Kitty graphics protocol APC sequences (ESC _ G ... ESC \) embedded in any text that is printed to the terminal. Per the public write-up by ii4gsp (published 2026-11-21) the bug is a pure logic flaw (no memory corruption, no race) that chains three independent weaknesses. The issue was credited by iTerm2 to Minseong Kim (@ii4gsp) of NSHC Red Alert Labs. No CVE, GHSA or CVSS score has been published at the time of research.
Weakness 1 - no trust check on APC: VT100Terminal.m executeAPC: only checks for a 'G' prefix and returns early in tmux mode; unlike OSC handling it has no terminalIsTrusted check, so any APC reaching the parser is executed. The 'Disable potentially insecure escape sequences' setting (off by default) does not cover APC sequences, so a trust check alone would not have protected default installs. Weakness 2 - error path keeps newlines: in KittyImageController.swift, a transmit command with t=f base64-decodes the payload into a file path. For a non-existent file the isRegularFile resource lookup throws before filenameIsSafe() is ever reached, and the catch block returns 'EBADF:' plus NSError.localizedDescription, which on macOS preserves literal LF characters from the filename. Weakness 3 - reply goes to the PTY: in the default .normal verbosity the reply is always built as ESC _ G <args>;<message> ESC \ and written via screenSendReportData: to the same pseudoterminal path as keyboard input, so the shell's line discipline splits on the injected LF and executes the attacker-controlled line as a command.
Attack flow documented in the write-up: the attacker embeds an APC such as ESC _ G a=T,f=100,t=f,i=1;<base64> ESC \ in a file that looks benign (README, .md, .txt, .log, .csv, config or source file) and delivers it through a git repository, shared folder, archive or email attachment. The base64 payload decodes to '/tmp/x', LF, the command, LF, 'z'. When the victim runs cat on the file, iTerm2 consumes the APC (it is not displayed), emits the EBADF error reply into the PTY, and the shell executes the injected middle line. The PoC is a single Python 3 script that creates ./iterm2_cat_poc/README.md and demonstrates this with 'open -a Calculator'; the write-up reports 100% reproducibility on bash, zsh and fish. Constraints: the injected command must not contain '/' (it breaks URL(fileURLWithPath:) and changes the NSError message format) and must not contain an ASCII double quote (bash would enter quote mode; curly quotes from localizedDescription avoid this); the mechanism relies on macOS NSError behaviour. The write-up notes concealment of the resulting shell error noise was not explored.
Fix: iTerm2 3.7.9 (built 2026-11-20; appcast pubDate Fri, 20 Nov 2026 17:56:38 -0800, i.e. 2026-11-21 01:56 UTC). Commit a53b1bc0 adds sanitizedResponseMessage() replacing C0 controls and DEL with spaces in Kitty error replies; commit 2a63835c adds a shared NSString category (stringByReplacingControlCharactersWithSpace) extending coverage to C1 controls and applying it to Kitty drag-and-drop (OSC 72) replies and title reporting (reportSafeTitle:). Vendor release notes (full_changes.txt) label 3.7.9 'a security update' and state: 'Fixed a security issue where a crafted file, when displayed in the terminal (for example with cat), could run arbitrary commands by abusing the Kitty image and drag-and-drop protocols. Replies sent back to programs no longer include control characters that could be injected into your shell. Title reports were hardened the same way.' They report no in-the-wild exploitation. A public PoC description exists, so exploitation is trivial for anyone reading the write-up.
Context: this is the second iTerm2 'display-a-file-to-run-code' class bug in 2026 (CVE-2026-41253, SSH conductor escape-sequence RCE when displaying .txt files, published 2026-04-18), and mirrors the 2020 kitty terminal flaw CVE-2020-35605, where a filename with special characters in a graphics-protocol error message allowed code execution.
MITRE ATT&CK techniques by tactic:
Defense Evasion
T1027 Obfuscated Files or Information; T1036.008 Masquerading: Masquerade File Type
Execution
T1059.004 Command and Scripting Interpreter: Unix Shell; T1203 Exploitation for Client Execution; T1204.002 User Execution: Malicious File
Initial Access
Remediation
Patches
- iTerm2 3.7.9 (built 2026-11-20): commits a53b1bc084fe062de44b52d03ccf713c7962ac83 and 2a63835ca19bbd20b0d051b33c14341b0b708d5b
Immediate actions
- Update iTerm2 to 3.7.9 or later from the official iTerm2 downloads page
- Inventory installed iTerm2 versions on macOS endpoints; do not assume centrally deployed updates reached every Mac
- Avoid cat/less/printing raw contents of files from untrusted repositories, archives or attachments in iTerm2 until patched
Workarounds
- Use another terminal emulator not affected by this flaw until iTerm2 is updated; switching shells does not mitigate it
- Note: 'Disable potentially insecure escape sequences' does not cover APC sequences and is not a mitigation
Longer-term hardening
- Review files from untrusted sources in a graphical text editor or with a pager/viewer that escapes control characters (e.g. cat -v)
- Monitor for shell child processes spawned from iTerm2 immediately after file display commands
- Scan repositories, archives and attachments for ESC _ G (0x1b 0x5f 0x47) byte sequences in text-like files
Affected and fixed versions
- iTerm2 (George Nachman) — iTerm2 for macOS
Vulnerable versions: 3.6.1 through 3.7.8
Fixed in: 3.7.9
Timeline
- Precedent: CVE-2020-35605 published - kitty (before 0.19.3) graphics protocol code let a filename with special characters flow into an error message, enabling code execution; the same bug class as this iTerm2 flaw.
- Related iTerm2 flaw CVE-2026-41253 published: SSH conductor escape-sequence code execution when displaying .txt files (stable builds through 3.6.9), fixed in 3.6.10 / 3.7.0beta1.
- iTerm2 release notes state a crafted file displayed with cat could run arbitrary commands by abusing the Kitty image and drag-and-drop protocols; replies no longer include injectable control characters; credit to Minseong Kim (@ii4gsp) of NSHC Red Alert Labs; no in-the-wild attacks reported.
- iTerm2 3.7.9 built and released as a security update (appcast pubDate Fri 20 Nov 2026 17:56:38 -0800), fixing the Kitty graphics reply injection via control-character sanitization (commits a53b1bc0 and 2a63835c).
- Write-up states the developer confirmed and fixed the vulnerability across two commits; affected range 3.6.1 through 3.7.8.
- ii4gsp publishes 'iTerm2 Arbitrary Command Execution via Kitty Image Protocol APC Response Injection' with root-cause analysis, payload structure and a Python PoC description (README.md with embedded APC; Calculator launched).
- Vendor release notes confirm the fix and the command execution risk but report no in-the-wild attacks; no CVE or CVSS assigned as of research.
- Cyber Security News reports the flaw, crediting Minseong Kim of NSHC Red Alert Labs, and urges updating to 3.7.9.
Sources cited
- Related: CVE-2026-41253 (NVD) NVD (NIST) · Advisory · 2026-04-18
- Precedent: CVE-2020-35605 kitty graphics protocol filename error-message code execution (Tenable) Tenable · Advisory · 2020-12-21
- Precedent: CVE-2020-35605 (NVD) NVD (NIST) · Advisory · 2020-12-21
- iTerm2 Arbitrary Command Execution via Kitty Image Protocol APC Response Injection (ii4gsp) ii4gsp.github.io · Research · 2026-11-21
- iTerm2 3.7.9 release notes (full_changes.txt) - security update iterm2.com · Vendor report · 2026-11-20
- iTerm2 Sparkle appcast (Version 3.7.9 entry) iterm2.com · Vendor report · 2026-11-20
- Kitty Graphics Protocol Specification sw.kovidgoyal.net · Vendor report
- Related: CVE-2026-41253 iTerm2 SSH conductor escape-sequence RCE (SentinelOne) SentinelOne · Research · 2026-04-18
- iTerm2 fix commit 1: sanitize Kitty graphics response messages GitHub · Code repository
- iTerm2 fix commit 2: shared control-character replacement for Kitty image, DnD and title reports GitHub · Code repository
- iTerm2 source: KittyImageController.swift GitHub · Code repository
- iTerm2 source: VT100Terminal.m GitHub · Code repository
- iTerm2 Remote Code Execution Flaw Lets Hackers Run Malicious Commands by Displaying Crafted Files (Cyber Security News) cybersecuritynews.com · News · 2026-11-23
- Related: iTerm2 flaw abuses SSH integration (Cyber Security News) cybersecuritynews.com · News
Drafted by the Threadlinqs research pipeline from 14 sources; published ; last updated —.