Technical impact
GNU Emacs 31.1 contains a code injection flaw in the handling of directory-local variables. A malicious .dir-locals.el file can include a (REGEXP FUNCTION t) entry in auto-mode-alist, causing Emacs to call FUNCTION before the entry is validated, which runs arbitrary Emacs Lisp code with the privileges of the running Emacs instance.
Affected Systems
GNU Emacs version 31.1 is affected. Emacs 30.2 is not affected. No other versions are indicated as vulnerable in this CVE.
Risk and Exploitability
The vulnerability has a CVSS score of 7.8 and an EPSS score of less than 1 %. It is not listed in the CISA KEV catalog. Exploitation requires a user to open a file in a directory that contains a crafted .dir-locals.el; therefore the attack vector is inferred to be local and relies on untrusted file placement. If successful, an attacker can execute arbitrary Emacs Lisp code in the context of the running Emacs instance.