NetSight
high7.8

CVE-2026-131959

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

Impact

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

An attacker can exploit this with local access to the system, without logging in, but a user has to do something, such as open a file or a link. If it succeeds: high risk of data being read, high risk of data or systems being changed, high risk of outages.

Affected products

VendorProductAffected versions
GNUEmacs
Version 31.1
MicrosoftEmacs
Version 31.1

Weakness classification

References