home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / +Sandman / Htocrka1.txt < prev    next >
Text File  |  2000-05-25  |  19KB  |  652 lines

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