CVE-2026-131959: Code Injection
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 Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 31.2
Event History
Frequently Asked Questions
Who is exposed to exploitation?
Users of GNU Emacs 31.1 are exposed when they open a file whose directory hierarchy contains a crafted .dir-locals.el and the file matches the attacker-supplied auto-mode-alist regular expression. Emacs 30.2 is identified as unaffected.
What must an attacker provide for exploitation to occur?
The attacker needs to place or cause the user to use a crafted .dir-locals.el containing a (REGEXP FUNCTION t) auto-mode-alist entry, along with a file that matches REGEXP. Exploitation requires the user to open that matching file.
What is the impact if exploitation succeeds?
The crafted function can execute arbitrary Emacs Lisp with the privileges of the Emacs process. This can affect confidentiality, integrity, and availability at that privilege level.