Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-56803 Overview
CVE-2024-56803 affects Ghostty, a cross-platform terminal emulator. Version 1.0.0 allows attackers to modify the terminal window title using a specific character escape sequence and then insert that title back into the user's command line. An attacker can embed the malicious sequence inside a file. When the user views that file, the sequence modifies the window title and primes a command for execution. If the user then presses the Enter key, the injected command runs in their shell. The issue is tracked under CWE-94: Improper Control of Generation of Code and is fixed in Ghostty v1.0.1.
Critical Impact
Attackers can achieve arbitrary command execution in a victim's shell by combining a window title query escape sequence with a single user keypress.
Affected Products
- Ghostty terminal emulator version 1.0.0
- Default configuration (feature was permitted by default)
- All platforms supported by Ghostty 1.0.0
Discovery Timeline
- 2024-12-31 - CVE-2024-56803 published to the National Vulnerability Database
- 2024-12-31 - GitHub Security Advisory GHSA-5hcq-3j4q-4v6p published alongside fix in Ghostty v1.0.1
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-56803
Vulnerability Analysis
The flaw sits in Ghostty's handling of terminal control sequences that both set and report the window title. Terminal emulators have long supported Operating System Command (OSC) escape sequences such as OSC 0, OSC 1, and OSC 2 for setting the icon or window title. A separate sequence allows the terminal to report the current title back to the host as if the user had typed it on standard input.
Ghostty 1.0.0 enabled this title-reporting behavior by default. An attacker who controls any content that gets rendered to the terminal, such as a text file, a log entry, or network output, can first set the window title to an arbitrary string and then request that the terminal echo that string back into the shell input buffer. The attack is categorized as code injection because the attacker's data crosses the trust boundary from displayed output into executable shell input.
Root Cause
The root cause is an insecure default configuration that honored the window title report sequence without user consent. The terminal did not distinguish between a title set by a legitimate program and one set via untrusted output rendered on screen. Because the reported title is injected into the terminal's input stream, any content placed there is treated as a candidate command.
Attack Vector
Exploitation requires two conditions. First, the victim must render attacker-controlled bytes to the terminal, for example by running cat, less, tail, or similar on a malicious file, or by connecting to a service that returns crafted output. Second, the victim must press the Enter key after the attack sequence has placed a payload on the input line. The attack succeeds without any additional network access or elevated privileges on the victim host. Technical specifics are available in the GitHub Security Advisory GHSA-5hcq-3j4q-4v6p and in Ghostty Pull Request #3908.
No verified public exploit code is tracked in the enriched data. The vulnerability mechanism is described in prose above; refer to the upstream advisory for sequence-level details.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2024-56803
Indicators of Compromise
- Files or network output containing OSC escape sequences that set the window title followed by a title-report query sequence.
- Shell history entries containing unexpected commands that correlate with the user viewing a file or stream rather than typing a command.
- Terminal window titles that change unexpectedly after a user opens an untrusted file.
Detection Strategies
- Inspect downloaded text files, logs, and archives for raw escape sequences before they are rendered. Tools such as cat -v reveal control bytes that cat alone hides.
- Hunt in endpoint telemetry for shell processes spawning unexpected child processes shortly after terminal viewers like less, cat, or tail executed on files from untrusted sources.
- Correlate Ghostty version 1.0.0 on endpoints with execution of file-viewing utilities against downloaded content.
Monitoring Recommendations
- Alert when Ghostty 1.0.0 is observed in software inventory on managed endpoints.
- Monitor shell audit logs for commands whose timing and context suggest injection rather than interactive typing.
- Flag processes that write OSC title sequences to terminals from non-interactive data sources.
How to Mitigate CVE-2024-56803
Immediate Actions Required
- Upgrade Ghostty to version 1.0.1 or later on every endpoint where it is installed.
- Audit any shared files, logs, or network services recently viewed through Ghostty 1.0.0 for embedded escape sequences.
- Advise users to avoid opening untrusted files with raw viewers until the upgrade completes.
Patch Information
The maintainers fixed the issue in Ghostty v1.0.1. The change is tracked in Ghostty Pull Request #3908 and documented in GitHub Security Advisory GHSA-5hcq-3j4q-4v6p. After upgrading, the terminal no longer reports the window title back to the shell under the default configuration.
Workarounds
- Pipe untrusted content through a sanitizer that strips escape sequences, for example cat file | perl -pe 's/\e\][^\a]*(\a|\e\\)//g' before display.
- Use less -R cautiously and prefer less without raw mode for untrusted files, which escapes control bytes by default.
- Where upgrade is not immediately possible, instruct users not to open attacker-controlled files or connect to untrusted interactive services through Ghostty 1.0.0.
# Verify installed Ghostty version and upgrade
ghostty --version
# Expected after remediation: ghostty 1.0.1 or later
# Example sanitizer for viewing untrusted files until patched
cat untrusted.txt | perl -pe 's/\e\][^\a]*(\a|\e\\)//g; s/\e\[[0-9;?]*[A-Za-z]//g'
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

