5692 Total CVEs
26 Years
GitHub
README.md
Rendering markdown...
POC / README.en.md MD
# CVE-2026-54686: Warp DCS Lifecycle Hook Spoofing PoC

[日本語版はこちら](README.md)

## Description

This repository contains a safe local Proof of Concept for
**CVE-2026-54686**, based on Warp's public advisory
[GHSA-9w2v-jhww-vm85](https://github.com/warpdotdev/warp/security/advisories/GHSA-9w2v-jhww-vm85).

Before the patched release, Warp accepted certain state-mutating DCS lifecycle
hooks from the PTY stream without verifying that those hooks were emitted by
Warp's shell integration for the active session. If an attacker could cause a
victim to view attacker-controlled terminal output in Warp, selected lifecycle
metadata could be spoofed, including current working directory metadata for the
active block and SSH session transport metadata.

This PoC does not connect to Warp or to any SSH server, and it does not execute
arbitrary commands. It locally generates and parses Warp-like DCS JSON hooks to
show that a vulnerable model accepts spoofed CWD and SSH metadata, while a fixed
model rejects state-mutating hooks with missing or unregistered `session_id`
values.

## Disclaimer

This project is for educational and ethical security testing purposes only. Do
not use it against systems or environments where you do not have explicit
permission.

## Vulnerability Details

- **CVE ID**: CVE-2026-54686
- **GitHub Advisory**: GHSA-9w2v-jhww-vm85
- **Summary**: DCS lifecycle hook spoofing can alter terminal session metadata
- **Severity**: Medium
- **CVSS v3.1**: 4.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L`)
- **CWE**: CWE-78, CWE-88
- **Affected versions**: `>= v0.2021.04.25.23.05.stable_00`
- **Patched version**: `v0.2026.05.06.15.42.stable_01`
- **Reporters**: [@rootxharsh](https://github.com/rootxharsh),
  [@Saku0512](https://github.com/Saku0512)

## Impact

Successful exploitation of the scoped CWD issue may cause Warp to treat an
attacker-chosen path as the active session's current working directory. This
can affect Warp features that seed path, context, or session behavior from the
active CWD.

Spoofed SSH lifecycle metadata may also update Warp's stored SSH session
transport metadata with attacker-controlled values.

## Root Cause

Warp's shell integration sends lifecycle hooks such as `Precmd`,
`CommandFinished`, `InputBuffer`, and `SSH` to the client using terminal DCS
sequences. Before the fix, some state-mutating hooks did not require proof that
they carried a `session_id` generated by the Warp client and registered for the
active session.

The patch injects non-zero client-generated session IDs into bootstrap scripts
and rejects state-mutating DCS hooks whose `session_id` is missing or
unregistered. The SSH wrapper path was also changed so the local SSH hook is
authenticated, a client-generated remote session ID is registered, and that
remote ID is injected into the remote bootstrap.

## Proof of Concept

### 1. Environment Setup

Python 3 is required:

```bash
python3 --version
```

### 2. Vulnerable Model Simulation

```bash
python3 poc.py
```

Expected result:

```text
[!] VULNERABLE: spoofed cwd was accepted.
[!] VULNERABLE: spoofed ssh metadata was accepted.
```

### 3. Fixed Model Simulation

```bash
python3 poc.py --mode fixed
```

Expected result:

```text
[+] FIXED: spoofed cwd was rejected.
[+] FIXED: spoofed ssh metadata was rejected.
```

### 4. Individual Cases

```bash
python3 poc.py --case cwd
python3 poc.py --case ssh
```

Use `--show-stream` to print the generated Warp-like DCS stream using Python
`repr()`. The script does not print raw terminal control sequences.

## Remediation

Update to `v0.2026.05.06.15.42.stable_01` or later. The public advisory states
that there is no complete workaround other than updating.

## References

- [GHSA-9w2v-jhww-vm85](https://github.com/warpdotdev/warp/security/advisories/GHSA-9w2v-jhww-vm85)
- [Fix commit 32d21d15c9a3da1a923d1ed66226cf5cba081d16](https://github.com/warpdotdev/warp/commit/32d21d15c9a3da1a923d1ed66226cf5cba081d16)
- [Fix commit 51bd3267803c5cc0a45074fa19fd50162be7c917](https://github.com/warpdotdev/warp/commit/51bd3267803c5cc0a45074fa19fd50162be7c917)
- [CWE-78](https://cwe.mitre.org/data/definitions/78.html)
- [CWE-88](https://cwe.mitre.org/data/definitions/88.html)