SECURITY 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. Security of bsd-games and bsd-games-non-free
  2. ============================================
  3. Some games maintain system-wide score files or logs, and need
  4. appropriate privileges to write to these files. They can get these
  5. privileges by being installed setgid games, or through the files being
  6. world writable. If they do not have these privileges, they will run,
  7. but fail to update the score files. Most of the games were written at
  8. a time when security was not considered important; therefore, making
  9. games setgid has in the past meant that users can get a shell with gid
  10. games, and possibly also get access to the accounts of other games
  11. players by corrupting the score files. (This will also apply to many
  12. more modern games that are badly written.)
  13. In version 2.2, security fixes from OpenBSD have been applied: most of
  14. the games that have score files will open them on startup, and then
  15. drop any setgid privileges completely (including the saved gid). This
  16. limits the effect of a cracked game to corruption of its score file.
  17. It should be somewhat safer now to make games setgid games than in
  18. versions 2.1 and earlier, but probably not completely safe; phantasia,
  19. sail, rogue, hack and tetris do not currently handle their score files
  20. in the above way, and so should be considered the most dangerous to
  21. install setgid. If you are auditing these games, phantasia, sail,
  22. rogue, hack and tetris should be considered the most important to
  23. audit. In versions before 2.14, rogue had an exploitable buffer
  24. overrun (see NetBSD Security Advisory 2002-021).
  25. An effect of this security policy is that in some cases the score
  26. files need to be world-readable so that they can be opened for reading
  27. after the game has dropped privileges, or by a score file reading
  28. program that was never privileged. In versions before 2.10, the
  29. phantasia "characs" file (containing passwords for phantasia
  30. characters) was mistakenly made world readable.
  31. You should, of course, only install the games setgid if this is in
  32. line with system security policy. Games should not be installed
  33. setuid, since if a setuid game is cracked this allows games to be
  34. replaced with trojans. Games should not be installed setgid to a
  35. system group such as "root" or "daemon". In some environments, an
  36. acceptable alternative may be not to give the games any special
  37. privileges, but to put trusted users in the games group.
  38. An option is to use the "dungeon master" dm to regulate games playing.
  39. I believe this is safe; games that do not need to run setgid drop the
  40. setgid privileges they get from dm on startup. If dm is setgid, but
  41. the games that access score files are not, then they will keep their
  42. setgid privileges from dm; note that in this case it does not make
  43. sense for dm to be setgid to some gid other than the one (normally
  44. "games") with write access to the score files.
  45. This package does not yet support security hardening by giving each
  46. setgid game its own gid, but in some environments you may wish to do
  47. this.
  48. ***********************************************************************
  49. * *
  50. * DO NOT INSTALL ANY GAMES SETUID, ONLY SETGID. *
  51. * *
  52. * INSTALLING GAMES SETGID GAMES MIGHT ENABLE TO GET SHELLS WITH GID *
  53. * GAMES. *
  54. * *
  55. * WHERE GAMES READ A SCORE FILE, IF A USER CAN CORRUPT THIS FILE IT *
  56. * MIGHT IN SOME CASES MEAN THEY CAN GET ACCESS TO THE ACCOUNTS OF *
  57. * OTHER USERS PLAYING THAT GAME. *
  58. * *
  59. * IF IN DOUBT, CHOOSE THE DEFAULT OPTIONS FOR PERMISSIONS AND DO *
  60. * WITHOUT SCOREFILES. *
  61. * *
  62. * THESE GAMES COME WITH NO WARRANTY. *
  63. * *
  64. ***********************************************************************
  65. If you are compiling these games on an operating system other than
  66. Linux, be warned that they rely for their security on
  67. "setregid(getgid(), getgid())" dropping all setgid privileges
  68. permanently, _including the saved gid_. On some operating systems
  69. this may fail to drop the saved gid (and indeed such operating systems
  70. may provide no way for a process not running as root to revoke
  71. privileges permanently); in such a case, bugs in a game may provide
  72. access to the games group rather than merely to to that game's score
  73. file.
  74. Joseph S. Myers
  75. jsm@polyomino.org.uk
  76. Local Variables:
  77. mode: text
  78. End: