CVE-2026-145754 in less
Summary
by MITRE • 12/06/2026
less before 713 mishandles escape sequences. less -R is intended to filter escape sequences so that only safe or allow-listed ones reach the terminal. However, nesting an unsafe sequence inside an allowed one allows bypassing the filter, causing the unsafe sequence to reach the terminal and take effect. Whether the escape sequence is then honored depends on the terminal used. NOTE: this issue exists because of a CVE-2022-46663 regression.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 12/06/2026
The vulnerability identified in less versions prior to 713 represents a critical logic flaw within its input sanitization mechanism, specifically affecting how escape sequences are processed when the -R flag is utilized. The less pager utility includes functionality designed to filter out potentially dangerous terminal control characters to prevent malicious code execution or display manipulation via crafted text files. This filtering process relies on an allow-list approach where only specific, deemed safe escape sequences are permitted to pass through to the terminal emulator for rendering. However, this security boundary was compromised due to a regression introduced in CVE-2022-46663, which altered the parsing logic without adequately preserving the integrity of the original safety checks. The core technical flaw lies in how nested or embedded escape sequences are evaluated during the filtering phase.
The operational mechanism of the vulnerability exploits the parser's inability to correctly identify and neutralize unsafe commands when they are concealed within otherwise permitted structures. By nesting an unauthorized or dangerous escape sequence inside a sequence that is explicitly allowed by the filter, an attacker can effectively bypass the security controls intended to sanitize input. The less application processes the outer safe sequence but fails to recursively inspect or strip the inner malicious content before passing it to the terminal emulator. Consequently, the unsafe sequence reaches the final rendering layer of the system, where it may be interpreted and executed depending on the capabilities and configuration of the specific terminal emulator in use. This bypass technique undermines the fundamental purpose of the -R flag, which is to ensure that only safe visual formatting commands are applied while blocking executable or disruptive control codes.
The impact of this vulnerability varies based on the environment but generally poses significant risks related to command injection, display spoofing, and potential remote code execution if combined with other terminal vulnerabilities. An attacker who can influence the content displayed by less, such as through a malicious PDF file viewed via an image viewer that pipes output to less or through phishing emails containing crafted text files, could exploit this flaw. If the target system uses a terminal emulator susceptible to escape sequence injection attacks, the execution of arbitrary commands becomes possible. Even in cases where direct code execution is not feasible, the ability to manipulate terminal display can lead to social engineering attacks, such as tricking users into clicking on spoofed links or misinterpreting critical information due to altered visual output. This aligns with Common Weakness Enumeration CWE-78 Improper Neutralization of Special Elements used in an OS Command and CWE-116 Misinterpretation of Input, highlighting the failure to properly validate complex input structures against security policies.
Mitigation for this issue requires immediate upgrading to less version 713 or later, where the regression has been corrected and the escape sequence filtering logic has been hardened to prevent nesting-based bypasses. Administrators should also consider implementing additional safeguards such as restricting the use of the -R flag in untrusted contexts or employing alternative pagers that do not rely on complex terminal control sequences for rendering. Security teams should audit systems where less is used with user-controlled input, particularly in automated pipelines or web-facing applications that render text content. Awareness training regarding the risks associated with viewing files from unknown sources using interactive tools can further reduce exposure. The fix addresses the root cause by ensuring that all nested escape sequences are subjected to rigorous validation against the allow-list before being passed to the terminal emulator, thereby restoring the intended security boundary and preventing unauthorized control of the display environment.