CVE-2026-131959
Description
A flaw was found in Emacs. A crafted .dir-locals.el file can supply a (REGEXP FUNCTION t) entry in auto-mode-alist. When a user opens a file that matches the regular expression REGEXP, the function FUNCTION will be executed before proper validation, allowing execution of arbitrary Emacs Lisp with the privileges of the Emacs process.
Statement
To exploit this issue, a user needs to open a file within an untrusted directory, such as a cloned Git repository or extracted archive, that contains a malicious .dir-locals.el file, limiting its exposure and requiring user interaction. However, successful exploitation can allow execution of arbitrary Emacs Lisp code with the privileges of the Emacs process, potentially leading to a system compromise. For these reasons, this vulnerability has been rated with an important severity.
Mitigation
To mitigate this flaw, disable directory-local variable processing in Emacs configuration:
Add the following configuration setting to the user initialization file (`~/.emacs`, `~/.emacs.el`, or `~/.emacs.d/init.el`), or globally across the system in the site initialization file (such as `/etc/emacs/site-start.el`):
elisp
(setq enable-dir-local-variables nil)
Running Emacs instances must be restarted for the configuration change to take effect.
Caveats: Disabling this setting prevents Emacs from automatically loading project-specific and directory-level customization files.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
The following CVSS metrics and score provided are preliminary and subject to review.
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 7.8 | N/A | 7.8 |
| Attack Vector | Local | N/A | Local |
| Attack Complexity | Low | N/A | Low |
| Privileges Required | None | N/A | None |
| User Interaction | Required | N/A | Required |
| Scope | Unchanged | N/A | Unchanged |
| Confidentiality | High | N/A | High |
| Integrity Impact | High | N/A | High |
| Availability Impact | High | N/A | High |
Vector
Red Hat: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
cve.org: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Understanding the Weakness (CWE)
Confidentiality,Integrity,Availability
Technical Impact: Execute Unauthorized Code or Commands
An attacker could insert malicious functionality into the program by causing the program to download code that the attacker has placed into the untrusted control sphere, such as a malicious web site. This could enable the injection of malware, information exposure by granting excessive privileges or permissions to the untrusted functionality, DOM-based XSS vulnerabilities, stealing user's cookies, open redirect to malware (CWE-601), etc.
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.