Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-45939

CVE-2022-45939: GNU Emacs Command Injection Vulnerability

CVE-2022-45939 is a command injection flaw in GNU Emacs ctags that allows attackers to execute arbitrary commands via shell metacharacters in filenames. This article covers technical details, affected versions, and mitigations.

Published: February 18, 2026

CVE-2022-45939 Overview

CVE-2022-45939 is a command injection vulnerability in GNU Emacs through version 28.2. The vulnerability allows attackers to execute arbitrary commands via shell metacharacters embedded in the name of a source-code file. This occurs because lib-src/etags.c uses the system() C library function in its implementation of the ctags program. A typical exploitation scenario involves a victim executing the commonly suggested ctags * command in a directory containing maliciously crafted filenames that depend on untrusted input.

Critical Impact

Attackers can achieve arbitrary command execution on systems where users run ctags on directories containing malicious filenames, potentially leading to full system compromise.

Affected Products

  • GNU Emacs through version 28.2
  • Debian Linux 10.0 and 11.0
  • Fedora 36 and 37

Discovery Timeline

  • 2022-11-28 - CVE-2022-45939 published to NVD
  • 2025-04-28 - Last updated in NVD database

Technical Details for CVE-2022-45939

Vulnerability Analysis

This vulnerability falls under CWE-78 (Improper Neutralization of Special Elements used in an OS Command), commonly known as OS Command Injection. The root issue lies in how the ctags program, distributed as part of GNU Emacs, processes filenames when generating tag files for source code navigation.

When a user executes ctags * in a directory—a common workflow suggested in the official ctags documentation—the program passes each filename through the system() C library function without proper sanitization. This creates a dangerous condition where shell metacharacters embedded in filenames are interpreted by the shell, allowing an attacker to inject and execute arbitrary commands.

The attack requires local access or the ability to influence filenames in a directory where a user might run ctags, such as through downloaded archives, shared repositories, or user-uploaded content.

Root Cause

The vulnerability stems from the unsafe use of the system() C library function within lib-src/etags.c. The system() function spawns a shell to execute the provided command string, which means any shell metacharacters (such as ;, |, $(), backticks, etc.) in the filename will be interpreted as shell commands rather than literal characters.

Secure alternatives such as execve() or proper input sanitization were not employed, leaving the program vulnerable to command injection through specially crafted filenames.

Attack Vector

The attack requires local access to the system and user interaction—specifically, the victim must run the ctags command in a directory containing attacker-controlled filenames. An attacker could exploit this by:

  1. Creating a file with a malicious name containing shell metacharacters (e.g., file;id;.c or $(malicious_command).c)
  2. Placing the file in a directory where a developer is likely to run ctags *
  3. When the victim executes ctags, the shell metacharacters in the filename are interpreted, executing the injected commands with the user's privileges

This attack vector is particularly effective in shared development environments, repositories with contributed code, or any scenario where users process files from untrusted sources.

Detection Methods for CVE-2022-45939

Indicators of Compromise

  • Unusual process spawns originating from the ctags process
  • Files with shell metacharacters in their names (;, |, $(), backticks) in source code directories
  • Unexpected command execution in directories where developers run ctags
  • Log entries showing shell command execution from etags or ctags processes

Detection Strategies

  • Monitor file creation events for filenames containing shell metacharacters in development directories
  • Implement endpoint detection rules for suspicious process trees where ctags spawns unexpected child processes
  • Audit systems running GNU Emacs versions 28.2 or earlier for the vulnerable ctags binary
  • Use SentinelOne's behavioral AI to detect anomalous command execution patterns from development tools

Monitoring Recommendations

  • Enable process monitoring to track parent-child relationships for ctags and etags processes
  • Configure alerts for unusual shell command execution in development environments
  • Review file integrity monitoring for suspicious filenames in shared repositories
  • Implement runtime application self-protection (RASP) for development workstations

How to Mitigate CVE-2022-45939

Immediate Actions Required

  • Upgrade GNU Emacs to a patched version that addresses this vulnerability
  • Avoid running ctags * on directories containing files from untrusted sources
  • Audit existing directories for files with suspicious shell metacharacter-laden filenames
  • Consider using alternative ctags implementations that do not use system() for file processing

Patch Information

GNU has released a security patch to address this vulnerability. The fix is available in the GNU Emacs Commit Update. Distribution-specific patches are available through:

  • Debian Security Advisory DSA-5314
  • Debian LTS Announcement
  • Fedora package updates for versions 36 and 37

Workarounds

  • Use explicit file lists instead of wildcards when running ctags
  • Manually inspect filenames before processing directories with ctags
  • Run ctags in a sandboxed environment when processing untrusted code
  • Consider using Exuberant Ctags or Universal Ctags as alternatives if patching is not immediately possible
bash
# Safer ctags usage - explicitly list files instead of using wildcards
find . -name "*.c" -print0 | xargs -0 ctags
# Or validate filenames before processing
for f in *.c; do
    if [[ "$f" =~ ^[a-zA-Z0-9_.-]+$ ]]; then
        ctags "$f"
    fi
done

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechGnu Emacs

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.04%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-78
  • Technical References
  • Debian LTS Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Debian Security Advisory DSA-5314
  • Vendor Resources
  • GNU Emacs Commit Update
  • Related CVEs
  • CVE-2024-53920: GNU Emacs RCE Vulnerability

  • CVE-2024-39331: GNU Emacs Org Mode RCE Vulnerability

  • CVE-2026-6861: GNU Emacs Memory Corruption DoS Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English