CVE-2026-50642 Terminal Escape Injection in diff‑so‑fancy
Attackers can inject terminal escape sequences to manipulate output, spoof filenames, or hijack clipboard, potentially leading to command execution during code review.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- None listed
What is CVE-2026-50642?
CVE-2026-50642 is a medium-severity vulnerability in diff-so-fancy, published on 29 Jul 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
diff‑so‑fancy does not properly sanitize non‑SGR terminal control sequences before outputting diff data. The application only strips ANSI SGR sequences while allowing other control characters, including carriage return (\r) and escape sequences (e.g., OSC, CSI), to pass through unsanitized.
An attacker can embed malicious control sequences in filenames, diff metadata, or file content that are rendered directly in the terminal during diff viewing. This can lead to output manipulation, including filename spoofing, terminal screen clearing, and clipboard injection via supported escape sequences.
Successful exploitation may mislead users during code review, alter terminal state, or result in unintended command execution through clipboard hijacking.
This issue has been fixed in the commit 9c81294
Weakness: CWE-116
Which versions are affected by CVE-2026-50642?
How do I fix CVE-2026-50642?
No fix has been published for CVE-2026-50642 yet. Limit exposure of the affected software until one is available.
Is CVE-2026-50642 being exploited?
There is no known exploitation of CVE-2026-50642 in the wild and no public exploit code.
Sources
Also known as GHSA-q6jf-93cp-9xwf.