home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / MISC / HTCA1.ZIP / HOWTOA_1.TXT
Encoding:
Text File  |  1996-05-18  |  18.2 KB  |  337 lines

  1.  
  2. HOW TO CRACK, by +ORC, A TUTORIAL
  3.  
  4. Lesson A.1: Advanced Cracking: Internet Cracking (Unix) 
  5.  
  6. ------------->   INTERNET CRACKING: FIREWALLS
  7.      With each new company that connects to the "Information
  8. Superhighway" new frontiers are created for crackers to explore.
  9. Site administrators (Siteads) have implemented various security
  10. measures to protect their internal networks. One of these is
  11. xinetd, covered later. A more general solution is to construct
  12. a guarded gateway, called a [Firewall], that sits between a
  13. site's internal network and the wild and woolly Internet where
  14. we roam. In fact only one third of all Internet connected
  15. machines are already behind firewalls. Most information services
  16. have to deal with the same problem we have: getting OUT through
  17. a local firewall or GETTING INTO a service through their
  18. Firewall. There lays also the crack_solution.
  19. ------------>         What is a Firewall?
  20.      The main purpose of a Firewall is to prevent unauthorized
  21. access between networks. Generally this means protecting a site's
  22. inner network from the Internet. If a site has a firewall,
  23. decisions have been made as to what is allowed and disallowed
  24. across the firewall. These decisions are always different and
  25. always incomplete, given the multiplicity of Internet, there are
  26. always loopholes where a cracker can capitalize on.
  27.      A firewall basically works by examining the IP packets that
  28. travel between the server and the client. This provides a way to
  29. control the information flow for each service by IP address, by
  30. port and in each direction.
  31.      A firewall embodies a "stance". The stance of a firewall
  32. describes the trade-off between security and ease-of-use. A
  33. stance of the form "that which is not expressly permitted is
  34. prohibited" requires that each new service be enabled
  35. individually and is seldom used, coz very slow and annoying.
  36. Conversely, the stance "that which is not expressly prohibited
  37. is permitted" has traded a level of security for convenience. It
  38. will be useful to guess the stance of the firewall you are
  39. cracking when making probe decisions.
  40.      A firewall has some general responsibilities:
  41. *    First and foremost if a particular action is not allowed by
  42. the policy of the site, the firewall must make sure that all
  43. attempts to perform the action will fail.
  44. *    The firewall should log suspicious events
  45. *    The firewall should alert internal administration of all
  46. cracking attempts
  47. *    Some firewall provide usage statistics as well.
  48.  
  49. ------------>          Types of Firewall
  50.      In order to avoid head-scratching, it's a good idea to know
  51. the TOPOLOGY of "your" firewall -and its limitations- before
  52. attempting to get through it. Discussed below are two popular
  53. firewall topologies. Although other types exist, the two below
  54. represent the basic forms; most other firewalls employ the same
  55. concepts and thus have -luckily- the same limitations.
  56.                    1) THE DUAL-HOMED GATEWAY
  57.      A dual-homed Gateway is a firewall composed of a single
  58. system with at least two network interfaces. This system is
  59. normally configured such that packets are not directly routed
  60. from one network (the Internet) to the other (the internal net
  61. you want to crack). Machines on the Internet can talk to the
  62. gateway, as can machines on the internal network, but direct
  63. traffic between nets is blocked.
  64.      In discussing firewalls, it's generally accepted that you
  65. should think of the inner network as a medieval castle. The
  66. "bastions" of a castle are the critical points where defence is
  67. concentrated. In a dual-homed gateway topology, the dual-homed
  68. host itself is called the [BASTION HOST].
  69.      The main disadvantage of a dual-homed gateway, from the
  70. viewpoints of the users of the network and us crackers alike, is
  71. the fact that it blocks direct IP traffic in both directions. Any
  72. programs running on the inner network that require a routed path
  73. to external machines will not function in this environment. The
  74. services on the internal network don't have a routed path to the
  75. clients outside. To resolve these difficulties, dual-homed
  76. gateways run programs called [PROXIES] to forward application
  77. packets between nets. A proxy controls the conversation between
  78. client and server processes in a firewalled environment. Rather
  79. than communicating directly, the client and the server both talk
  80. to the proxy, which is usually running on the bastion host
  81. itself. Normally the proxy is transparent to the users.
  82.      A proxy on the bastion host does not just allow free rein
  83. for certain services. Most proxy software can be configured to
  84. allow or deny forwarding based on source or destination addresses
  85. or ports. Proxies may also require authentication of the
  86. requester using encryption- or password-based systems.
  87.      The use of proxy software on the bastion host means that the
  88. firewall administrator has to provide replacements for the
  89. standard networking clients, a nightmare in heterogeneous
  90. environments (sites with many different operating systems
  91. platforms, PC, Sun, IBM, DEC, HP...) and a great burden for
  92. administrator and users alike. 
  93.                  2) THE SCREENED HOST GATEWAY
  94.      A screened host gateway is a firewall consisting of at least
  95. one router and a bastion host with a single network interface.
  96. The router is typically configured to block (screen) all traffic
  97. to the internal net such that the bastion host is the only
  98. machine that can be reached from the outside. Unlike the dual-
  99. homed gateway, a screened host gateway does not necessarily force
  100. all traffic through the bastion host; through configuration of
  101. the screening router, it's possible to open "holes" in the
  102. firewall to the other machines on the internal net you want to
  103. get into.
  104.      The bastion host in a screened host firewall is protected
  105. from the outside net by the screening router. The router is
  106. generally configured to only allow traffic FROM SPECIFIC PORTS
  107. on the bastion host. Further, it may allow that traffic only FROM
  108. SPECIFIC EXTERNAL HOSTS. For example the router may allow Usenet
  109. news traffic to reach the bastion host ONLY if the traffic
  110. originated from the site's news provider. This filtering can be
  111. easily cracked: it is relying on the IP address of a remote
  112. machine, which can be forged.
  113.      Most sites configure their router such that any connection
  114. (or a set of allowed connections) initiated from the inside net
  115. is allowed to pass. This is done by examining the SYN and ACK
  116. bits of TCP packets. The "start of connection" packet will have
  117. both bits set. If this packets source address is internal... or
  118. seems to be internal :=) the packet is allowed to pass. This
  119. allows users on the internal net to communicate with the internet
  120. without a proxy service.
  121.      As mentioned, this design also allows "holes" to be opened
  122. in the firewall for machines on the internal net. In this case
  123. you can crack not only the bastion host, but also the inner
  124. machine offering the service. Mostly this or these machine/s will
  125. be far less secure than the bastion host.
  126.      New services, for instance recent WEB services, contain a
  127. lot of back doors and bugs, that you'll find in the appropriate
  128. usenet discussion groups, and that you could use at freedom to
  129. crack inner machines with firewall holes. Sendmail is a good
  130. example of how you could crack in this way, read the whole
  131. related history... very instructive. The rule of thumb is "big
  132. is good": the bigger the software package, the more chance that
  133. we can find some security related bugs... and all packages are
  134. huge nowadays, 'coz the lazy bunch of programmers uses
  135. overbloated, buggy and fatty languages like Visual Basic or
  136. Delphy!
  137. Finally, remember that the logs are 'mostly) not on the bastion
  138. host! Most administrators collect them on an internal machine not
  139. accessible from the Internet. An automated process scan the logs
  140. regularly and reports suspicious information.
  141.                                
  142.                  3) OTHER FIREWALL TOPOLOGIES
  143. The dual-homed gateway and the screened host are probably the
  144. most popular, but by no mean the only firewall topologies. Other
  145. configurations include the simple screening router (no bastion
  146. host), the screened subnet (two screening routers and a bastion
  147. host) as well as many commercial vendor solutions.
  148.  
  149. ------------>   Which software should we study?
  150. Three popular unix software solutions allow clients inside a
  151. firewall to communicate with server outside: CERN Web server in
  152. proxy mode, SOCKS and the TIS Firewall toolkit. 
  153. 1)   The CERN Web server handles not only HTTP but also the other
  154. protocols that Web clients use and makes the remote connections,
  155. passing the information back to the client transparently. X-based
  156. Mosaic can be configured for proxy mode simply by setting a few
  157. environment variables.
  158. 2)   The SOCKS package (available free for anonymous ftp from
  159. ftp.nec.com in the file
  160.         /pub/security/socks.cstc/socks.cstc.4.2.tar.gz
  161. includes a proxy server that runs on the bastion host of a
  162. firewall. The package includes replacements for standard IP
  163. socket calls such as connect(), getsockname(), bind(), accept(),
  164. listen() and select(). In the package there is a library which
  165. can be used to SOCKSify your crack probes.
  166. 3)   The Firewall Toolkit
  167. The toolkit contains many useful tools for cracking firewall and
  168. proxy server. netacl can be used in inetd.conf to conceal
  169. incoming requests against an access table before spawning ftpd,
  170. httpd or other inetd-capable daemons. Mail will be stored in a
  171. chroot()ed area of the bastion for processing (mostly by
  172. sendmail).
  173. The Firewall toolkit is available for free, in anonymous ftp from
  174. ftp.tis.com in the file
  175.                /pub/firewalls/toolkit/fwtk.tar.Z
  176. The popular PC firewall solution is the "PC Socks Pack", for MS-
  177. Windows, available from ftp.nec.com It includes a winsock.dll
  178. file. 
  179.  
  180.      The cracking attempts should concentrate on ftpd, normally
  181. located on the bastion host. It's a huge application, necessary
  182. to allow anonymous ftp on and from the inner net, and full of
  183. bugs and back doors. Normally, on the bastion host, ftpd is
  184. located in a chroot()ed area and runs as nonprivileged user. If
  185. the protection is run from an internal machine (as opposing the
  186. bastion host), you could take advantage of the special inner-net
  187. privileges in hostp.equiv or .rhosts. If the internal machine
  188. "trusts" the server machine, you'll be in pretty easily.
  189.      Another good method, that really works, is to locate your
  190. PC physically somewhere along the route between network and
  191. archie server and "spoof" the firewall into believing that you
  192. are the archie server. You'll need the help of a fellow hacker
  193. for this, though.
  194.      Remember that if you gain supervisor privileges on a machine
  195. you can send packets from port 20, and that in a screened host
  196. environment, unless FTP is being used in proxy mode, the access
  197. filters allow often connections from any external host if the
  198. source port is 20 and the destination port is greater than 1023!
  199.      remember that NCSA Mosaic uses several protocols, each on
  200. a different port, and that -if on the firewall no proxy Web
  201. server is operating- each protocol must be dealt with
  202. individually, what lazy administrators seldom do.
  203.      Be careful for TRAPS: networking clients like telnet and ftp
  204. are often viciously replaced with programs that APPEAR to execute
  205. like their namesake, but actually email an administrator. A
  206. fellow cracker was almost intercepted, once, by a command that
  207. simulated network delays and spat out random error messages in
  208. order to keep me interested long enough to catch me. Read the
  209. (fictions) horror story from Bill Cheswick: "An evening with
  210. Berferd in which a cracked is lured, endured and studied",
  211. available from ftp.research.att.com in
  212.               /dist/internet_security/berferd.ps
  213. As usual, all kind of traps can be located and uncovered by
  214. correct zen-cracking: you must *FEEL* that some code (or that
  215. some software behaviour) is not "genuine". Hope you believe me
  216. and learn it before attempting this kind of cracks. 
  217.  
  218. ------------>      How do I crack Firewalls?
  219.      Some suggestions have been given above, but teaching you how
  220. to crack firewalls would take at least six complete tutorial
  221. lessons for a relatively unimportant cracking sector, and you
  222. would almost surely get snatched immediately, 'coz you would
  223. believe you can crack it without knowing nothing at all. So, for
  224. your sake, I'll teach you HOW TO LEARN IT, not HOW TO DO IT
  225. (quite a fascinating difference): First Text, then the software
  226. above. For text, start with Marcus Ranum's paper "Thinking about
  227. Firewalls", available from ftp.tis.com in the file/pub/firewalls/firewalls.ps.Z
  228. and do an archie search for newer literature.
  229. Join the firewall discussion list sending a message to
  230. majordomo@greatcircle.com, you'll get a message with
  231. instructions, as usual, lurk only... never show yourself to the
  232. others.
  233.      You can find for free on the web quite a lot of early
  234. versions of proxy software. Study it, study it and then study it
  235. again. The cracking efforts on your copies, and your machines,
  236. before attempting anything serious, are MANDATORY if you do not
  237. want to be immediately busted on the Internet. When you feel
  238. ready to try serious cracking, you must OBLIGATORY start with a
  239. small BBS which uses a firewall version you already studied very
  240. well (sysops are not firewall administrators, and many of them
  241. do not know nothing about the software they use). As soon as you
  242. gain access to the bastion host, remember to subvert entirely the
  243. firewall itself before entering the inner net.  
  244. If you feel ready and everything went well so far, if your zen-
  245. cracking abilities are working well... then take a moment for
  246. yourself... prepare yourself a good Martini-Wodka (you should
  247. only use Moskovskaia), take a deep breath and by all means go
  248. ahead! You will then be able to try your luck on the Cyberspace
  249. and get quickly busted (if you did not follow my admonitions and
  250. if you cannot zen-crack) or, may be, fish quite a lot of
  251. jewels... :=) 
  252.  
  253. ------------->     INTERNET CRACKING: XINETD
  254.      [Xinetd] a freely available enhanced replacement for the
  255. internet service daemon inetd, allows just those particular users
  256. to have FTP or Telnet access, without opening up access to the
  257. world. Xinetd can only protect the system from intrusion by
  258. controlling INITIAL access to most system services and by logging
  259. activities so that you can detect break-in attempts. However,
  260. once a connection has been allowed to a service, xinetd is out
  261. of the picture. It cannot protect against a server program that
  262. has security problems internally. For example, the finger server
  263. had a bug several years ago that allowed a particularly clever
  264. person to overwrite part of its memory. This was used to gain
  265. access to many systems. Even placing finger under the control of
  266. xinetd wouldn't have helped.
  267.      Think of the secured firewall system as a fortress wall:
  268. each service that is enabled for incoming connections can be
  269. viewed as a door or window in the walls. Not all these doors have
  270. secure and reliable locks. The more openings are available, the
  271. more opportunities are open for us.
  272. ------------->         What xinetd does
  273. Xinetd listens to all enabled service ports and permits only
  274. those incoming connection request that meet authorization
  275. criteria.
  276. -    Accept connections from only certain IP addresses
  277. -    Accept connections only from authorized users
  278. -    Reject connections outside of aithorized hours
  279. -    Log selected service when connections are accepted or
  280.      rejected, capturing following informations: 
  281.      * Remote Host Address
  282.      * User ID of remote user (in some cases)
  283.      * Entry and Exit time
  284.      * Terminal type 
  285.      Support login, shell, exec and finger
  286.  
  287. ------------->        SERVICES TO CRACK &
  288.                   UNWITTING INSIDE COMPLICES
  289. In this order the easy services:
  290.      FTP  TELNET    LOGIN (rlogin) SHELL (rcmd)   EXEC
  291. In this order the more difficult ones:
  292.      MOUNT     TFT  FINGER    NFS(Network File System) 
  293.      DNS(Domain Name Service)
  294. Remember that sendmail (SMTP), by default, accepts a message from
  295. any incoming connection. The "sender" of such a message can
  296. appear to have originated anywhere, therefore your claim of
  297. identity will be accepted! Thus you can forge a message's
  298. originator. Most of the recipients inside the protected
  299. (firewalled) net will take your claim at face value and send you
  300. (to the "return address" you provide) all the sensitive
  301. information you need to crack the system. Finding unwitting
  302. inside complices is most of the time pretty easy.
  303.      By far the best method, for entering xinetd, is to get the
  304. real version from panos@cs.colorado.edu, modify the system files
  305. in order to have some backdoors, and then distribute them to the
  306. mirror servers on the WEB. Each time a new administrator will
  307. download "your" version of xinetd, you'll have an easy access to
  308. the "protected" system.
  309.      On the Nets, it's important to conceal your identity (they
  310. will find you out pretty quickly if you do not). The best method
  311. is to obtain the IP address of a legitimate workstation during
  312. normal hours. Then, late at night, when the workstation is known
  313. to be powered-off or disconnected from a dialup PPP link, a
  314. different node on the network can be configured to use the
  315. counterfeit IP address. To everyone on the network, it will
  316. appear that the "legitimate" user is active. If you follow this
  317. strategy, you may want to crack somehow more negligently... the
  318. search for the cracker will go on -later- in the false confidence
  319. that a sloppy novice (the legitimate user) is at work, this will
  320. muddle the waters a little more.
  321.  
  322. Well, that's it for this lesson, reader. Not all lessons of my
  323. tutorial are on the Web.
  324.  
  325.      You'll obtain the missing lessons IF AND ONLY IF you mail
  326. me back (via anon.penet.fi) with some tricks of the trade I may
  327. not know that YOU discovered. Mostly I'll actually know them
  328. already, but if they are really new you'll be given full credit,
  329. and even if they are not, should I judge that you "rediscovered"
  330. them with your work, or that you actually did good work on them,
  331. I'll send you the remaining lessons nevertheless. Your
  332. suggestions and critics on the whole crap I wrote are also
  333. welcomed.
  334.  
  335. +ORC   an526164@anon.penet.fi 
  336.  
  337.