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
Published: 2026-07-29
Score: 4.8 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

diff-so-fancy fails to sanitize non-ANSI SGR control sequences, allowing malicious carriage return and escape characters to survive in filenames, metadata or file contents; when displayed, these sequences are interpreted by the terminal, enabling output manipulation such as filename spoofing, screen clearing, and clipboard injection, which can mislead users during code review or lead to unintended command execution via clipboard hijacking.

Affected Systems

The flaw affects all versions of so-fancy:diff-so-fancy that have not incorporated the fix present in commit 9c81294; no specific version range is disclosed, so any unpatched installation may be vulnerable.

Risk and Exploitability

The CVSS score of 4.8 indicates moderate severity, while the EPSS score of less than 1 % implies a very low likelihood of exploitation; the vulnerability is not listed in the CISA KEV catalog. Likely attack requires local use of the diff-so-fancy CLI where the diff is rendered in a terminal that processes escape sequences; although remote code execution is not directly supported, an attacker can manipulate terminal state or hijack clipboard content.

Generated by OpenCVE AI on August 3, 2026 at 13:29 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade diff-so-fancy to a version that includes commit 9c81294 or later, ensuring that unsanitized control sequences are removed prior to terminal output.
  • If an immediate upgrade is not possible, run diff-so-fancy through a wrapper script that strips carriage return, OSC, and CSI escape characters from the output before it reaches the terminal.
  • Validate file names and content for unexpected control characters before generating a diff, and refrain from diffing untrusted inputs in a terminal environment lacking sequence filtering.

Generated by OpenCVE AI on August 3, 2026 at 13:29 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Thu, 30 Jul 2026 00:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-94
References
Metrics threat_severity

None

cvssV3_1

{'score': 4.4, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L'}

threat_severity

Moderate


Wed, 29 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
First Time appeared So-fancy
So-fancy diff-so-fancy
Vendors & Products So-fancy
So-fancy diff-so-fancy

Wed, 29 Jul 2026 13:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 29 Jul 2026 10:30:00 +0000

Type Values Removed Values Added
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
Title Terminal Escape Injection in diff‑so‑fancy
Weaknesses CWE-116
References
Metrics cvssV4_0

{'score': 4.8, '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'}


Subscriptions

So-fancy Diff-so-fancy
cve-icon MITRE

Status: PUBLISHED

Assigner: CERT-PL

Published:

Updated: 2026-07-29T12:13:51.709Z

Reserved: 2026-06-05T13:27:10.270Z

Link: CVE-2026-50642

cve-icon Vulnrichment

Updated: 2026-07-29T12:13:48.295Z

cve-icon NVD

Status : Deferred

Published: 2026-07-29T11:16:49.617

Modified: 2026-07-30T19:11:24.687

Link: CVE-2026-50642

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-07-29T09:46:07Z

Links: CVE-2026-50642 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-03T13:30:04Z

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')