1. Home
  2. Vulnerabilities
  3. CVE-2026-131959

CVE-2026-131959

GNU Emacs 31.1 contains a code injection vulnerability in its handling of directory-local variables. A…

Published 18 Nov 2026 · modified 18 Nov 2026 · Sources: NVD, CNA (vendor or assigner), EPSS (FIRST)

Low 33/100

Summary

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.)

Affected products and versions

Gnu (1 line(s))
Gnu
ProductVersionsFixed inSource
Emacs 31.1 — CNA (vendor or assigner)

Fix

Patchofficial source

Apply the fix from commit 205ae0b0583dbfe09e258164adbc49e130645221 (emacs-31 branch), or upgrade to Emacs 31.2 or later when released.

Source : CNA (vendor or assigner)

Workaround

Workaroundofficial source

Do not open files in untrusted directories that contain a .dir-locals.el. Setting enable-dir-local-variables to nil disables directory-local variables.

Source : CNA (vendor or assigner)

Check whether you are affected

No verification method provided.

Timeline

  1. — CVE published (cve)

References

Data provenance

Status
NVD
Publication date
NVD
Description
CNA (vendor or assigner)
CVSS score
CNA (vendor or assigner)
Weakness (CWE)
NVD
CVSS vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H (CVSS 3.1, CNA:mitre)
Weakness
CWE-829 · Autre (CWE-829)

How this data is obtained and calculated