Cloudanix VulnDB

CVE-2024-39331

Critical · 9.8

CVSS

9.8

EPSS

1.3%

Published

Jun 23, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in how Emacs handles certain links in documents lets attackers run any command they want on a computer simply by getting someone to open a specially made file.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Low
Impact
Full Compromise
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

The vulnerability allows org-link-expand-abbrev to invoke arbitrary unsafe Elisp functions (such as shell-command-to-string) when expanding %(...) link abbreviations, bypassing intended safety checks and enabling remote command execution.

Why it matters to the business

Attackers can run arbitrary commands on systems processing Org documents, leading to full system compromise, data theft, or ransomware deployment with minimal attacker effort and no user interaction required.

How an attack unfolds

An attacker crafts a malicious Org-mode link containing a %(...) abbreviation that references an unsafe function. When the victim opens or exports the document in vulnerable Emacs/Org-mode, the link expansion executes the function, resulting in command injection. The flaw affects any downstream consumers of Org files or Emacs configurations.

How to fix it

Upgrade Emacs to 29.4 or later and Org Mode to 9.7.5 or later. For Debian 11 apply emacs 1:27.1+1-3.1+deb11u5 and org-mode 9.4.0+dfsg-1+deb11u3; for Debian 12 apply emacs 1:28.2+1-15+deb12u3. For ossrs/srs apply commit 244ce7bc013a0b805274a65132a2980680ba6b9d. Disable Org link abbreviation expansion or restrict file sources until patched.

How to confirm the fix worked

Confirm Emacs version is at least 29.4 and Org Mode at least 9.7.5; test that %(...) abbreviations referencing unsafe functions are rejected or sanitized; review package manager output for the listed fixed Debian versions or commit hash.

Typical attack path

  1. Attacker creates or modifies an Org file containing a crafted %(...) link abbreviation referencing an unsafe function.
  2. Victim opens the file in Emacs or triggers Org export/linking operations.
  3. org-link-expand-abbrev evaluates the unsafe function without restriction.
  4. Arbitrary commands execute on the host with the privileges of the Emacs process.

How to detect it

