Bug 79289

Summary: man -k attempts to run 'unsafe' script
Product: [Retired] Red Hat Linux Reporter: David Wijnants <dwijnants>
Component: manAssignee: Eido Inoue <havill>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: high    
Version: 7.3CC: mitr
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-01-06 22:19:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Wijnants 2002-12-09 16:54:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.79 [en] (X11; U; Linux 2.4.18-18.7.x i686)

Description of problem:
If the parameter passed to 'man -k' contains a space, it exits with 'sh: unsafe:
command not found'. If there is a script with that name on the path, the script
will be run.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. man -k 'what is'
2. Now the same with example script (unsafe) on the path

#!/bin/sh
echo "You've been trojaned!"

Actual Results:  Without 'unsafe' on path:

sh: unsafe: command not found
Error executing formatting or display command.
System command unsafe exited with status 32512.

With 'unsafe' on path:

You've been trojaned!


Expected Results:

what: nothing appropriate
is: nothing appropriate

(cf. apropos)

Additional info:

man-1.5j/src/utils.c filters out 'non-shell-safe commands' by replacing them
with the string 'unsafe', but man still goes ahead and runs the 'unsafe'
command.

Comment 1 Alan Cox 2002-12-18 18:44:54 UTC
Agreed. We don't have "." on the path so the damage is minimal but its a bug
that wants squashing


Comment 2 Eido Inoue 2003-01-06 22:19:58 UTC
fixed in man-1.5j-14


Comment 3 Mark J. Cox 2003-04-28 12:45:56 UTC
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2003-134.html