# CVE-2026-50642: Terminal Escape Injection in diff‑so‑fancy

- Severity: Medium 4.8 (CVSS:4.0, scored by CERT-PL) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.30%, higher than 24% of CVEs (2026-12-01)
- Published: 2026-07-29T09:46:07.962Z
- Modified: 2026-10-23T23:10:00.157Z
- Weaknesses: CWE-116
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: CERT-PL

## 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

(As written by CVE List.)

## Affected

- so-fancy diff-so-fancy: up to 1.4.10

## References

- <https://cert.pl/posts/2026/07/CVE-2026-41874/> (third-party-advisory)
- <https://github.com/so-fancy/diff-so-fancy> (product)

## Sources

- CVE List: [CVE-2026-50642](https://www.cve.org/CVERecord?id=CVE-2026-50642), CVE Terms of Use, modified 2026-07-29
- NVD: [CVE-2026-50642](https://nvd.nist.gov/vuln/detail/CVE-2026-50642), Public domain, modified 2026-10-23

---

Page: https://cve.day/CVE-2026-50642 · Whole record: https://cve.day/CVE-2026-50642.json · Rebuilt by cve.day 2026-11-25T22:59:30.427Z
