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.)
Advisories
No advisories yet.
Fixes
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
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
|
Projects
Sign in to view the affected projects.
Status: PUBLISHED
Assigner: mitre
Published:
Updated: 2026-11-18T07:34:30.502Z
Reserved: 2026-11-18T07:34:30.134Z
Link: CVE-2026-131959
No data.
No data.
No data.
OpenCVE Enrichment
No data.
Weaknesses