Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95273 - screen uses /tmp/screen-exchange by default.
Summary: screen uses /tmp/screen-exchange by default.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-06 15:38 UTC by solar (RETIRED)
Modified: 2005-06-07 06:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description solar (RETIRED) gentoo-dev 2005-06-06 15:38:13 UTC
In the screenrc we have the option to tell it where to handle the
read/write buffers when you ctrl+a+> or ctrl+a+< When the option is left
uncommented in the screenrc the default behavior appears to outright
just use /tmp/screen-exchange

As root I'm able to create the /tmp/ file and then as a user have
blindly source this file in. screen is pretty smart with write mode in
the terms of if you attempt to symlink the file via echo owned > owned;
ln -s owned screen-exchange ; screen ctrl+a+> it wont write to the
symlink. No idea how it behaves on hardlinks (my kernel does not permit
it so I can't test it).

Anyway I'd like to suggest that we make use of the following in screenrc
before this ever has a chance to turn into something nasty later on.

# bufferfile:   The file to use for commands
#               "readbuf" ('<') and  "writebuf" ('>'):
-# bufferfile            $HOME/.screen_exchange
+bufferfile            $HOME/.screen_exchange
Comment 1 Sven Wegener gentoo-dev 2005-06-07 06:21:52 UTC
Well, actually root is able to create the file in your HOME too, so that won't
protect us from the problem. The benefits lies in multi-user environments where
multiple users use the bufferfile at the same time. With the changed default
they can use the file independent from each other. And no other user can easily
slip some bad contents in the default bufferfile of another user.

Just checked the hardlinks and symlinks thing, screen doesn't check for links
when writing to the file. Neither symlinks nor hardlinks are checked.

I changed the default configuration file.
Comment 2 Sven Wegener gentoo-dev 2005-06-07 06:39:25 UTC
Sorry, it checks for both hard and symlinks, but only if the current bufferfile
is the compiled in default.
Comment 3 Tavis Ormandy (RETIRED) gentoo-dev 2005-06-07 06:44:37 UTC
just a note, there appears to be a TOCTOU between link checking and opening. 

Not an issue now the default configuration has been updated.