Code injection in GNU Emacs directory-local variable handling
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- No fix listed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA. Impact type from CWE-829.
Summary
GNU Emacs 31.1 contains a code injection flaw in how it handles directory-local variables, classified as CWE-829. A crafted .dir-locals.el can register a function that Emacs calls before validating it, running arbitrary Emacs Lisp with the privileges of the Emacs process. A local attacker who can place such a file needs a user to open a matching file. Emacs 30.2 is unaffected.
Written with Claude Haiku 5.5 from the sources below · 2026-11-18
Description from the CNA
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.)
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
Remediation
The sources list no fixed version for GNU Emacs. Emacs 30.2 is unaffected.
Written with Claude Haiku 5.5 from the sources below · 2026-11-18
Vendor assessments
Red Hat
Red Hat rating: Important. Red Hat's page for this CVE →
Not affected: 5 products
- Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
Timeline
- 2026-11-18 Threatist record created from CVE-2026-131959
- 2026-11-18 Alias added: GHSA-5hqm-5j9g-jhcr
- 2026-11-18 CISA SSVC decision points changed
- 2026-11-18 Affected versions changed · Red Hat
- 2026-11-18 CVSS score added · Red Hat
References
More GNU vulnerabilities
- TI-2026-19388 Authentication bypass in GNU Inetutils telnetd via USER variable KEVCVSS 3.1CRITICAL 9.8
- TI-2014-05975 GNU Bash environment variable parsing flaw lets attackers write files KEVCVSS 3.1CRITICAL 9.8
- TI-2014-05157 Code execution in GNU Bash through crafted environment variables KEVCVSS 3.1CRITICAL 9.8
- TI-2014-05164 Command injection in GNU Bash via crafted environment variables KEVCVSS 3.1HIGH 8.8
- TI-2023-04522 Buffer overflow in glibc ld.so allows privilege escalation KEVCVSS 3.1HIGH 7.8
- TI-2009-03392 The TLS protocol, and the SSL protocol 3.0 and possibly earlier, as used in Microsoft… CVSS 3.1CRITICAL 9.8
Sources
- CVE-2026-131959 · CVE Program
- CVE-2026-131959 · NVD
- FIRST EPSS
- GHSA-5hqm-5j9g-jhcr · GitHub Advisory Database · CC BY 4.0
- CVE-2026-131959 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences