CVE-2026-50642: CWE-116 Improper Encoding or Escaping of Output in so-fancy diff-so-fancy
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
AI Analysis
Technical Summary
The vulnerability in diff-so-fancy (CVE-2026-50642) involves improper encoding or escaping of output (CWE-116). The application strips only ANSI SGR sequences but allows other terminal control sequences, including carriage return and escape sequences (OSC, CSI), to pass unsanitized. Attackers can embed these sequences in filenames, diff metadata, or file content, which are then rendered in the terminal, enabling manipulation of terminal output and clipboard injection. This can mislead users during code review or alter terminal state. The vulnerability affects versions up to and including 1.4.10 and has been fixed in a subsequent commit (9c81294).
Potential Impact
An attacker can manipulate terminal output by injecting malicious control sequences, potentially causing filename spoofing, terminal screen clearing, and clipboard hijacking. This may mislead users during code review or cause unintended command execution via clipboard injection. The CVSS score is 4.8 (medium severity), indicating a limited attack vector (local), low complexity, no privileges required, but user interaction is needed.
Mitigation Recommendations
A fix is available and has been implemented in the commit 9c81294. Users should upgrade diff-so-fancy to a version that includes this fix, i.e., any version later than 1.4.10. There is no indication that temporary mitigations or workarounds are provided; upgrading is the recommended remediation.
CVE-2026-50642: CWE-116 Improper Encoding or Escaping of Output in so-fancy diff-so-fancy
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
CVSS v4.0
Score 4.8medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in diff-so-fancy (CVE-2026-50642) involves improper encoding or escaping of output (CWE-116). The application strips only ANSI SGR sequences but allows other terminal control sequences, including carriage return and escape sequences (OSC, CSI), to pass unsanitized. Attackers can embed these sequences in filenames, diff metadata, or file content, which are then rendered in the terminal, enabling manipulation of terminal output and clipboard injection. This can mislead users during code review or alter terminal state. The vulnerability affects versions up to and including 1.4.10 and has been fixed in a subsequent commit (9c81294).
Potential Impact
An attacker can manipulate terminal output by injecting malicious control sequences, potentially causing filename spoofing, terminal screen clearing, and clipboard hijacking. This may mislead users during code review or cause unintended command execution via clipboard injection. The CVSS score is 4.8 (medium severity), indicating a limited attack vector (local), low complexity, no privileges required, but user interaction is needed.
Mitigation Recommendations
A fix is available and has been implemented in the commit 9c81294. Users should upgrade diff-so-fancy to a version that includes this fix, i.e., any version later than 1.4.10. There is no indication that temporary mitigations or workarounds are provided; upgrading is the recommended remediation.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- CERT-PL
- Date Reserved
- 2026-06-05T13:27:10.270Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a69d4879c2644c7f856ba7a
Added to database: 07/29/2026, 10:23:03 UTC
Last enriched: 07/29/2026, 10:39:24 UTC
Last updated: 07/29/2026, 21:33:00 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.