Cloudanix VulnDB

CVE-2022-48624

High · 7.8

CVSS

7.8

EPSS

1.1%

Published

Feb 19, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A common file viewer tool can be tricked into running attacker-chosen commands on a computer if a certain setting is present, allowing someone already on the system to gain more control.

Exploitation
Local Privilege
Attacker needs
Low Privilege
Complexity
Low
Impact
Full Compromise
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The vulnerability allows local command injection because close_altfile in filename.c omits shell_quote when constructing the command from the LESSCLOSE environment variable, enabling arbitrary shell commands to execute with the privileges of the less process upon file close.

Why it matters to the business

Attackers with local access can run unauthorized commands on systems using affected less versions, potentially leading to data theft, system compromise, or lateral movement; widespread use of less in scripts and developer workflows increases exposure across many environments.

How an attack unfolds

An attacker with local access sets the LESSCLOSE environment variable to a malicious payload that includes unquoted commands, invokes less to open a file, and triggers close_altfile on exit so the shell executes the injected commands without sanitization.

How to fix it

Upgrade gwsw/less to the commit c6ac6de49698be84d264a0c4c0c40bb870b10144 or later versions that include shell_quote calls for LESSCLOSE; rebuild packages and redeploy affected systems; avoid setting LESSCLOSE from untrusted sources until patched.

How to confirm the fix worked

Confirm the installed less binary or source contains commit c6ac6de49698be84d264a0c4c0c40bb870b10144; test by setting a benign LESSCLOSE value and verifying no unexpected command execution occurs on file close.

Typical attack path

  1. Obtain local access or influence over a user environment running less
  2. Set LESSCLOSE to a command string containing shell metacharacters and the desired payload
  3. Cause less to open then close a file (for example via a script or interactive session)
  4. Execute arbitrary commands via the unsanitized LESSCLOSE invocation

How to detect it

Review shell history, process creation logs, and environment variable dumps for unusual LESSCLOSE values; inspect less invocations in audit logs or strace output for unexpected command execution immediately after file close operations.

  • LESSCLOSE=.*[;&|`$]
  • less.*close_altfile

What your security team should do

  • Prioritize patching gwsw/less to the fixed commit across all systems and containers
  • Audit scripts and user environments for use of LESSCLOSE and remove or sanitize it
  • Monitor package repositories for updated less builds and enforce version pinning in builds

The record

close_altfile in filename.c in less before 606 omits shell_quote calls for LESSCLOSE.

Affected packages

Ecosystem Package Introduced Fixed
AlmaLinux:8 less 0 530-2.el8_9
AlmaLinux:8 less 0 530-3.el8_10
AlmaLinux:9 less 0 590-3.el9_3
Debian:10 less 0 487-0.1+deb10u1
Debian:11 less 0 551-2+deb11u2
Debian:12 less 0 590-2.1~deb12u2
Debian:13 less 0 590-2.1
Debian:14 less 0 590-2.1
Red Hat:enterprise_linux:8::baseos less 0 0:530-3.el8_10
Red Hat:enterprise_linux:8::baseos less 0 0:530-2.el8_9
Red Hat:enterprise_linux:8::baseos less-debuginfo 0 0:530-3.el8_10
Red Hat:enterprise_linux:8::baseos less-debuginfo 0 0:530-2.el8_9
Red Hat:enterprise_linux:8::baseos less-debugsource 0 0:530-3.el8_10
Red Hat:enterprise_linux:8::baseos less-debugsource 0 0:530-2.el8_9
Red Hat:enterprise_linux:9::baseos less 0 0:590-3.el9_3
Red Hat:enterprise_linux:9::baseos less-debuginfo 0 0:590-3.el9_3
Red Hat:enterprise_linux:9::baseos less-debugsource 0 0:590-3.el9_3
Red Hat:rhel_eus:8.6::baseos less 0 0:530-2.el8_6
Red Hat:rhel_eus:8.6::baseos less-debuginfo 0 0:530-2.el8_6
Red Hat:rhel_eus:8.6::baseos less-debugsource 0 0:530-2.el8_6
Red Hat:rhel_eus:8.8::baseos less 0 0:530-2.el8_8
Red Hat:rhel_eus:8.8::baseos less-debuginfo 0 0:530-2.el8_8
Red Hat:rhel_eus:8.8::baseos less-debugsource 0 0:530-2.el8_8
Rocky Linux:8 less 0 0:530-2.el8_9
Rocky Linux:9 less 0 0:590-3.el9_3
SUSE:Enterprise Storage 7.1 less 0 530-150000.3.6.2
SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS less 0 530-150000.3.6.2
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS less 0 530-150000.3.6.2
SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS less 0 590-150400.3.6.2
SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS less 0 590-150400.3.6.2
SUSE:Linux Enterprise Micro 5.1 less 0 530-150000.3.6.2
SUSE:Linux Enterprise Micro 5.2 less 0 530-150000.3.6.2
SUSE:Linux Enterprise Micro 5.3 less 0 590-150400.3.6.2
SUSE:Linux Enterprise Micro 5.4 less 0 590-150400.3.6.2
SUSE:Linux Enterprise Micro 5.5 less 0 590-150400.3.6.2
SUSE:Linux Enterprise Module for Basesystem 15 SP5 less 0 590-150400.3.6.2
SUSE:Linux Enterprise Server 12 SP5 less 0 458-7.12.1
SUSE:Linux Enterprise Server 15 SP2-LTSS less 0 530-150000.3.6.2
SUSE:Linux Enterprise Server 15 SP3-LTSS less 0 530-150000.3.6.2
SUSE:Linux Enterprise Server 15 SP4-LTSS less 0 590-150400.3.6.2
SUSE:Linux Enterprise Server for SAP Applications 12 SP5 less 0 458-7.12.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP2 less 0 530-150000.3.6.2
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 less 0 530-150000.3.6.2
SUSE:Linux Enterprise Server for SAP Applications 15 SP4 less 0 590-150400.3.6.2
SUSE:Manager Proxy 4.3 less 0 590-150400.3.6.2
SUSE:Manager Server 4.3 less 0 590-150400.3.6.2
Ubuntu:20.04:LTS less 0 551-1ubuntu0.2
Ubuntu:22.04:LTS less 0 590-1ubuntu0.22.04.2
Ubuntu:23.10 less 0 590-2ubuntu0.23.10.1
Ubuntu:24.04:LTS less 0 590-2ubuntu1
Ubuntu:Pro:14.04:LTS less 0 No fix
Ubuntu:Pro:14.04:LTS less 0 458-2ubuntu0.1~esm2
Ubuntu:Pro:16.04:LTS less 0 481-2.1ubuntu0.2+esm1
Ubuntu:Pro:18.04:LTS less 0 487-0.1ubuntu0.1~esm1
openSUSE:Leap 15.5 less 0 590-150400.3.6.2
openSUSE:Leap Micro 5.3 less 0 590-150400.3.6.2
openSUSE:Leap Micro 5.4 less 0 590-150400.3.6.2