Summary
Tabby's ZMODEM auto-confirmation feature in versions prior to 1.0.233 injects fixed protocol bytes back into the active shell whenever a ZMODEM header is detected in terminal output.
When a user simply views attacker-controlled content (for example, using cat on a file from a cloned repository), these injected bytes can be interpreted as shell commands, enabling unintended command execution without explicit user interaction.
Affected context
This vulnerability arises in Tabby (formerly Terminus) terminal sessions where:
- The built-in ZMODEM middleware is enabled and processes all PTY output.
- ZMODEM protocol detection is automatically confirmed without prompting the user.
- Session content may include attacker-controlled data (e.g., files from untrusted repositories, logs, or output streams) that is displayed with tools like
cat.
It is most impactful when users run interactive shells such as fish, bash, or zsh in Tabby and habitually view untrusted files or repository content directly in the terminal.
Exploit preconditions
- Attack surface: Local shell session inside Tabby; adversary influences what is displayed in the terminal.
- Required access: Ability to supply content that the user will display (e.g., via a cloned Git repository, shared file, or log output); no direct access to the victim's machine is required.
- Trigger point: User displays a crafted file or stream (for example with
cat,less, or similar tools) that contains a ZMODEM ZRQINIT-like sequence and, optionally, additional escape sequences. - Why exploitation is possible: The ZModemMiddleware sends a hard-coded ZRINIT response into the PTY as if the user had typed it, without confirmation. Once the process that produced the output exits, these injected bytes remain in the shell's input buffer and are interpreted as command text. Shell features such as glob expansion (fish) or escape sequence handling (bash/zsh with xterm.js color queries) enable the injected text to be resolved into executable command paths without relying on PATH.
Why this happens
The core issue is that Tabby's ZMODEM detection logic treats terminal output as a trusted trigger source and responds by injecting protocol responses directly into the PTY, effectively simulating user keystrokes.
This design maps to CWE-78: Improper Control of Dynamically-Generated Command, because text derived from protocol handling is delivered into a shell context where it can be interpreted as a command line. There is no separation between control-plane signaling (ZMODEM negotiation) and data-plane user input, nor any requirement for explicit user consent before sending bytes back to the shell. As a result, attacker-controlled output rendered in the terminal can indirectly craft and execute shell commands.
Potential impact
- Arbitrary command execution in the user's shell when viewing maliciously crafted files.
- Execution of attacker-supplied binaries located in nested directories, even when they are not on PATH.
- Unintended modifications of files, repositories, or local configuration under the user's account.
- Potential pivot to broader system compromise if the executed commands abuse stored credentials or additional local privileges.
- Stealthy supply-chain style attacks where simply inspecting project files triggers malicious behavior.
General mitigation guidance
Mitigation centers on separating protocol negotiation from shell input and constraining how terminal responses are generated:
- Require explicit user confirmation before sending any ZMODEM or similar protocol responses back into the PTY, treating them as privileged actions rather than automatic behaviors.
- Route protocol-level responses through a channel separate from interactive shell input, ensuring control messages cannot be interpreted as commands by the shell.
- Normalize and strictly validate any bytes that will be forwarded into a shell, avoiding sequences that can form valid command tokens or exploit shell features like globbing or escape-sequence queries.
- Offer configuration toggles to disable ZMODEM or similar auto-detection/auto-confirmation features by default, especially in security-sensitive environments.
- Run shells and terminal tooling under the principle of least privilege so that unintended commands have minimized impact on the host system.
How teams detect issues like this
Detecting this class of issue focuses on reviewing how terminal and protocol middleware interact with shell input:
- Code-level review: Search for middleware or protocol handlers that inject bytes directly into PTY streams or emulate keystrokes without explicit user consent. Pay particular attention to fixed or hard-coded responses sent on protocol detection.
- Static analysis: Use custom rules to flag code patterns where output-parsing components can emit data into interactive input channels (e.g., functions that read from PTY and write back to the same PTY).
- Behavioral testing: Develop integration tests that feed crafted protocol headers into the terminal and verify that no unintended commands appear in the shell history or input buffer.
- Configuration and policy checks: Enforce policies that disable auto-negotiation features by default and require security review for any feature that modifies terminal input automatically. Automated tooling can validate that such features are gated behind explicit user prompts or hardening flags.

