home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / security / 5238 < prev    next >
Encoding:
Text File  |  1992-12-29  |  2.5 KB  |  66 lines

  1. Newsgroups: alt.security
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!ghost.dsi.unimi.it!vince
  3. From: vince@ghost.dsi.unimi.it (David Vincenzetti)
  4. Subject: Fooling DNS-based authentication
  5. Organization: Computer Science Dep. - Milan University
  6. Date: Tue, 29 Dec 1992 15:59:17 GMT
  7. Message-ID: <1992Dec29.155917.848@ghost.dsi.unimi.it>
  8. Lines: 51
  9.  
  10. I've been experimenting with ~/.rhosts and /etc/hosts.equiv security
  11. with Sun machines lately, and I've found some interesting things I
  12. would like to discuss. Suppose that host COMMERCIAL.COM has the
  13. following /.rhost:
  14.  
  15.     COMMERCIAL2.COM        root
  16.  
  17. Then I change my name server record to rename my site HACKER.COM to
  18. COMMERCIAL2.COM. Then I type in the following command:
  19.  
  20.     # id
  21.     uid=0(root) gid=0(root)
  22.     # rsh -l root COMMERCIAL.COM
  23.  
  24. What do you think it happens? This is what happens: usually I don't
  25. get access but *sometimes*, when COMMERCIAL.COM's nameserver is slow
  26. or other the trick *does* work and I successfully log in.
  27.  
  28. I don't have Sun's rshd.c handy, it is probably not available at all
  29. since it seems Sun Inc. never releases sources, but the following comes
  30. from BSD's rshd.c source:
  31.  
  32.     [...]
  33.     getpeername(0, (struct sockaddr *)&from, &fromlen)
  34.     [...]
  35.         hp = gethostbyaddr((char *)&fromp->sin_addr, sizeof (struct in_addr),
  36.                 fromp->sin_family);
  37.         if (hp) {
  38.                 /*
  39.                  * If name returned by gethostbyaddr is in our domain,
  40.                  * attempt to verify that we haven't been fooled by someone
  41.                  * in a remote net; look up the name and check that this
  42.                  * address corresponds to the name.
  43.                  */
  44.                 hostname = hp->h_name;
  45.                 hp = gethostbyname(remotehost);
  46.     [...]
  47.  
  48. Gethostbyname() may fail sometimes, for istance the nameserver could
  49. be unreachable or too slow. If it happens BSD's rshd sets the name of
  50. the remote host to inet_ntoa(fromp->sin_addr), so it is not possible
  51. to fool the rsh daemon. Sun's rshd, on the contrary, seems to act a
  52. malenky bit randomly: sometimes you log in, sometimes you don't.
  53.  
  54. What is the reason of this strange behaviour? Can anyone clear me
  55. the point? I know this is all undocumented stuff but I'm truly
  56. interested in the matter since I'm adminstrating the security of
  57. many machines, including Suns. Many thanks in advance.
  58.  
  59. Regards,
  60. David
  61. -- 
  62. David Vincenzetti, system administrator
  63. Department of Computer Science,         Email: vince@ghost.dsi.unimi.it
  64. via Comelico 41, 20135 Milan, ITALY     Phone: ++39 2 55006 391
  65. $PUBLIC KEY available by finger(1)$     Fax  : ++39 2 55006 373
  66.