Description
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.)
Published: 2026-11-18
Score: 7.8 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Analysis and contextual insights are available on OpenCVE Cloud.

Remediation

Vendor Solution

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


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

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 18 Nov 2026 07:45:00 +0000

Type Values Removed Values Added
Description 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.)
First Time appeared Gnu
Gnu emacs
Weaknesses CWE-829
CPEs cpe:2.3:a:gnu:emacs:*:*:*:*:*:*:*:*
Vendors & Products Gnu
Gnu emacs
References
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}


cve-icon MITRE

Status: PUBLISHED

Assigner: mitre

Published:

Updated: 2026-11-18T15:38:33.980Z

Reserved: 2026-11-18T07:34:30.134Z

Link: CVE-2026-131959

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-11-18T08:17:19.593

Modified: 2026-11-18T16:18:15.343

Link: CVE-2026-131959

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-11-18T08:45:01Z

Weaknesses