CVE-2024-32487: n/a
less through 653 allows OS command execution via a newline character in the name of a file, because quoting is mishandled in filename.c. Exploitation typically requires use with attacker-controlled file names, such as the files extracted from an untrusted archive. Exploitation also requires the LESSOPEN environment variable, but this is set by default in many common cases.
AI Analysis
Technical Summary
CVE-2024-32487 is a command injection vulnerability found in the less pager utility, specifically in versions up to 653. The root cause lies in improper handling of quoting in the filename.c source file, which allows an attacker to inject OS commands via a newline character embedded in a filename. When less processes such a filename, it fails to properly sanitize or escape the input, leading to execution of arbitrary commands. Exploitation requires the attacker to control filenames, commonly achieved by providing malicious files within an untrusted archive that the victim opens using less. Additionally, the LESSOPEN environment variable must be set, which is often the case by default in many Linux distributions to enable preprocessing of files before viewing. The vulnerability is classified under CWE-96 (Improper Control of Filename for Include/Require Statement in PHP, but here it applies to command injection via filename handling). The CVSS v3.1 score is 8.6, indicating a high severity with attack vector local, low attack complexity, no privileges required, user interaction required, scope changed, and high impact on confidentiality, integrity, and availability. No patches have been linked yet, and no known exploits are reported in the wild, but the risk remains significant due to the ease of exploitation when conditions are met.
Potential Impact
The vulnerability allows attackers to execute arbitrary OS commands with the privileges of the user running less, which can lead to full system compromise, data theft, or destruction. Since less is widely used on Unix-like systems for viewing files, including logs and archives, this vulnerability can be leveraged to escalate local access or execute code remotely if combined with other attack vectors (e.g., tricking users into opening malicious archives). The impact spans confidentiality (unauthorized data access), integrity (modification or deletion of files), and availability (disruption of services). Organizations that process untrusted archives or files using less are at risk, especially in environments where users have elevated privileges or where less is used in automated scripts. The lack of required privileges for exploitation and the common default setting of LESSOPEN increase the attack surface. Although no exploits are currently known in the wild, the vulnerability's characteristics suggest it could be weaponized quickly.
Mitigation Recommendations
1. Avoid opening untrusted archives or files with less until a patch is available. 2. Disable or unset the LESSOPEN environment variable in environments where untrusted files may be viewed to prevent preprocessing that triggers the vulnerability. 3. Use alternative file viewers or pagers that do not have this vulnerability when handling untrusted content. 4. Monitor for updates from less maintainers and apply patches promptly once released. 5. Implement strict file validation and sanitization policies before processing archives or files with less. 6. Educate users about the risks of opening files from untrusted sources, especially archives that may contain malicious filenames. 7. Employ endpoint detection and response (EDR) tools to detect suspicious command execution patterns related to less usage. 8. Restrict user privileges to minimize the impact of potential exploitation.
Affected Countries
United States, Germany, United Kingdom, France, Japan, South Korea, India, China, Canada, Australia
CVE-2024-32487: n/a
Description
less through 653 allows OS command execution via a newline character in the name of a file, because quoting is mishandled in filename.c. Exploitation typically requires use with attacker-controlled file names, such as the files extracted from an untrusted archive. Exploitation also requires the LESSOPEN environment variable, but this is set by default in many common cases.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2024-32487 is a command injection vulnerability found in the less pager utility, specifically in versions up to 653. The root cause lies in improper handling of quoting in the filename.c source file, which allows an attacker to inject OS commands via a newline character embedded in a filename. When less processes such a filename, it fails to properly sanitize or escape the input, leading to execution of arbitrary commands. Exploitation requires the attacker to control filenames, commonly achieved by providing malicious files within an untrusted archive that the victim opens using less. Additionally, the LESSOPEN environment variable must be set, which is often the case by default in many Linux distributions to enable preprocessing of files before viewing. The vulnerability is classified under CWE-96 (Improper Control of Filename for Include/Require Statement in PHP, but here it applies to command injection via filename handling). The CVSS v3.1 score is 8.6, indicating a high severity with attack vector local, low attack complexity, no privileges required, user interaction required, scope changed, and high impact on confidentiality, integrity, and availability. No patches have been linked yet, and no known exploits are reported in the wild, but the risk remains significant due to the ease of exploitation when conditions are met.
Potential Impact
The vulnerability allows attackers to execute arbitrary OS commands with the privileges of the user running less, which can lead to full system compromise, data theft, or destruction. Since less is widely used on Unix-like systems for viewing files, including logs and archives, this vulnerability can be leveraged to escalate local access or execute code remotely if combined with other attack vectors (e.g., tricking users into opening malicious archives). The impact spans confidentiality (unauthorized data access), integrity (modification or deletion of files), and availability (disruption of services). Organizations that process untrusted archives or files using less are at risk, especially in environments where users have elevated privileges or where less is used in automated scripts. The lack of required privileges for exploitation and the common default setting of LESSOPEN increase the attack surface. Although no exploits are currently known in the wild, the vulnerability's characteristics suggest it could be weaponized quickly.
Mitigation Recommendations
1. Avoid opening untrusted archives or files with less until a patch is available. 2. Disable or unset the LESSOPEN environment variable in environments where untrusted files may be viewed to prevent preprocessing that triggers the vulnerability. 3. Use alternative file viewers or pagers that do not have this vulnerability when handling untrusted content. 4. Monitor for updates from less maintainers and apply patches promptly once released. 5. Implement strict file validation and sanitization policies before processing archives or files with less. 6. Educate users about the risks of opening files from untrusted sources, especially archives that may contain malicious filenames. 7. Employ endpoint detection and response (EDR) tools to detect suspicious command execution patterns related to less usage. 8. Restrict user privileges to minimize the impact of potential exploitation.
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- mitre
- Date Reserved
- 2024-04-13T00:00:00.000Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 699f6c37b7ef31ef0b5613f7
Added to database: 2/25/2026, 9:40:07 PM
Last enriched: 2/28/2026, 2:40:15 AM
Last updated: 4/12/2026, 3:42:29 PM
Views: 12
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.