CVE-2026-131959
GNU Emacs 31.1 contains a code injection vulnerability in its handling of directory-local variables. A crafted .dir-locals.el can supply a (REGEXP FUNCTION t) entry in auto-mode-alist; when a matching file is opened, Emacs calls FUNCTION before set-auto-mode--dir-local-valid-p validates it, executing arbitrary Emacs Lisp with the privileges of the Emacs process. (Emacs 30.2 is unaffected.)
What to do
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | emacs | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 26.10 | xemacs21 | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 26.10 | xemacs21-packages | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 26.04 | emacs | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 26.04 | xemacs21 | Under investigation | UBUNTU-CVE-2026-131959 | |
| Ubuntu 26.04 | xemacs21-packages | Under investigation | UBUNTU-CVE-2026-131959 | |
| Ubuntu 24.04 | emacs | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 24.04 | xemacs21 | Under investigation | UBUNTU-CVE-2026-131959 | |
| Ubuntu 24.04 | xemacs21-packages | Under investigation | UBUNTU-CVE-2026-131959 | |
| Ubuntu 22.04 | emacs | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 22.04 | xemacs21 | Under investigation | UBUNTU-CVE-2026-131959 | |
| Ubuntu 22.04 | xemacs21-packages | Under investigation | UBUNTU-CVE-2026-131959 | |
| Ubuntu 20.04 | emacs | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 20.04 | xemacs21 | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 20.04 | xemacs21-packages | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 18.04 | emacs25 | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 18.04 | xemacs21 | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 18.04 | xemacs21-packages | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 16.04 | emacs24 | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 16.04 | xemacs21 | Fix pending | UBUNTU-CVE-2026-131959 | |
| Ubuntu 16.04 | xemacs21-packages | Fix pending | UBUNTU-CVE-2026-131959 | |
| Red Hat Enterprise Linux 10 | emacs | Not affected | ||
| Red Hat Enterprise Linux 10 | emacs-common | Not affected | ||
| Red Hat Enterprise Linux 10 | emacs-filesystem | Not affected | ||
| Red Hat Enterprise Linux 10 | emacs-lucid | Not affected | ||
| Red Hat Enterprise Linux 10 | emacs-nw | Not affected | ||
| Red Hat Enterprise Linux 9 | emacs | Not affected | ||
| Red Hat Enterprise Linux 9 | emacs-common | Not affected | ||
| Red Hat Enterprise Linux 9 | emacs-filesystem | Not affected | ||
| Red Hat Enterprise Linux 9 | emacs-lucid | Not affected | ||
| Red Hat Enterprise Linux 9 | emacs-nox | Not affected | ||
| Red Hat Enterprise Linux 8 | emacs | Not affected | ||
| Red Hat Enterprise Linux 8 | emacs-common | Not affected | ||
| Red Hat Enterprise Linux 8 | emacs-filesystem | Not affected | ||
| Red Hat Enterprise Linux 8 | emacs-lucid | Not affected | ||
| Red Hat Enterprise Linux 8 | emacs-nox | Not affected | ||
| Red Hat Enterprise Linux 8 | emacs-terminal | Not affected | ||
| Red Hat Enterprise Linux 7 | emacs | Not affected | ||
| Red Hat Enterprise Linux 7 | emacs-common | Not affected | ||
| Red Hat Enterprise Linux 7 | emacs-el | Not affected | ||
| Red Hat Enterprise Linux 7 | emacs-filesystem | Not affected | ||
| Red Hat Enterprise Linux 7 | emacs-nox | Not affected | ||
| Red Hat Enterprise Linux 7 | emacs-terminal | Not affected | ||
| Red Hat Enterprise Linux 6 | emacs | Not affected | ||
| Red Hat Enterprise Linux 6 | emacs-common | Not affected | ||
| Red Hat Enterprise Linux 6 | emacs-el | Not affected | ||
| Red Hat Enterprise Linux 6 | emacs-nox | Not affected |
What the vendor says
As published in the CVE record by mitre, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- GNU Emacs: affected: 31.1
Solution: Apply the fix from commit 205ae0b0583dbfe09e258164adbc49e130645221 (emacs-31 branch), or upgrade to Emacs 31.2 or later when released.
Workaround: Do not open files in untrusted directories that contain a .dir-locals.el. Setting enable-dir-local-variables to nil disables directory-local variables.
References
- https://www.openwall.com/lists/oss-security/2026/11/11/7
- https://cgit.git.savannah.gnu.org/cgit/emacs.git/commit/?id=205ae0b0583dbfe09e258164adbc49e130645221
- https://x3r0day.github.io
- https://debbugs.gnu.org/82213
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.