Cloudanix VulnDB

CVE-2022-4515

High · 7.8

CVSS

7.8

EPSS

0.6%

Published

Dec 20, 2022

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A code-tagging tool can be tricked into running attacker-chosen commands when given a specially crafted file name on the command line or in its settings.

Exploit Available
Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Low
Impact
Full Compromise
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

A crafted tag filename passed via the -o option or configuration file triggers unsafe system(3) invocation inside externalSortTags() in sort.c, resulting in arbitrary command execution.

Why it matters to the business

Attackers can run arbitrary commands on developer or build systems that invoke exuberant ctags, potentially leading to source code theft, build pipeline compromise, or lateral movement; the issue remains unpatched in listed distributions and affects widely used open-source tooling.

How an attack unfolds

An attacker supplies a malicious filename containing shell metacharacters through the command line or a ctags configuration file; when ctags processes tags and calls externalSortTags(), the embedded system(3) call executes the attacker-supplied commands with the privileges of the invoking user or process.

How to fix it

Migrate from unmaintained exuberant ctags to universal-ctags; if migration is impossible, avoid passing untrusted input to the -o option and do not allow user-controlled values in ctags configuration files.

How to confirm the fix worked

Run ctags --version to confirm the exuberant variant is present; test in an isolated environment that a filename containing shell metacharacters is no longer executed when supplied via -o.

Typical attack path

  1. Create a filename containing shell metacharacters and desired commands
  2. Invoke exuberant ctags with the -o option or place the filename in a .ctags configuration file
  3. Trigger tag sorting so externalSortTags() executes the system(3) call
  4. Commands run under the privileges of the ctags process

How to detect it

Search process execution logs and shell history for ctags invocations whose -o argument contains shell metacharacters such as ; | & or $(); correlate with subsequent unexpected command execution or file creation by the same user context.

  • ctags -o.*[;&|`$]
  • externalSortTags
  • ctags.*\.ctags.*command

What your security team should do

  • Inventory all uses of exuberant ctags across build pipelines and developer workstations
  • Block or sanitize any user-supplied values passed to the -o option
  • Replace exuberant ctags with universal-ctags in all supported distributions
  • Add runtime restrictions or sandboxing around ctags invocations until replacement is complete

The record

A flaw was found in Exuberant Ctags in the way it handles the "-o" option. This option specifies the tag filename. A crafted tag filename specified in the command line or in the configuration file results in arbitrary command execution because the externalSortTags() in sort.c calls the system(3) function in an unsafe way.

Affected packages

Ecosystem Package Introduced Fixed
AlmaLinux:8 ctags 0 5.8-23.el8
AlmaLinux:8 ctags-etags 0 5.8-23.el8
Debian:10 exuberant-ctags 0 1:5.9~svn20110310-12+deb10u1
Debian:11 exuberant-ctags 0 1:5.9~svn20110310-14+deb11u1
Debian:12 exuberant-ctags 0 1:5.9~svn20110310-18
Debian:13 exuberant-ctags 0 1:5.9~svn20110310-18
Mageia:8 ctags 0 5.8-15.1.mga8
Red Hat:enterprise_linux:8::appstream ctags 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::appstream ctags-debuginfo 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::appstream ctags-debugsource 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::appstream ctags-etags 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::crb ctags 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::crb ctags-debuginfo 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::crb ctags-debugsource 0 0:5.8-23.el8
Red Hat:enterprise_linux:8::crb ctags-etags 0 0:5.8-23.el8
SUSE:Enterprise Storage 6 ctags 0 5.8-150000.3.3.1
SUSE:Enterprise Storage 7 ctags 0 5.8-150000.3.3.1
SUSE:Enterprise Storage 7.1 ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Module for Development Tools 15 SP4 ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Real Time 15 SP3 ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Server 12 SP2-BCL ctags 0 5.8-8.3.1
SUSE:Linux Enterprise Server 12 SP4-LTSS ctags 0 5.8-8.3.1
SUSE:Linux Enterprise Server 12 SP5 ctags 0 5.8-8.3.1
SUSE:Linux Enterprise Server 15 SP1-LTSS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Server 15 SP2-LTSS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Server 15 SP3-LTSS ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP4 ctags 0 5.8-8.3.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP5 ctags 0 5.8-8.3.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP1 ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP2 ctags 0 5.8-150000.3.3.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 ctags 0 5.8-150000.3.3.1
SUSE:OpenStack Cloud 9 ctags 0 5.8-8.3.1
SUSE:OpenStack Cloud Crowbar 9 ctags 0 5.8-8.3.1
Ubuntu:18.04:LTS exuberant-ctags 0 1:5.9~svn20110310-11ubuntu0.1
Ubuntu:20.04:LTS exuberant-ctags 0 1:5.9~svn20110310-12ubuntu0.1
Ubuntu:22.04:LTS exuberant-ctags 0 1:5.9~svn20110310-16ubuntu0.22.04.1
Ubuntu:Pro:16.04:LTS exuberant-ctags 0 1:5.9~svn20110310-11ubuntu0.1~esm1
openSUSE:Leap 15.4 ctags 0 5.8-150000.3.3.1
openSUSE:Tumbleweed ctags 0 5.8-12.1

Related vulnerabilities