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