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

  1. Path: sparky!uunet!portal!cup.portal.com!Chris_F_Chiesa
  2. From: Chris_F_Chiesa@cup.portal.com
  3. Newsgroups: comp.os.vms
  4. Subject: re: Re: HELP!!! Security problem for gurus. [Directories]
  5. Message-ID: <72764@cup.portal.com>
  6. Date: Fri,  1 Jan 93 18:16:57 PST
  7. Organization: The Portal System (TM)
  8. Distribution: world
  9. References:  <9212290242.AA00964@uu3.psi.com>
  10. Lines: 134
  11.  
  12. In yet another recent article (Portal does not permit me to identify the
  13. article more specifically) here, Jerry Leichter (Portal also doesn't in-
  14. sert Jerry's Internet address here for me, and Jerry doesn't sign off 
  15. with it) responds to an earlier posting of MINE.  Jerry also sent me a 
  16. copy of his article via e-mail, but I'm responding here as I think this
  17. thread is probably of general interest...
  18.  
  19. >    On the thread of protecting a directory, [...] 
  20. >
  21. >    [...] "the undocumented DUMP/DIR command." [...] displays the
  22. >    contents  of a .DIR file, in terms of its significance as
  23. >    file-directory information  and including its offset, in bytes, from
  24. >    the beginning of the .DIR file.  
  25. >
  26. >Hmm - DUMP/DIR seems to have been added recently; there's no such qualifier
  27. >on my V5.2 systems.
  28.  
  29. For what it's worth, I have it on my V5.4-3 system, and I haven't checked 
  30. for it on my one V5.5 system...
  31.  
  32. >    One of the fields shown was "TYPE" at offset 4.  [...] it had
  33. >    the exact same value [...] for ALL directory entries in ALL
  34. >    .DIR files.  I wondered what OTHER valid values for that field
  35. >    existed [...]
  36. >
  37. >Interesting.  The ODS-II specs, as best I can recall, define two possible
  38. >entry types:  Files and links.  Files are what you would expect.  A link is
  39. >a like a Unix "soft link":  A text string that replaces the file specifica-
  40. >tion being parsed.  While specified way back when ODS-II was first designed
  41. >(i.e., when VMS was designed), this feature has never been implemented.
  42.  
  43. Being unfamiliar as I am with the specific behavior of "a Unix 'soft link',"
  44. can you elaborate on the intended behavior of this interesting-sounding 
  45. never-implemented feature?  I'm just wondering what we're missing out on.
  46.  
  47. >(ODS-II has several other "spec'ed but never implemented" features, including
  48. >a hashed file type and something I gather will finally appear in VMS V6:
  49. >Access-mode restricted files (i.e., files that can only be accessed from
  50. >inner-mode code, regardless of the usual protections on the file).
  51.  
  52. Very interesting!  What's a "hashed" file type?  Again, can you elaborate?
  53. This may be a loaded question, but: how does it happen that features can 
  54. BE "spec'd but never implemented?"  What determines whether a particular
  55. feature gets implemented right away, or after a long delay (how long has
  56. ODS-II been in existence with spec'ed-but-never-implemented features?),
  57. or never?  And, finally, how do YOU find out about these things, Jerry?
  58. Inquiring minds... etc. ;-)
  59.  
  60. >    I also found that if I put an INVALID value [...] into that field 
  61. >    in the FIRST entry in the .DIR file [...] I was able to do a DIRECTORY
  62. >    operation on the  directory represented by the patched .DIR file, but
  63. >    was UNABLE to access any of the FILES THEMSELVES.  
  64. >
  65. >I believe DIRECTORY accesses the directory files directly, rather than going
  66. >through RMS.  It probably doesn't check the validity of the entries it sees.
  67.  
  68. It seems evident from what I've observed, that DIRECTORY doesn't (currently) 
  69. validate at least the contents of the "type" field I played with -- but I'm
  70. afraid I don't see how it makes any difference whether one "accesses the
  71. directory files directly" OR "(goes) through RMS."  If I open "filespec.DIR"
  72. as a FILE, I can read it just fine using RMS -or- "directly."  Do I mis-
  73. understand you, Jerry?
  74.  
  75. >Just out of curiosity (since you've done this already), did DIRECTORY work
  76. >when you were looking at more than just the file spec?  (Every other field -
  77. >well, every other field except the file id - requires access to the file's
  78. >header.  Did DIRECTORY manage to access the header?)
  79.  
  80. Ehhhhhh...  I'm afraid you've caught me out, here, Jerry.  I did ONLY 
  81. a "DIRECTORY" command and a "DIRECTORY filespec" command - didn't try
  82. /DATE or /SIZE or any of the file-header-access-requiring qualifiers.
  83. I'll try this and get back to this thread, if someone else doesn't beat 
  84. me to it as seems highly probable.
  85.  
  86. >    I expect that this technique--
  87. >
  88. >     [...] 
  89. >
  90. >      c) would stymie any system manager, probably any CSC representative,
  91. >         who hasn't read this post just now, regardless of privs;
  92. >
  93. >Actually, I have serious doubts about c.  ANALYZE/DISK is pretty certain to
  94. >check directory entries for validity.  Your munged entries will stand out
  95. >like a sore thumb.  It's a good bet that ANALYZE/DISK/REPAIR would fix the
  96. >invalid entries by removing them and then later noticing the files involved
  97. >are lost and moving them to [SYSLOST].
  98.  
  99. Didn't think of that.  I can count the number of times I've done an 
  100. ANALYZE/DISK in my six-year VMS career (four of them as a system manager
  101. of a very small system) on the fingers of one hand, and I don't think 
  102. I've EVER used /REPAIR... 
  103.  
  104. >If you want to hack with directory entries, there are plenty of other things
  105. >you could do.  
  106.  
  107. Some very interesting ideas, Jerry -- thanks!  I'll have to do some "playing!"
  108. (Yeah, it WILL probably require me to use ANALYZE/DISK again afterwards, 
  109. and maybe /REPAIR for the first time ;-) )
  110.  
  111. > [...] you are safe only as long as the
  112. >file isn't noticed.
  113.  
  114. Ah, that's the bottom line, isn't it...  Sometimes the best place to hide
  115. something is right out in plain sight... "The Purloined Letter" taught us
  116. that, a long time ago... ;-)
  117.  
  118. >BTW, it's not impossible that SOME invalid directory entries will could cause
  119. >(probably non-fatal) bugchecks.  
  120.  
  121. I remember seeing RMS bugs in the past that would delete the erring process
  122. upon encountering certain errors in on-disk or file structure.  I was always
  123. surprised to find such dramatic bugs in RMS, an otherwise extremely robust-
  124. seeming entity...  
  125.  
  126. > Also, the future direction of VMS seems to be
  127. >to forbid direct access to directory files (at least direct write access).
  128. >You could find your modified directory entries completely inaccessible after
  129. >the next upgrade!
  130.  
  131. That's VERY interesting!  At what level of the system would this be imple-
  132. mented?  Disk driver (mark certain media blocks /NOWRITE)?  $QIO-ACP inter-
  133. face ("don't allow access to any file whose "I'm a directory" bit is set")?
  134. Write-Logical-(or-Physical)-Block $QIO request?  Blocking directory-write
  135. access at any level would pose difficulties and paradoxes.  For example,
  136. RMS needs to be able to update directories, which would seem to preclude
  137. blocking directory-writing at the driver or $QIO levels, but NOT blocking
  138. such access at those levels would hardly prevent "illegal" modifications
  139. in the intended manner, as simply bypassing RMS would be sufficient...
  140. Ah well, some combination of access-mode and file-attribute check could
  141. be applied that would at least make "illegal" modification MORE DIFFICULT 
  142. than it is today.
  143.  
  144. Chris Chiesa
  145.   Chris_F_Chiesa@cup.portal.com
  146.