Search Emacs process logs, Org export logs, and shell history for invocations of shell-command-to-string or similar unsafe functions triggered during link expansion; inspect recently opened Org files for unusual %(...) patterns.

  • %(
  • shell-command-to-string
  • org-link-expand-abbrev

What your security team should do

  • Immediately apply the listed fixed package versions or commit across all Emacs and Org-mode installations.
  • Scan Org files and repositories for suspicious %(...) link abbreviations.
  • Restrict opening of untrusted Org documents until patches are deployed.
  • Monitor EPSS trend and reassess if exploitation activity increases.

The record

In Emacs before 29.4, org-link-expand-abbrev in lisp/ol.el expands a %(...) link abbrev even when it specifies an unsafe function, such as shell-command-to-string. This affects Org Mode before 9.7.5.

Affected packages

Ecosystem Package Introduced Fixed
AlmaLinux:8 emacs 0 1:26.1-12.el8_10
AlmaLinux:8 emacs-common 0 1:26.1-12.el8_10
AlmaLinux:8 emacs-filesystem 0 1:26.1-12.el8_10
AlmaLinux:8 emacs-lucid 0 1:26.1-12.el8_10
AlmaLinux:8 emacs-nox 0 1:26.1-12.el8_10
AlmaLinux:8 emacs-terminal 0 1:26.1-12.el8_10
AlmaLinux:9 emacs 0 1:27.2-10.el9_4
AlmaLinux:9 emacs-common 0 1:27.2-10.el9_4
AlmaLinux:9 emacs-filesystem 0 1:27.2-10.el9_4
AlmaLinux:9 emacs-lucid 0 1:27.2-10.el9_4
AlmaLinux:9 emacs-nox 0 1:27.2-10.el9_4
Debian:10 emacs 0 1:26.1+1-3.2+deb10u6
Debian:10 org-mode 0 9.1.14+dfsg-3+deb10u3
Debian:11 emacs 0 1:27.1+1-3.1+deb11u5
Debian:11 org-mode 0 9.4.0+dfsg-1+deb11u3
Debian:12 emacs 0 1:28.2+1-15+deb12u3
Debian:12 org-mode 0 No fix
Debian:13 emacs 0 1:29.4+1-1
Debian:13 org-mode 0 9.7.5+dfsg-1
Debian:14 emacs 0 1:29.4+1-1
Debian:14 org-mode 0 9.7.5+dfsg-1
Mageia:9 emacs 0 29.4-1.mga9
Red Hat:enterprise_linux:8::appstream emacs 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-common 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-common-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-debugsource 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-filesystem 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-lucid 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-lucid-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-nox 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-nox-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::appstream emacs-terminal 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-common 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-common-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-debugsource 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-filesystem 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-lucid 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-lucid-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-nox 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-nox-debuginfo 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:8::baseos emacs-terminal 0 1:26.1-12.el8_10
Red Hat:enterprise_linux:9::appstream emacs 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-common 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-common-debuginfo 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-debuginfo 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-debugsource 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-filesystem 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-lucid 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-lucid-debuginfo 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-nox 0 1:27.2-10.el9_4
Red Hat:enterprise_linux:9::appstream emacs-nox-debuginfo 0 1:27.2-10.el9_4
Red Hat:rhel_aus:8.6::appstream emacs 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-common 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-common-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-debugsource 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-filesystem 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-lucid 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-lucid-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-nox 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-nox-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::appstream emacs-terminal 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-common 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-common-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-debugsource 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-filesystem 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-lucid 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-lucid-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-nox 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-nox-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_aus:8.6::baseos emacs-terminal 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-common 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-common-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-debugsource 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-filesystem 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-lucid 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-lucid-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-nox 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-nox-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::appstream emacs-terminal 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-common 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-common-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-debugsource 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-filesystem 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-lucid 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-lucid-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-nox 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-nox-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_e4s:8.6::baseos emacs-terminal 0 1:26.1-7.el8_6.5
Red Hat:rhel_eus:8.8::appstream emacs 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-common 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-common-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-debugsource 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-filesystem 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-lucid 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-lucid-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-nox 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-nox-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::appstream emacs-terminal 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-common 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-common-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-debugsource 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-filesystem 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-lucid 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-lucid-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-nox 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-nox-debuginfo 0 1:26.1-10.el8_8.6
Red Hat:rhel_eus:8.8::baseos emacs-terminal 0 1:26.1-10.el8_8.6
Red Hat:rhel_tus:8.6::appstream emacs 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-common 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-common-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-debugsource 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-filesystem 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-lucid 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-lucid-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-nox 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-nox-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::appstream emacs-terminal 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-common 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-common-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-debugsource 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-filesystem 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-lucid 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-lucid-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-nox 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-nox-debuginfo 0 1:26.1-7.el8_6.5
Red Hat:rhel_tus:8.6::baseos emacs-terminal 0 1:26.1-7.el8_6.5
SUSE:Enterprise Storage 7.1 emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise Module for Basesystem 15 SP5 emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise Module for Desktop Applications 15 SP5 emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise Module for Desktop Applications 15 SP6 emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise Server 12 SP5 emacs 0 24.3-25.20.1
SUSE:Linux Enterprise Server 15 SP2-LTSS emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise Server 15 SP3-LTSS emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise Server 15 SP4-LTSS emacs 0 27.2-150400.3.17.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP5 emacs 0 24.3-25.20.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP2 emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP3 emacs 0 25.3-150000.3.22.1
SUSE:Linux Enterprise Server for SAP Applications 15 SP4 emacs 0 27.2-150400.3.17.1
SUSE:Manager Proxy 4.3 emacs 0 27.2-150400.3.17.1
SUSE:Manager Server 4.3 emacs 0 27.2-150400.3.17.1
Ubuntu:16.04:LTS xemacs21 0 No fix
Ubuntu:16.04:LTS xemacs21-packages 0 No fix
Ubuntu:18.04:LTS xemacs21 0 No fix
Ubuntu:18.04:LTS xemacs21-packages 0 No fix
Ubuntu:20.04:LTS emacs 0 No fix
Ubuntu:20.04:LTS org-mode 0 No fix
Ubuntu:20.04:LTS xemacs21 0 No fix
Ubuntu:20.04:LTS xemacs21-packages 0 No fix
Ubuntu:22.04:LTS emacs 0 No fix
Ubuntu:22.04:LTS emacs 0 1:27.1+1-3ubuntu5.2
Ubuntu:22.04:LTS org-mode 0 No fix
Ubuntu:22.04:LTS xemacs21 0 No fix
Ubuntu:22.04:LTS xemacs21-packages 0 No fix
Ubuntu:24.04:LTS emacs 0 No fix
Ubuntu:24.04:LTS org-mode 0 No fix
Ubuntu:24.04:LTS xemacs21 0 No fix
Ubuntu:24.04:LTS xemacs21-packages 0 No fix
Ubuntu:24.10 org-mode 0 No fix
Ubuntu:24.10 xemacs21 0 No fix
Ubuntu:24.10 xemacs21-packages 0 No fix
Ubuntu:25.04 xemacs21 0 No fix
Ubuntu:25.04 xemacs21-packages 0 No fix
Ubuntu:25.10 xemacs21 0 No fix
Ubuntu:25.10 xemacs21-packages 0 No fix
Ubuntu:Pro:16.04:LTS emacs24 0 No fix
Ubuntu:Pro:16.04:LTS emacs24 0 24.5+1-6ubuntu1.1+esm4
Ubuntu:Pro:16.04:LTS org-mode 0 No fix
Ubuntu:Pro:16.04:LTS org-mode 0 8.3.3-2ubuntu0.1~esm1
Ubuntu:Pro:16.04:LTS xemacs21 0 No fix
Ubuntu:Pro:16.04:LTS xemacs21-packages 0 No fix
Ubuntu:Pro:18.04:LTS emacs25 0 No fix
Ubuntu:Pro:18.04:LTS emacs25 0 25.2+1-6ubuntu0.1~esm2
Ubuntu:Pro:18.04:LTS org-mode 0 No fix
Ubuntu:Pro:18.04:LTS org-mode 0 9.1.6+dfsg-1ubuntu0.1~esm1
Ubuntu:Pro:18.04:LTS xemacs21 0 No fix
Ubuntu:Pro:18.04:LTS xemacs21-packages 0 No fix
Ubuntu:Pro:20.04:LTS emacs 0 1:26.3+1-1ubuntu2+esm1
Ubuntu:Pro:20.04:LTS org-mode 0 9.3.1+dfsg-1ubuntu0.1~esm1
Ubuntu:Pro:20.04:LTS xemacs21 0 No fix

Related vulnerabilities