CVE-2024-38396
📋 TL;DR
This vulnerability in iTerm2 allows remote code execution through malicious escape sequences in window titles when tmux integration is enabled. Attackers can inject arbitrary commands that execute when users view specially crafted content in their terminal. All iTerm2 users with tmux integration enabled (default) on affected versions are vulnerable.
💻 Affected Systems
- iTerm2
📦 What is this software?
Iterm2 by Iterm2
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise with attacker gaining complete control of the user's system, data theft, and lateral movement within the network.
Likely Case
Remote code execution leading to malware installation, credential theft, or data exfiltration when users interact with malicious content.
If Mitigated
Limited impact with proper network segmentation and user privilege restrictions, though code execution at user level still possible.
🎯 Exploit Status
Exploit requires user interaction (viewing malicious content) but no authentication. Public proof-of-concept available.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.5.2
Vendor Advisory: https://iterm2.com/downloads.html
Restart Required: Yes
Instructions:
1. Download iTerm2 3.5.2 or later from https://iterm2.com/downloads.html
2. Install the update
3. Restart iTerm2
🔧 Temporary Workarounds
Disable tmux integration
allTemporarily disable the vulnerable tmux integration feature
Go to iTerm2 Preferences > General > Magic > Uncheck 'Enable tmux integration'
Filter escape sequences
allConfigure terminal to filter or sanitize escape sequences
🧯 If You Can't Patch
- Disable tmux integration in iTerm2 preferences
- Restrict user privileges to limit impact of potential code execution
🔍 How to Verify
Check if Vulnerable:
Check iTerm2 version in menu: iTerm2 > About iTerm2. If version is 3.5.0 or 3.5.1, you are vulnerable.
Check Version:
iTerm2 > About iTerm2
Verify Fix Applied:
Verify version is 3.5.2 or later in About iTerm2 dialog.
📡 Detection & Monitoring
Log Indicators:
- Unusual process execution from iTerm2
- Suspicious escape sequences in terminal logs
Network Indicators:
- Unexpected outbound connections from terminal sessions
SIEM Query:
process.name:iTerm2 AND (process.version:3.5.0 OR process.version:3.5.1)
🔗 References
- http://www.openwall.com/lists/oss-security/2024/06/17/1
- https://gitlab.com/gnachman/iterm2/-/commit/fc60236a914d63fb70a5c632e211203a4f1bd4dd
- https://iterm2.com/downloads.html
- https://vin01.github.io/piptagole/escape-sequences/iterm2/rce/2024/06/16/iterm2-rce-window-title-tmux-integration.html
- http://www.openwall.com/lists/oss-security/2024/06/17/1
- https://gitlab.com/gnachman/iterm2/-/commit/fc60236a914d63fb70a5c632e211203a4f1bd4dd
- https://iterm2.com/downloads.html
- https://vin01.github.io/piptagole/escape-sequences/iterm2/rce/2024/06/16/iterm2-rce-window-title-tmux-integration.html