Description
The hack-local-variables function in Emacs before 22.2, when enable-local-variables is set to :safe, does not properly search lists of unsafe or risky variables, which might allow user-assisted attackers to bypass intended restrictions and modify critical program variables via a file containing a Local variables declaration.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 5.0 | emacs22 | 22.1+1-2+lenny1 | DTSA-79-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | emacs | 27.2-6.2 | openSUSE-SU-2024:10735-1 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Exploit-DB 1
- GNU Emacs 22.1 - Local Variable Handling Code Execution EDB-30736 · remote · Nov 2, 2007 · verified
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Advisories 2
- DTSA-79-1 emacs22 - restriction bypass Debian Security (DSA / DLA) · Mar 9, 2026
- openSUSE-SU-2024:10735-1 emacs-27.2-6.2 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
References
- FEDORA-2007-3056 vendor-advisory
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=449008
- 27984 third-party-advisory
- emacs-hacklocalvariables-security-bypass(38263) vdb-entry
- 27728 third-party-advisory
- ADV-2008-0924 vdb-entry
- ADV-2007-3715 vdb-entry
- http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/files.el?r1=1.896.2.28&r2=1.896.2.29
- 42060 vdb-entry
- USN-541-1 vendor-advisory
- 29420 third-party-advisory
- APPLE-SA-2008-03-18 vendor-advisory
- MDVSA-2008:034 vendor-advisory
- 26327 vdb-entry
- http://bugs.gentoo.org/show_bug.cgi?id=197958
- GLSA-200712-03 vendor-advisory
- http://docs.info.apple.com/article.html?artnum=307562
- 27508 third-party-advisory
- 27627 third-party-advisory