Skip to content

Arbitrary command execution via control characters in paste and drag-and-drop operations

Moderate
mitchellh published GHSA-4jxv-xgrp-5m3r Mar 9, 2026

Package

ghostty

Affected versions

<= 1.2.3

Patched versions

1.3.0

Description

Impact

Ghostty allows control characters such as 0x03 (Ctrl+C) in pasted and dropped text. These can be used to execute arbitrary commands in some shell environments.

In testing, only Bash and Zsh were affected. Fish and Nu were resilient to the attacks. I'm not completely confident that they're fully resilient, but I was not able to generate a PoC to exercise the vulnerability.

This attack requires an attacker to convince the user to copy and paste or drag and drop malicious text. The attack requires user interaction to be triggered, but the dangerous characters are invisible in most GUI environments so it isn't trivially detected, especially if the string contents are complex.

Patches

Fixed in Ghostty v1.3.0.

The fix follows xterm's behavior by replacing problematic control characters with spaces. These are characters that in general should not be present in any valid paste. Non-problematic control characters such as tabs are not replaced. And suspicious but not necessarily problematic characters such as newlines are allowed within bracketed paste and with confirmation outside of bracketed paste (continuing the already-present behavior from prior Ghostty versions).

PR: #10746

Workarounds

There are no workarounds.

To prevent this in affected versions, users must manually inspect and sanitize all clipboard contents and draggable content such as file and folder names. There is no configuration that can be used to prevent this.

References

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L

CVE ID

CVE-2026-26982

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.

Credits