home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 20018 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  5.1 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!agate!ucbvax!lrw.com!leichter
  2. From: leichter@lrw.com (Jerry Leichter)
  3. Newsgroups: comp.os.vms
  4. Subject: re: Re: HELP!!! Security problem for gurus. [Directories]
  5. Message-ID: <9212290242.AA00964@uu3.psi.com>
  6. Date: 29 Dec 92 01:30:55 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 99
  11.  
  12.  
  13.     On the thread of protecting a directory, I found something recently
  14.     that might prove applicable...
  15.  
  16.     I was reading through printouts of old postings from this newsgroup,
  17.     and happened across mention of "the undocumented DUMP/DIR command."  I
  18.     tried it (you try it, now, too) and found that it displays the
  19.     contents  of a .DIR file, in terms of its significance as
  20.     file-directory information  and including its offset, in bytes, from
  21.     the beginning of the .DIR file.  
  22.  
  23. Hmm - DUMP/DIR seems to have been added recently; there's no such qualifier
  24. on my V5.2 systems.
  25.  
  26.     One of the fields shown was "TYPE" at offset 4.  I noticed that it had
  27.     the exact same value (I don't have a VMS system handy at the moment so
  28.     can't tell you what value that was) for ALL directory entries in ALL
  29.     .DIR files.  I wondered what OTHER valid values for that field
  30.     existed, and so I whipped out my copy of VFE (the Virtual File Editor,
  31.     a PD  thing available from DECUS) and patched a different value into
  32.     offset  4.  I found that there were several values which DUMP/DIR
  33.     "knew about," whose purpose is as yet unknown to me.
  34.  
  35. Interesting.  The ODS-II specs, as best I can recall, define two possible
  36. entry types:  Files and links.  Files are what you would expect.  A link is
  37. a like a Unix "soft link":  A text string that replaces the file specifica-
  38. tion being parsed.  While specified way back when ODS-II was first designed
  39. (i.e., when VMS was designed), this feature has never been implemented.
  40.  
  41. (ODS-II has several other "spec'ed but never implemented" features, including
  42. a hashed file type and something I gather will finally appear in VMS V6:
  43. Access-mode restricted files (i.e., files that can only be accessed from
  44. inner-mode code, regardless of the usual protections on the file).
  45.  
  46.     I also found that if I put an INVALID value -- i.e., something
  47.     DUMP/DIR didn't recognize (or was it, specifically, the value 0?  I
  48.     forget; try experiments, I did!) -- into that field in the FIRST entry
  49.     in the .DIR file, a funny thing happened: I was able to do a DIRECTORY
  50.     operation on the  directory represented by the patched .DIR file, but
  51.     was UNABLE to access any of the FILES THEMSELVES.  Patching the
  52.     original value, whatever it was, back into that field, made everything
  53.     work normally again.
  54.  
  55. I believe DIRECTORY accesses the directory files directly, rather than going
  56. through RMS.  It probably doesn't check the validity of the entries it sees.
  57.  
  58. Just out of curiosity (since you've done this already), did DIRECTORY work
  59. when you were looking at more than just the file spec?  (Every other field -
  60. well, every other field except the file id - requires access to the file's
  61. header.  Did DIRECTORY manage to access the header?)
  62.  
  63.     I expect that this technique--
  64.  
  65.       a) is unsupported; use at your own risk;
  66.  
  67. You bet.
  68.  
  69.       b) does NOT involve changing the ATTRIBUTES (protection, "directory"
  70.          bit, etc.) of the .DIR file;
  71.  
  72. No, only the contents.
  73.  
  74.       c) would stymie any system manager, probably any CSC representative,
  75.          who hasn't read this post just now, regardless of privs;
  76.     and
  77.       d) could be implemented in a nice little PROGRAM that went out and 
  78.          tweaked the appropriate field in the .DIR file, letting you 
  79.          easily protect and deprotect a directory at your convenience.
  80.  
  81. Actually, I have serious doubts about c.  ANALYZE/DISK is pretty certain to
  82. check directory entries for validity.  Your munged entries will stand out
  83. like a sore thumb.  It's a good bet that ANALYZE/DISK/REPAIR would fix the
  84. invalid entries by removing them and then later noticing the files involved
  85. are lost and moving them to [SYSLOST].
  86.  
  87.     Use at your own risk, of course.  Bon chance!
  88.  
  89. If you want to hack with directory entries, there are plenty of other things
  90. you could do.  For example, you could change the last character in the file's
  91. name to something like a space or a backspace.  The file would be inaccessible
  92. through that name until the entry was patch back.  I don't know if
  93. ANALYZE/DISK - or even RMS - would notice this and complain; probably not.
  94. But anyone who actually tried to access the file would quickly learn that
  95. you were playing games.  A quick DIR/FILE, along with a program to access a
  96. file directly by FID, and that would be that.  No safer than just giving the
  97. file an innocuous name to begin with, since you are safe only as long as the
  98. file isn't noticed.
  99.  
  100. It's not clear to me what BACKUP would do with a hacked directory entry.  It
  101. might complain, making the hacked files VERY visible during the next system
  102. incremental.
  103.  
  104. BTW, it's not impossible that SOME invalid directory entries will could cause
  105. (probably non-fatal) bugchecks.  Also, the future direction of VMS seems to be
  106. to forbid direct access to directory files (at least direct write access).
  107. You could find your modified directory entries completely inaccessible after
  108. the next upgrade!
  109.                             -- Jerry
  110.  
  111.