emacs: .dir-locals.el auto-mode-alist bypass gives code execution on file open
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | ||||||
|---|---|---|---|---|---|---|---|---|---|
| GNU | Emacs | unknown |
|
No data.
No data.
| Vendor | Product | Versions | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Gnu | Emacs |
|
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.
No CVSS v4.0
No CVSS v3.0
No CVSS v2
This CVE is not in the KEV list.
Exploit prediction score: < 1% (0.201% probability within 30 days)
| Type | Values Removed | Values Added |
|---|---|---|
| Metrics |
ssvc
|
| Type | Values Removed | Values Added |
|---|---|---|
| Title | Arbitrary Emacs Lisp Execution via Crafted .dir‑locals.el | emacs: .dir-locals.el auto-mode-alist bypass gives code execution on file open |
| References |
| |
| Metrics |
threat_severity
|
threat_severity
|
| Type | Values Removed | Values Added |
|---|---|---|
| Title | Arbitrary Emacs Lisp Execution via Crafted .dir‑locals.el |
| 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
|