home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / network / esniff.dbk < prev    next >
Encoding:
Text File  |  2003-06-11  |  6.9 KB  |  132 lines

  1.  
  2.  From : Brian Jones                                            06 Mar 98
  3.  Subj : Ethernet Sniffers Debunked, err Explained                               
  4. ────────────────────────────────────────────────────────────────────────────────
  5. From: Brian Jones <balif@dada.darkriMUNGEdge.com>
  6.  
  7. sorry, couldn't resist on the subject
  8.  
  9.     Here's a message I wrote a while back for the mailing list of the
  10. group I've been in for a while. Unlike some member, err Members of this
  11. group, I type my own words, and don't copy from existing texts. Well okay,
  12. I copied from an existing text, but it was MY OWN text. (chuckle)
  13.  
  14.  
  15. Ethernet Sniffers Explained
  16. This is a very basic, overly simplified explanation of how ethernet and eth
  17. sniffing works. There are many books detailing Network Layer Protocol and
  18. all the good stuff. Read them if you are interested.
  19.  
  20. ~=-/wire/----------------------------------------------------------=~
  21.             |                |                     |
  22.         computer a        computer b          computer c
  23.         192.168.1.1       192.168.1.2         192.168.1.3
  24.  
  25. Ethernet is known as a "Broadcast" method of networking. Everything is
  26. done on a common wire. All the computers are connected to this common
  27. wire. Packets are broadcast to every machine on the network, and only the
  28. machine that the packet is addressed too does something with it. This is
  29. different from other older networks such as Token ring, where the computers
  30. are connected in a large ring and a special packet called a token is passed
  31. from computer to computer, and to send a packet to another computer a system
  32. adds it to the token.
  33.  
  34. When an ethernet card wants to send out a packet of information, it
  35. "listens" to see if the line is currently used. Then it sends its packet.
  36. The packet has a from address, say 192.168.1.1. It has a To address, say
  37. 192.168.1.3. The packet is "Broadcasted" out onto the ethernet. All the
  38. computers recieve it. In this example, 192.168.1.2 would recieve the
  39. packet. Its ethernet card would say "Hmm.. nope not for me" and dumps the
  40. packet. However, 192.168.1.3 would say "Hey thats me" and save the packet,
  41. most likely passing it to an application or program for use.
  42.  
  43. Since the computers all broadcast on the same wire, something interesting
  44. can happen. If two cards want to send at the same time, take a look at the
  45. wire and see its unused, then send at the same time, something called a
  46. "Packet Collision" occurs. The cards detect this, and all cards ignore
  47. the corrupted packet. The sending cards wait a random amount of time, then
  48. attempt to send again. Complex formulas and timing in modern day ethernet
  49. cards reduce Packet Collision. Modern cards send so fast, several dozen
  50. collisions could happen and you'd never even notice. After all, most cards
  51. are 10 or 100 mbs. One packet probably takes a nanosecond or so to send.
  52.  
  53. Now that you know how ethernet broadcasts packets to all the computers,
  54. you can understand how sniffing works.
  55.  
  56. An ethernet sniffer is a program, run by root, that does something special
  57. to the ethernet card. It sets it in a mode called "promiscuous" mode.
  58. Simplified, this means that instead of having the ethernet card dump all
  59. packets it "hears" not addressed to itself, it passes them up to be
  60. examined by the ethernet sniffer.
  61.  
  62. Scenario:
  63. 192.168.1.1 is the box we hacked. We are running a sniffer on it.
  64. 192.168.1.2 is some guy's machine on the same network.
  65. 192.168.1.3 is the guy's friend's machine.
  66.  
  67. The friend on .3  wants to login to his buddies machine on .2. So he
  68. telnets over. Telnet opens the socket, and connects to the machine. Behind
  69. the scenes, the kernel, the ethernet drivers, and the ethernet cards do
  70. their magic. 192.168.1.3 broadcasts over the ethernet "Hey, I want to
  71. connect to 192.168.1.2 on port 23 using TCP".  .2 grabs the packets
  72. addressed to it, passes them up to the system, who knows what's going on and
  73. starts sending the appropriate data over the wire basically saying "Okay .3
  74. lets do this." and the connection happens. This is INCREDIBLY simplified.
  75.  
  76.     Meanwhile.. our sniffer on 1.1, which has been casually watching
  77. the ethernet, notices this and perks up. It dumps to the log file
  78. "192.168.1.3 -> 192.168.1.2 23", which means .3 connected to .2's telnet
  79. port. (Different sniffers will produce different output.)
  80.  
  81.         The friend types in his login name, and then his password. This gets
  82. broadcasted over the ethernet, where it's picked up by
  83. .2 who most likely will verify the password is right, and then let him
  84. login to his shell.
  85.  
  86.     Our ethernet sniffer on .1 says "yay!" and records the login and
  87. password, which is UNENCRYPTED and sent PLAINTEXT over the ethernet. Our
  88. ethernet sniffer can be setup to log the entire connection, or just wait for
  89. login and passwords to come by, or log the first 500 bytes of the
  90. connection, whatever we want. We come back a day later, and examine it, and
  91. get the password.
  92.  
  93. (Simplified)
  94.     A host on the internet most likely has its net connection attached
  95. to a router. The router will often times be called a "Gateway". An example
  96. of a router is a Cisco. The router broadcasts packets coming from the
  97. net to the ethernet, to be picked up by machines they are directed at.
  98. Or it gets packets being broadcast by machines destined for remote machines,
  99. and sends them over the internet connection, be it a T1 or an ISDN line. The
  100. servers are set to have their default gateway be the address of the router.
  101.  
  102.     If we setup a sniffer on one of those machines, we can moniter all
  103. traffic coming from the outside to inside machines, or from inside machines
  104. to the outside internet, or from inside machines to inside machines. We can
  105. capture ftp passwords, pop passwords, telnet login passwords, anything we
  106. want to monitor.
  107.  
  108.     That, very simply described, is ethernet sniffing. Its not some
  109. magical program you run on your modem to sniff a remote isp and get all
  110. sorts of "k-rad stuff". It works because ethernet broadcasts everything
  111. over a single wire.
  112.  
  113.     To stop ethernet sniffing, people
  114. 1: Use encryption programs like ssh (secure shell) to encrypt transfers
  115. 2: segment a large ethernet (like a university). Instead of one big wire,
  116.    it's broken down into groups of machines, reducing the impact of a
  117.    sniffer setup somewhere. The machines are connected via some secure
  118.    hubs or something like that
  119. 3: Various forms of encryption through the ethernet drivers or even hardware
  120. based encryption.
  121.  
  122.     If you've read anything about Cable modems, you know they are all on
  123. a common wire based on geographic area. Your entire neighborhood, or city
  124. could be on the same wire. That means anyone down the block, street, or road
  125. from you with another cable modem can sniff your connection. Think your
  126. neighbors are stupid? It's not too hard for their 14 year old kid to find
  127. some "eleet windowz sn1ffer" and run it. All the more reason to encrypt your
  128. connections.
  129.  
  130.     Feel free to make any additions or corrections
  131.  
  132.