From owner-freebsd-bugs Fri Jan 25 9:30: 6 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D0DEA37B416 for ; Fri, 25 Jan 2002 09:30:00 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0PHU0V73813; Fri, 25 Jan 2002 09:30:00 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 725D137B404 for ; Fri, 25 Jan 2002 09:24:22 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0PHOMW73157; Fri, 25 Jan 2002 09:24:22 -0800 (PST) (envelope-from nobody) Message-Id: <200201251724.g0PHOMW73157@freefall.freebsd.org> Date: Fri, 25 Jan 2002 09:24:22 -0800 (PST) From: Hironori SAKAMOTO To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/34270: man -k could be used to execute any command. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 34270 >Category: misc >Synopsis: man -k could be used to execute any command. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 25 09:30:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Hironori SAKAMOTO >Release: >Organization: >Environment: >Description: "man -k" could be used to execute any command. For example: $ man -k 'echo "; ls"' executes "ls" I could not investigate how dangerous this behavior is. At least, when web-CGI uses "man -k" with query string, even if the string is quoted for /bin/sh, any command could be executed. >How-To-Repeat: $ export PAGER=cat $ ls a b $ man -k 'echo "; ls"' echo(1) - write arguments to the standard output a b >Fix: In do_apropos() in man/man.c, apropos name is only quoted with `"'. sprintf (command, "%s \"%s\"", APROPOS, name); Any special characters for /bin/sh should be escaped with `\'. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message