Ruby: CGI::Session creates files insecurely
Gentoo Linux Security Advisory
||GLSA 200409-08 / dev-lang/ruby
||September 03, 2004
||September 03, 2004: 01
All supported architectures
When used for CGI scripting, Ruby creates session files in /tmp with the
permissions of the default umask. Depending on that umask, local users may
be able to read sensitive data stored in session files.
Ruby is an Object Oriented, interpreted scripting language used for many
system scripting tasks. It can also be used for CGI web applications.
The CGI::Session::FileStore implementation (and presumably
CGI::Session::PStore), which allow data associated with a particular
Session instance to be written to a file, writes to a file in /tmp with no
regard for secure permissions. As a result, the file is left with whatever
the default umask permissions are, which commonly would allow other local
users to read the data from that session file.
Depending on the default umask, any data stored using these methods could
be read by other users on the system.
By changing the default umask on the system to not permit read access to
other users (e.g. 0700), one can prevent these files from being readable by
All Ruby users should upgrade to the latest version:
Code Listing 3.1: Resolution
# emerge sync
# emerge -pv ">=dev-lang/ruby-your_version"
# emerge ">=dev-lang/ruby-your_version"