Bug 21702 - script follows symlinks.
Summary: script follows symlinks.
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: util-linux   
(Show other bugs)
Version: 7.0
Hardware: All Linux
Target Milestone: ---
Assignee: Erik Troan
QA Contact: Dale Lovelace
Keywords: Security
Depends On:
TreeView+ depends on / blocked
Reported: 2000-12-04 22:08 UTC by Jeremiah Johnson
Modified: 2007-04-18 16:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-02-06 20:55:33 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Jeremiah Johnson 2000-12-04 22:08:11 UTC
The program "script" from util-linux does not check for file existence
prior to writing output.  By default script writes to a file called
"typescript", it can be made to write to other files as well.  If a symlink
exists in the place of the typescript file, the file linked could be
destroyed if the user running script has proper privledges.  

[miah@workie miah]$ echo "pleh" > peh
[miah@workie miah]$ ln -s peh typescript
[miah@workie miah]$ ls -l peh typescript
-rw-rw-r--    1 miah     miah            5 Dec  4 02:19 peh
lrwxrwxrwx    1 miah     miah            3 Dec  4 02:19 typescript -> peh
[miah@workie miah]$ script
Script started, file is typescript[miah@workie miah]$ ls peh
[miah@workie miah]$ exitScript done, file is typescript
[miah@workie miah]$ cat peh
Script started on Mon Dec  4 02:19:44 2000
[miah@workie miah]$

This problem exists in newest version of util-linux and seems to exist in
all other versions of script.  Other platforms/OS's are effected by this
too (including Openbsd 2.6/BSDi 4.1)

Comment 1 Erik Troan 2001-02-06 20:55:27 UTC
This isn't a bug. Most unix command line utilities follow symlinks. It may cause
surprising behavior, but it is correct.

Note You need to log in before you can comment on or make changes to this bug.