home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack2 / phrack41.009 < prev    next >
Encoding:
Text File  |  2003-06-11  |  16.0 KB  |  315 lines

  1.  
  2.                                 ==Phrack Inc.==
  3.  
  4.                    Volume Four, Issue Forty-One, File 9 of 13
  5.  
  6. - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = -
  7.  
  8.                   Security Shortcomings of AppleShare Networks
  9.  
  10.                                  By Bobby Zero
  11.  
  12.                                November 28, 1992
  13.  
  14. - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = -
  15.  
  16.         The purpose of this file is to inform all those underpaid Mac network
  17. administrators or other interested parties of the problems with Macintosh
  18. AppleShare and how to address those problems.  AppleShare is quite respectable
  19. in both its implementation and usage, blending seamlessly with the Macintosh OS
  20. such that the casual user has no idea of the complexity behind the elegance.
  21. For all its elegance, however, it does have some severe drawbacks in terms of
  22. security-- nearly all of which are fixable, requiring a combination of common
  23. sense and RTFM:  Read The Fucking Manual.
  24.  
  25.         This is in no way to be considered as a "How To" for persons of
  26. questionable ethics and/or motives.  That being said, however, I feel the
  27. following is in order:
  28.  
  29. PROSECUTOR:  [To WITNESS] ...And you are?
  30.  
  31. WITNESS:  Miss America.
  32.  
  33. [Singing]
  34.  
  35. PROSECUTOR:  Would you please tell the court why you feel Fielding Mellish is a
  36. traitor to this country?
  37.  
  38. WITNESS:  I feel that Fielding Mellish is a traitor to this country because his
  39. views are different from the views of the President, and others of his kind.
  40. Differences of views should be tolerated, but not when they are too different.
  41. Then he becomes a subversive mother.
  42.  
  43.                                       -- Woody Allen, "Bananas"
  44.  
  45.  
  46.         This file is divided into 5 sections:  (1) the "AppleShare Prep" file,
  47. (2) the "AShare File Srv" application, (3) Mixing VAXens & AppleShare, (4)
  48. System 7 FileSharing, and (5) NCSA Telnet weaknesses. The fifth does not
  49. particularly relate to AppleShare, but its security can be exploited via method
  50. #4, so I thought to include it.
  51.         If there is sufficient interest, I will make a "Part II" [or three or
  52. four or five..] detailing more problems.  Send feedback to Phrack Loopback;
  53. being a regular reader, I will respond accordingly.  While writing this, I was
  54. unsure of the approach -- either bland technical or "gh0d-these-people-
  55. are-dumb" statements.  I decided to just combine them, chao-like.  Well, enough
  56. of my rambling.  On with the file!
  57.  
  58.  
  59.                                - = - = - = - = -
  60.  
  61.  
  62. THE "APPLESHARE PREP" FILE
  63. ~~~  ~~~~~~~~~~ ~~~~  ~~~~
  64. (1) The "AppleShare Prep" file under both System 6 and 7 contains a BMLS
  65. resource; this resource contains various information required to mount a volume
  66. on startup.  While this is an optional feature, many people choose it either by
  67. accident or for convenience.
  68.  
  69. * The downside to this convenience is the fact that the user's name and
  70. password for a server are stored in this file.  Anyone with a copy of ResEdit
  71. can open this file up, and view the BMLS resource.
  72.  
  73. * It's so easy to create a Trojan horse and slip it into a program or Hypercard
  74. stack to copy the BMLS resource from the target's AppleShare Prep file and copy
  75. it into a hidden file on the server drive where it can be retrieved at a later
  76. date.  If Mr. Ed is well-written, he would be nearly undetectable as it takes
  77. but an eyeblink to copy the rez.  Trojan horses aren't as sexy as viruses and
  78. don't get much publicity, but it is exceedingly easy to fool a Macintosh user
  79. [or any user, for that matter] into running something he or she shouldn't.
  80.  
  81. HOW TO SOLVE:  Educate users of this flaw and urge them to log into the file
  82. server manually.  If computers in an open lab setting are used, configure them
  83. to automatically log in as a guest, thereby circumventing the entire issue of
  84. passwords entirely.  Encryption of the BMLS resource is entirely up to Apple or
  85. someone with enough knowledge of AppleShare to write a patch -- certainly not
  86. me [yet...].
  87.  
  88.  
  89. THE "ASHARE FILE SRV" SERVER
  90. ~~~  ~~~~~~ ~~~~ ~~~  ~~~~~~
  91. (2) On AppleShare File Servers running v2.0:
  92.  
  93. * The file "Users & Groups" within the Server/System Folder contains the data
  94. required for maintaining folder privileges & ownership.  It also contains
  95. user's names and passwords, in an unencrypted format.  While obtaining this
  96. file would be somewhat difficult [one must physically be able to access the
  97. server:  shut it down, restart it with a floppy, copy the file, reboot the
  98. machine], the "rewards" would be considerably worthwhile, as one would now have
  99. a copy of every user name and password, including that of the Administrator.
  100. Once physical access is secured, one could conceivably write a program to
  101. install on the server that would periodically make a copy of the file and put
  102. it on the "server" side of the disk, and give it an innocuous name... an INIT
  103. which would perform on every startup, or install a Time Task to do it daily, or
  104. even going so far as to patch the AppleShare Admin program to update this file
  105. every time a user is added or modified.  It is also common knowledge that users
  106. use the same passwords on different machines; armed with a list of names &
  107. passwords for one machine, one could then enter another computer with the same
  108. user/pass combination.
  109.  
  110. * There is no automatic lockout for users who enter an incorrect password. With
  111. a bit o' knowledge and a copy of "Inside AppleTalk," a program could be written
  112. that could use a dictionary of common passwords in conjunction with a list of
  113. user names to try to manually "hack out" a valid user/password combination.
  114. The speed of this varies greatly on the speed of and load on the server, the
  115. speed of and load on the network, and the speed of the "attacking" computer.  A
  116. typical "hack" can take anywhere from .5 to 5 seconds, but there is no need to
  117. tie up the attacking computer for that period of time; the program can use both
  118. asynchronous AFPCommand calls and exist under Multifinder to allow for complete
  119. "background hacking."  It should be noted, however, that Apple has incorporated
  120. a lockout into the hideously overpriced AppleShare 3.0 -- its hardware
  121. requirements, however, seem to leave it out of the budgets of most sane
  122. individuals.
  123.  
  124. * A group of individuals armed with the above program could go into a computer
  125. lab, fire up said program, and then launch a word processing application and
  126. seem to be doing homework while in reality they would be hacking passwords.
  127.  
  128. * The "Copy Protect File" in AppleShare Admin disallows using the Finder to
  129. copy a "Protected" program.  That does not deter, however, a "normal" copy
  130. program such as DiskTop from copying the file.  [That is about as lame as the
  131. ol' "Bozo Bit."]
  132.  
  133. HOW TO SOLVE:  Insure that physical access to the fileserver is impossible for
  134. all but trusted persons.  Upgrade to AppleShare 3.0 [$$ gag $$], which allows
  135. "locking" of accounts after a certain number of bad attempts, or obtain a
  136. logging program to keep track of invalid attempts and origins, then track down
  137. the offenders.  There's no way to stop the violation of the "Copy Protection"
  138. -- it deters only those easily dismayed.  All I can suggest is you keep your
  139. non-PD programs away from Guests or other "non-trusted" persons.
  140.  
  141.  
  142. VAXSHARE, PCLINK, AND OTHER VAX/APPLESHARE SERVER APPS
  143. ~~~~~~~~~ ~~~~~~~ ~~~ ~~~~~ ~~~ ~~~~~~~~~~ ~~~~~~ ~~~~
  144. (3) There are various forms of AppleShare that can be run from a VAX; many
  145. versions of these programs have severe flaws which can also be exploited.
  146.  
  147. * The prime example is the existence of "default" accounts:  while "Guest"
  148. logins might be disallowed, logging in as DEFAULT, password USER has been known
  149. to be effective in "getting in" -- even FIELD, SERVICE has worked.  Pathetic,
  150. isn't it, that these guys haven't picked up on these things?
  151.  
  152. * The existence of a VAXShare [or similar] account used for AppleShare access
  153. can oft times be used to access the VAX.  For instance, if one is aware that a
  154. VAX is being used in an open lab as an AppleShare File Server, one can use
  155. method #1 to extract a username/password combination from the Prep file and use
  156. that password to gain entrance to the VAX.
  157.  
  158. HOW TO SOLVE:  Disallow interactive logins on the VAX-side of the account and
  159. disable or repassword all "default" accounts.  If your version of
  160. VAX/AppleShare requires an interactive login, have a "special" program be run
  161. whenever the user logs in, recording the date, time, and origin of login before
  162. disconnecting.
  163.  
  164.  
  165. SYSTEM 7 FILE SHARING
  166. ~~~~~~ ~ ~~~~ ~~~~~~~
  167. (4) With the advent of System 7.0 and "File Sharing," many users simply put
  168. their machines "on the net" without taking proper measures to disallow
  169. unauthorized access to their machine.  Several people turn Sharing on while
  170. their drive is selected, unwittingly allowing others to read, write, copy,
  171. delete, or modify the information on the drive.  Oddly enough, by default, the
  172. "Trash" folder is locked out, while the System Folder is, by default, left wide
  173. open.  A major oversight on Apple's part...  I suppose it was to discourage the
  174. perceived threat of "digital dumpster diving" ...?  Even I cannot fathom that
  175. one.
  176.  
  177. * Many times the "System Folder" is left unprotected, meaning various system
  178. resources can be copied or modified.  One can leech the AppleTalk Remote Access
  179. files, any Timbuk2 or Timbuk2/Remote programs, etc. and use them to further
  180. penetration.
  181.  
  182. * The "Users & Groups" file can be copied, then modified "at home" by a user
  183. running 7.0 [or by the attacking machine, if it is running 7.0] -- adding
  184. another "owner" account, for instance, to act as a "back door" in the event
  185. guest privileges are locked out by a wiser individual.
  186.  
  187. * The integrity of important files can be challenged; the System file can have
  188. resources moved in and out of it by the attacking computer -- one of these
  189. resources could be a virus, a Trojan horse, or a really stupid font [like New
  190. York -- ugh!].
  191.  
  192. * The disk is usually populated by copyrighted software; one could easily make
  193. pirated copies of that software.
  194.  
  195. * The disk may be home to personal or otherwise "private" files -- files that
  196. can be read, copied, deleted, or even modified.  There was an instance in which
  197. a file on a shared folder was found to contain user names and passwords to a
  198. UNIX box on the campus network... incredibly foolish.  Fortunately, the proper
  199. persons were informed and the files were moved to a [presumably] safer
  200. location.
  201.  
  202. * The attacker could have a malicious streak and choose to delete all that he
  203. sees.
  204.  
  205. HOW TO SOLVE:  Take a giant wooden plank and soundly whack all offending users.
  206. Tell them of the intelligent way to use filesharing, and inform them that
  207. *anyone* can go in and read their resume, love notes, financial info, erotic
  208. poetry, etc.. that usually gets their attention. Tell them to, instead of
  209. sharing the entire hard drive, create a folder and entitle it "Shares" or
  210. something appropriately witty; then select the folder and go to "Sharing..."
  211. To further security, disallow the <Any User> (Guest) logins.  To better keep
  212. track of who's using the Macintosh, keep the "File Sharing Monitor" open or get
  213. a program like NokNok which notifies you when someone is using your Mac.
  214.  
  215.  
  216. NCSA TELNET
  217. ~~~~ ~~~~~~
  218. 5) The NCSA Telnet application allows a user to use his or her Mac as a telnet
  219. client and wander around the Internet.  NCSA Telnet also handles incoming FTP
  220. requests.  While this FTP function is easily disabled, many users keep it on
  221. because they either use it regularly or don't even know it exists.
  222.  
  223. * Anyone with a valid username/password can log in to the Mac via FTP and then
  224. change to the "root" directory and perform the normal FTP functions.. both send
  225. and receive.  This means that *every* file on the Mac can be accessed from
  226. *anywhere* on the Internet.  It should be noted that NCSA Telnet does not log
  227. the "who & where" information, meaning there is no log of who used the machine,
  228. meaning there is no way for an intruder to be "caught."
  229.  
  230. * The file "ftppass" contains the list of users allowed to use FTP on that
  231. Macintosh.  If, by using one of the methods mentioned above, someone is able to
  232. access it, it is easily cracked as it has a rather pathetic encryption scheme:
  233. the data fork contains the user's name, a colon, and then an encrypted
  234. password.  The password is easily decrypted; unless it is the entire 10
  235. characters, the last few characters are in order.  That is, the next ASCII code
  236. is 1 + the previous, etc.  Observe this from my "ftppass" file:
  237.  
  238. sample:ucetcr&'()
  239.  
  240. The first part, "sample," is the user's name.  The colon is the basic UNIX-like
  241. delimiter, the rest is the password.  The "real" part of the password is the
  242. characters "ucetcr" ... the remaining "&'()" are just spaces... how do you
  243. tell?  It's in ASCII order.  Look up "&" on an ASCII chart and "'" will follow,
  244. then "(" then ")" .. you get the idea.
  245.  
  246. This password can be discovered by short program XORing the encrypted
  247. characters with a number between 0 and 255.  The program can either a) dump all
  248. XOR results or b) if the password is not the maximum length, the program can
  249. simply scan for a "space" [ASCII 032 decimal] in the password and print it.
  250. The following "cracking" program is written in BASIC [hey, does anyone use that
  251. any more?] and will allow you to decrypt the passwords.  If you can tell that
  252. the password has spaces at the end, you can go ahead and delete line 110.
  253. Otherwise, leave that line in and use your brain [remember your brain?] to
  254. determine if the encrypted goop is a "real" word or just goop.
  255.  
  256. 5 REM "ftppass" brute-force hacker
  257. 10 INPUT "Encrypted password:";I$
  258. 20 FOR X=1 TO 255
  259. 30 FOR Y=1 TO LEN(I$)
  260. 40 Y$=MID$(I$,Y,1)
  261. 50 YA=ASC(Y$)
  262. 60 N=X XOR YA
  263. 70 IF N=32 THEN F=1
  264. 80 N$=N$+CHR$(N)
  265. 90 NEXT Y
  266. 100 IF F THEN ?"Possible password:"N$
  267. 110 ?I$" 'encrypts' to "N$: REM U can delete this line if len<10
  268. 120 N$="":F=0
  269. 130 NEXT X
  270. 140 ?"Finished."
  271.  
  272. Sample run:  [with line 110 deleted]
  273.  
  274. Encrypted password:ucetcr&'()           [gotta type the whole thing]
  275. Possible password:secret !./            [boy, that was tough!]
  276. Possible password:rdbsdu! /.
  277. Possible password:}km|kz./ !            [etc.. just smack ^C at this point.]
  278.  
  279. So the password is "secret" [clever, no?]
  280.  
  281. It should be noted that this program is rather inelegant as I haven't really
  282. reversed the algorithm, just written a brute-force "hacker" for it.  This is
  283. due to laziness on my part.  If I really wanted to do this properly, I would
  284. FTP to the NCSA anonymous site and leech the 700k+ of source and "reverse" it
  285. thataway.  I don't feel like doing that.  I am lazy.  This program works just
  286. dandy for me... [I suspect the encryption program uses the users' name to
  287. encrypt it, but I don't care enough to find out.]
  288.  
  289. I should say that I don't wish to offend the makers of NCSA Telnet or call the
  290. application crap.  It is, indeed, an impressive piece of work; I simply feel
  291. that there are some aspects of it which could use improvement... if not in
  292. terms of security, then at least allowing the user to save selections to disk!
  293.  
  294. BTW- I know that NCSA Telnet is also available for the IBM.  I haven't tested
  295. these with an IBM, but if it's a "true" port, these flaws should exist under
  296. the IBM version as well.
  297.  
  298.                                - = - = - = - = -
  299.  
  300. Well, that does it.  If you're a network coordinator and you're *still* sitting
  301. on your skinny ass after reading this, get the hell up and fix the problems.
  302. Don't be surprised to find someone running anonymously through your net,
  303. leeching files and generally contributing to moral laxity ...  I've seen it
  304. before -- it's not a pretty sight.
  305.  
  306. And of course, if you run a network of any sort, you must encourage users to
  307. use different passwords on different machines and passwords that don't exist in
  308. a dictionary [gh0ds are we sick of hearing that!].. it will work wonders for
  309. security.  Every hacker knows the number of people who use ONE password to all
  310. of their different accounts is unbelievably high... and they make very good use
  311. of this oversight.
  312.  
  313. - = - = - = - = - = - = - = - =- = - = - = - =- = - = - = - =- = - = - = - = -
  314. ^L
  315.