Local Security Bug in GNU Emacs

A vulnerability in the extended text editor GNU Emacs gives local attackers the ability to run arbitrary code.

Developer Drake Wilson disclosed the vulnerability on the Debian Security mailing list. The error is caused by incorrect behavior of the "hack-local-variables" function if it is set to ":safe". The documentation for the function states that Emacs only runs variables that are declared as safe in this case, but this is not true: Emacs actually ignores the function and uses any local variable. An attacker could exploit this to modify the current user’s init file and execute code by means of a carefully crafted Emacs Lisp file.

The bug affects Emacs version 22.1 and possibly others. The Emacs 22.1 package in the Debian Etch repository does not have the bug says another developer. A fix is available from the CVS repository. The vulnerability has been assigned CVE ID CVE-2007-5795. The GNU Emacs maintainer has been notified.