Arbitrary shell command evaluation in Org Mode (GNU Emacs)
seclists.org
seclists.org
The loss of on-by-default functionality such as Org fontification in email message buffers is in no way as important as being wide open to trivial remote code execution.
[1] https://github.com/emacs-mirror/emacs/commit/befa9fcaae29a6c...
E.g., is markdown-mode or python-mode likely to have similar bugs? What about web browser modes, or chat modes, etc?
I genuinely like emacs but I’m worried for a future where my client cannot be trusted to not evaluate random data it has in files.
I don't expect to see code evaluation on untrusted input as intended features in web browser or chat modes.
I'm not sure whether to laugh or cry at that. Suffice to say that ship has sailed all the way around the world several times, to the great detriment of everyone who isn't a advertising or other malware-development corporation.
[1] https://www.gnu.org/software/emacs/manual/html_node/eww/Over...
#+LINK: shell %(shell-command-to-string) [[shell:touch ~/hacked.txt]]
Although, Office (and most other software) will at least warn you before executing code/malware in such documents originating from the Internet.
A warning and a prompt would largely be useless in this case anyway. As soon as you'd click the prompt, the evil code would run. What you'd need is an option set in your init file to allow code to execute on opening only if a particular piece of information known only to you is included in the file, like #+runcode: a19ihlkn01nf2n9882n4337974biskjf
;; -*- eval: (message "arbitrary code") -*-
any mode associated with a file extension should be at least as secure against code execution.Following ‘shell’ and ‘elisp’ links Org has two link types that can directly evaluate code (see External Links). Because such code is not visible, these links have a potential risk. Org therefore prompts the user when it encounters such links. The customization variables are:
User Option: org-link-shell-confirm-function Function that prompts the user before executing a shell link.
User Option: org-link-elisp-confirm-function Function that prompts the user before executing an Emacs Lisp link.
Non issue. Rtfm.