CVE-2026-50642
Terminal Escape Injection in diff‑so‑fancy
- State
- Published
- Severity
- 4.8 Medium
- Published
- Jul 29, 2026
- Updated
- Jul 29, 2026
- Reserved
- Jun 5, 2026
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
Scores
| CVSS | Score | Vector | Source |
|---|---|---|---|
| 4.0 | 4.8 Medium | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:L/SA:N | CERT-PL |
Weaknesses
- CWE-116 Improper Encoding or Escaping of Output
Affected Products
| Product | Versions |
|---|---|
diff-so-fancyso-fancy |
|
References
- https://cert.pl/posts/2026/07/CVE-2026-41874/third-party-advisory
- https://github.com/so-fancy/diff-so-fancyproduct
Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.