bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66390: `man' allows to inject arbitrary shell code


From: Maxim Nikulin
Subject: bug#66390: `man' allows to inject arbitrary shell code
Date: Sat, 7 Oct 2023 19:47:04 +0700
User-agent: Mozilla Thunderbird

man.el does not escape properly shell special characters when `man' is invoked with an argument to open particular manual page. As a result arbitrary shell code may be executed.

I do not consider it as a real issue when the `man' command is invoked by a user directly. However it is a security vulnerability when other packages calls `man' to open a specific page.

Consider an Org mode document with the following link and ol-man is loaded

  <man:File:\:UserDirs(3pm)>

In response to C-c C-o (`org-open-at-point') an error appears instead of formatted manual page

--- 8< ---
/usr/bin/sh: 1: Syntax error: "(" unexpected

process exited abnormally with code 2
--- >8 ---

Alternatively just evaluate

 (man "File:\\:UserDirs(3pm)")

A side note: I tried to add backslash due to an issue with ol-man that is to be fixed. A workaround in this particular case is to remove "(3pm)". Though the real problem is that special characters "()" are not quoted.

I would not consider the issue as a severe one unless some users who wish to open arbitrary Org files from the net

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58774#34
Org files are native to Emacs, I wish to open Org files by using EWW.

man.el should prevent substitution of shell specials literally from `man' arguments into shell commands.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]