# CVE-2022-45939: Command injection in n/a

> Attackers can execute arbitrary commands via shell metacharacters in filenames when using the ctags utility in GNU Emacs.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 28 Nov 2022
- **Updated:** 28 Apr 2025
- **Also known as:** ALSA-2023:2366, ALSA-2023:3042, AZL-11515, CLEANSTART-2024-MU53780, CLSA-2024-1728055873, DEBIAN-CVE-2022-45939, DLA-3257-1, DSA-5314-1, GHSA-m57w-hf24-4j3h, MGASA-2022-0457, OESA-2022-2131, RHSA-2023:2366, RHSA-2023:3042, SUSE-SU-2022:4304-1, SUSE-SU-2022:4305-1, SUSE-SU-2022:4310-1, UBUNTU-CVE-2022-45939, USN-5781-1, openSUSE-SU-2024:12541-1

## What is CVE-2022-45939?

CVE-2022-45939 is a high-severity command injection vulnerability in Debian Debian Linux, published on 28 Nov 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

GNU Emacs through 28.2 allows attackers to execute commands via shell metacharacters in the name of a source-code file, because lib-src/etags.c uses the system C library function in its implementation of the ctags program. For example, a victim may use the "ctags *" command (suggested in the ctags documentation) in a situation where the current working directory has contents that depend on untrusted input.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

## Which versions are affected by CVE-2022-45939?

It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `emacs` | AlmaLinux:8 | All versions | 1:26.1-9.el8 |
| `emacs-common` | AlmaLinux:8 | All versions | 1:26.1-9.el8 |
| `emacs-filesystem` | AlmaLinux:8 | All versions | 1:26.1-9.el8 |
| `emacs-lucid` | AlmaLinux:8 | All versions | 1:26.1-9.el8 |
| `emacs-nox` | AlmaLinux:8 | All versions | 1:26.1-9.el8 |
| `emacs-terminal` | AlmaLinux:8 | All versions | 1:26.1-9.el8 |
| `emacs` | AlmaLinux:9 | All versions | 1:27.2-8.el9 |
| `emacs-common` | AlmaLinux:9 | All versions | 1:27.2-8.el9 |
| `emacs-filesystem` | AlmaLinux:9 | All versions | 1:27.2-8.el9 |
| `emacs-lucid` | AlmaLinux:9 | All versions | 1:27.2-8.el9 |
| `emacs-nox` | AlmaLinux:9 | All versions | 1:27.2-8.el9 |
| `emacs` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-common` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-common-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-lucid` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-lucid-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-nox` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-nox-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs-terminal` | Red Hat:enterprise_linux:8::appstream | All versions | 1:26.1-9.el8 |
| `emacs` | Red Hat:enterprise_linux:8::baseos | All versions | 1:26.1-9.el8 |
| `emacs-filesystem` | Red Hat:enterprise_linux:8::baseos | All versions | 1:26.1-9.el8 |
| `emacs` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-common` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-common-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-filesystem` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-lucid` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-lucid-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-nox` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs-nox-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 1:27.2-8.el9 |
| `emacs` | SUSE:Enterprise Storage 6 | All versions | 25.3-150000.3.12.1 |
| `emacs` | SUSE:Enterprise Storage 7 | All versions | 25.3-150000.3.12.1 |
| `emacs` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 25.3-150000.3.12.1 |
| `emacs` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 25.3-150000.3.12.1 |
| `emacs` | SUSE:Linux Enterprise High Performance Computing 15 SP2-ESPOS | All versions | 25.3-150000.3.12.1 |
| `emacs` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 25.3-150000.3.12.1 |
| `emacs` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 25.3-150000.3.12.1 |

Products: Debian Debian Linux, Fedoraproject Fedora, Gnu Emacs.

## How do I fix CVE-2022-45939?

Apply the vendor's patch.

## Is CVE-2022-45939 being exploited?

There is no known exploitation of CVE-2022-45939 in the wild and no public exploit code.

## Other vulnerabilities in Debian Debian Linux

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-45939 and fix it if it is affected.

What it is: CVE-2022-45939 is a high-severity command injection vulnerability in Debian Debian Linux, published on 28 Nov 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2022-45939 in the wild and no public exploit code.

Affected product: Debian Debian Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-45939/ (Markdown: https://insights.sbomify.com/CVE-2022-45939/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-45939
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-45939
- OSV: https://osv.dev/vulnerability/CVE-2022-45939

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-45939/
Summaries are generated and may contain mistakes; the official description above is the record.
