home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / vol1 / gtmhh2-1.zip / GTMHH2-1.TXT
Text File  |  1997-05-28  |  25KB  |  461 lines

  1. _____________________________________________________________
  2.  
  3. GUIDE TO (mostly) HARMLESS HACKING
  4.  
  5. Vol. 2 Number 1
  6.  
  7. Internet for Dummies -- skip this if you are a Unix wizard. But if you read
  8. on you'll get some more kewl hacking instructions.
  9. ______________________________________________________________
  10.  
  11. The six Guides to (mostly) Harmless Hacking of Vol. 1 jumped immediately
  12. into how-to hacking tricks. But if you are like me, all those details of
  13. probing ports and playing with hypotheses and pinging down hosts gets a
  14. little dizzying.
  15.  
  16. So how about catching our breath, standing back and reviewing what the heck
  17. it is that we are playing with? Once we get the basics under control, we
  18. then can move on to serious hacking.
  19.  
  20. Also,  I have been wrestling with my conscience over whether to start giving
  21. you step-by-step instructions on how to gain root access to other peoples'
  22. computers. The little angel on my right shoulder whispers, "Gaining root
  23. without permission on other people's computers is not nice. So don't tell
  24. people how to do it." The little devil on my left shoulder says, "Carolyn,
  25. all these hackers think you don't know nothin'! PROOVE to them you know how
  26. to crack!" The little angel says, "If anyone reading Guide to (mostly)
  27. Harmless Hacking tries out this trick, you might get in trouble with the law
  28. for conspiracy to damage other peoples' computers." The little devil says,
  29. "But, Carolyn, tell people how to crack into root and they will think you
  30. are KEWL!"
  31.  
  32. So here's the deal. In this and the next few issues of Guide to (mostly)
  33. Harmless Hacking I'll tell you several ways to get logged on as the
  34. superuser in the root account of some Internet host computers. But the
  35. instructions will leave a thing or two to the imagination.
  36.  
  37. My theory is that if you are willing to wade through all this, you probably
  38. aren't one of those cheap thrills hacker wannabes who would use this
  39. knowledge to do something destructive that would land you in jail.
  40.  
  41. *****************************
  42. Technical tip: If you wish to become a *serious* hacker, you'll need Linux
  43. (a freeware variety of Unix) on your PC. One reason is that then you can
  44. crack into root legally all you want -- on your own computer. It sure beats
  45. struggling around on someone else's computer only to discover that what you
  46. thought was root was a cleverly set trap and the sysadmin and FBI laugh at
  47. you all the way to jail.
  48.  
  49. Linux can be installed on a PC with as little as a 386 CPU, only 2 Mb RAM
  50. and as little as 20 MB of hard disk. You will need to reformat your hard
  51. disk. While some people have successfully installed Linux without trashing
  52. their DOS/Windows stuff,  don't count on getting away with it. Backup,
  53. backup, backup! 
  54. *****************************
  55. *****************************
  56. You can go to jail warning: Crack into root on someone else's computer and
  57. the slammer becomes a definite possibility. Think about this: when you see a
  58. news story about some hacker getting busted, how often do you recognize the
  59. name? How often is the latest bust being done to someone famous, like Dark
  60. Tangent or se7en or Emmanuel Goldstein? How about, like, never! That's
  61. because really good hackers figure out how to not do stupid stuff. They
  62. learn how to crack into computers for the intellectual challenge and to
  63. figure out how to make computers safe from intruders. They don't bull their
  64. way into root and make a mess of things, which tends to inspire sysadmins to
  65. call the cops.
  66.  
  67. *********************************
  68. Exciting notice: Is it too boring to just hack into your own Linux machine?
  69. Hang in there. Ira Winkler of the National Computer Security Association,
  70. Dean Garlick of the Space Dynamics Lab of Utah State University and I are
  71. working on setting up hack.net, a place where it will be legal to break into
  72. computers. Not only that, we're looking for sponsors who will give cash
  73. awards and scholarships to those who show the greatest hacking skills. Now
  74. does that sound like more phun than jail?
  75. *****************************
  76. So, let's jump into our hacking basics tutorial with a look at the wondrous
  77. anarchy that is the Internet. 
  78.  
  79. Note that these Guides to (mostly) Harmless Hacking focus on the Internet.
  80. That is because there are many legal ways to hack on the Internet. Also,
  81. there are over 10 million of these readily hackable computers on the
  82. Internet, and the number grows every day.
  83.  
  84. Internet Basics
  85.  
  86. No one owns the Internet. No one runs it. It was never planned to be what it
  87. is today. It just happened, the mutant outgrowth of a 1969 US Defense
  88. Advanced Research Projects Agency experiment.
  89.  
  90. This anarchic system remains tied together because its users voluntarily
  91. obey some basic rules. These rules can be summed up in two words: Unix and
  92. TCP/IP (with a nod to UUCP). If you understand, truly understand Unix and
  93. TCP/IP (and UUCP), you will become a fish swimming in the sea of cyberspace,
  94. an Uberhacker among hacker wannabes, a master of the Internet universe.
  95.  
  96. To get technical, the Internet is a world-wide distributed
  97. computer/communications network held together by a common communications
  98. standard, Transmission Control Protocol/Internet Protocol (TCP/IP) and a bit
  99. of UUCP. These standards allow anyone to hook up a computer to the Internet,
  100. which then becomes another node in this network of the Internet. All that is
  101. needed is to get an Internet address assigned to the new computer, which is
  102. then known as an Internet "host," and tie into an Internet communications
  103. link. These links are now available in almost all parts of the world.
  104.  
  105. If you use an on-line service from your personal computer, you, too, can
  106. temporarily become part of the Internet. There are two main ways to hook up
  107. to an on-line service. 
  108.  
  109. There is the cybercouch potato connection that every newbie uses. It
  110. requires either a point-to-point (PPP) or SLIPconnection, which allows you
  111. to run pretty pictures with your Web browser. If you got some sort of
  112. packaged software from your ISP, it automatically gives you this sort of
  113. connection.
  114.  
  115. Or you can connect with a terminal emulator to an Internet host. This
  116. program may be something as simple as the Windows 3.1 "Terminal" program
  117. under the "Accessories" icon. Once you have  dialed in and connected you are
  118. just another terminal on this host machine. It won't give you pretty
  119. pictures. This connection will be similar to what you get on an
  120. old-fashioned BBS. But if you know how to use this kind of connection, it
  121. could even give you root access to that host. 
  122.  
  123. But how is the host computer you use attached to the Internet? It will be
  124. running some variety of the Unix operating system. Since Unix is so easy to
  125. adapt to almost any computer, this means that almost any computer may become
  126. an Internet host.
  127.  
  128. For example, I sometimes enter the Internet through a host which is a
  129. Silicon Graphics Indigo computer at Utah State University. Its Internet
  130. address is fantasia.idec.sdl.usu.edu. This is a computer optimized for
  131. computer animation work, but it can also operate as an Internet host. On
  132. other occasions the entry point used may be pegasus.unm.edu, which is an IBM
  133. RS 6000 Model 370. This is a computer optimized for research at the
  134. University of New Mexico.  
  135.  
  136. Any computer which can run the necessary software -- which is basically the
  137. Unix operating system -- has a modem, and is tied to an Internet
  138. communications link, may become an Internet node. Even a PC may become an
  139. Internet host by running one of the Linux flavors of Unix. After setting it
  140. up with Linux you can arrange with the ISP of your choice to link it
  141. permanently to the Internet.
  142.  
  143. In fact, many ISPs use nothing more than networked PCs running Linux! 
  144.  
  145. As a result, all the computing, data storage, and sending, receiving and
  146. forwarding of messages on the Internet is handled by the millions of
  147. computers of many types and owned by countless companies, educational
  148. institutions, governmental entities and even individuals.
  149.  
  150. Each of these computers has an individual address which enables it to be
  151. reached through the Internet if hooked up to a appropriate communications
  152. link. This address may be represented in two ways: as a name or a number. 
  153.  
  154. The communications links of the Internet are also owned and maintained in
  155. the same anarchic fashion as the hosts. Each owner of an Internet host is
  156. responsible for finding and paying for a communications link that will get
  157. that host tied in with at least one other host.  Communications links may be
  158. as simple as a phone line, a wireless data link such as cellular digital
  159. packet data, or as complicated as a high speed fiber optic link. As long as
  160. the communications link can use TCP/IP or UUCP, it can fit into the Internet.
  161.  
  162. Thus the net grows with no overall coordination. A new owner of an Internet
  163. host need only get permission to tie into one communications link to one
  164. other host. Alternatively, if the provider of the communications link
  165. decides this host is, for example, a haven for spammers, it can cut this
  166. "rogue site" off of the Internet. The rogue site then must snooker some
  167. other communications link into tying it into the Internet again.
  168.  
  169. The way most of these interconnected computers and communications links work
  170. is through the common language of the TCP/IP protocol. Basically, TCP/IP
  171. breaks any Internet communication into discrete "packets." Each packet
  172. includes information on how to rout it, error correction, and the addresses
  173. of the sender and recipient. The idea is that if a packet is lost, the
  174. sender will know it and resend the packet. Each packet is then launched into
  175. the Internet. This network may automatically choose a route from node to
  176. node for each packet using whatever is available at the time, and
  177. reassembles the packets into the complete message at the computer to which
  178. it was addressed. 
  179.  
  180. These packets may follow tortuous routes. For example, one packet may go
  181. from a node in Boston to Amsterdam and back to the US for final destination
  182. in Houston, while another packet from the same message might be routed
  183. through Tokyo and Athens, and so on. Usually, however, the communications
  184. links are not nearly so torturous. Communications links may include fiber
  185. optics, phone lines and satellites. 
  186.  
  187. The strength of this packet-switched network is that most messages will
  188. automatically get through despite heavy message traffic congestion and many
  189. communications links being out of service. The disadvantage is that messages
  190. may simply disappear within the system. It also may be difficult to reach
  191. desired computers if too many communications links are unavailable at the time. 
  192.  
  193. However, all these wonderful features are also profoundly hackable. The
  194. Internet is robust enough to survive -- so its inventors claim -- even
  195. nuclear war. Yet it is also so weak that with only a little bit of
  196. instruction, it is possible to learn how to seriously spoof the system
  197. (forged email) or even temporarily put out of commission other people's
  198. Internet host computers (flood pinging, for example.)
  199.  
  200. On the other hand, the headers on the packets that carry hacking commands
  201. will give away the account information from which a hacker is operating. For
  202. this reason it is hard to hide perfectly when on the Internet.
  203.  
  204. It is this tension between this power and robustness and weakness and
  205. potential for confusion that makes the Internet a hacker playground.
  206.  
  207. For example, HERE IS YOUR HACKER TIP YOU'VE BEEN WAITING FOR THIS ISSUE:
  208.  
  209. ftp://ftp.secnet.com
  210.  
  211. This ftp site was posted on the BUGTRAQ list, which is dedicated to
  212. discussion of Unix security holes. Moderator is Aleph One, who is a genuine
  213. Uberhacker. If you want to subscribe to the BUGTRAQ, email
  214. LISTSERV@netspace.org with message "subscribe BUGTRAQ."
  215.  
  216. Now,  back to Internet basics.
  217.  
  218. History of Internet
  219.  
  220. As mentioned above, the Internet was born as a US Advanced Research Projects
  221. Agency (ARPA) effort in 1969. Its inventors called it ARPANET. But because
  222. of its value in scientific research, the US National Science Foundation
  223. (NSF) took it over in 1983. But over the years since then it gradually
  224. evolved away from any single source of control. In April 1995 NSF cut the
  225. last apron strings. Now the Internet is run by no one. It just happens and
  226. grows out of the efforts of those who play with it and struggle with the
  227. software and hardware.
  228.  
  229. Nothing at all like this has ever happened before. We now have a computer
  230. system with a life of its own. We, as hackers, form a big part of the
  231. mutation engine that keeps the Internet evolving and growing stronger. We
  232. also form a big part of the immune system of this exotic creature.
  233.  
  234. The original idea of ARPANET was to design a computer and communications
  235. network that would eventually become so redundant, so robust, and so able to
  236. operate without centralized control, that it could even survive nuclear war.
  237. What also happened was that ARPANET evolved into a being that has survived
  238. the end of government funding without even a blip in its growth. Thus its
  239. anarchic offspring, the Internet, has succeeded beyond the wildest dreams of
  240. its original architects.
  241.  
  242. The Internet has grown explosively, with no end in sight. At its inception
  243. as ARPANET it held only 4 hosts. A quarter of a century later, in 1984, it
  244. contained only 1000 hosts. But over the next 5 years this number grew
  245. tenfold to 10,000 (1989). Over the following 4 years it grew another tenfold
  246. to 1 million (1993). Two years later, at the end of 1995, the Internet was
  247. estimated to have at least 6 million host computers. There are probably over
  248. 10 million now. There appears to be no end in sight yet to the incredible
  249. growth of this mutant child of ARPANET.
  250.  
  251. In fact, one concern raised by the exponential growth in the Internet is
  252. that demand may eventually far outrace capacity. Because now no entity owns
  253. or controls the Internet, if the capacity of the communications links among
  254. nodes is too small, and it were to become seriously bogged down, it might be
  255. difficult to fix the problem.
  256.  
  257. For example, in 1988, Robert Morris, Jr. unleashed a "virus"-type program on
  258. the Internet commonly known as the "Morris Worm." This virus would make
  259. copies of itself on whatever computer it was on and then send copies over
  260. communications links to other Internet hosts. (It used a bug in sendmail
  261. that allowed access to root, allowing the virus to act as the superuser).
  262.  
  263. Quickly the exponential spread of this virus made the Internet collapse from
  264. the communications traffic and disk space it tied up.
  265.  
  266. At the time the Internet was still under some semblance of control by the
  267. National Science Foundation and was connected to only a few thousand
  268. computers. The Net was shut down and all viruses purged from its host
  269. computers, and then the Net was put back into operation. Morris, meanwhile,
  270. was put in jail.
  271.  
  272. There is some concern that, despite improved security measures (for example,
  273. "firewalls"), someone may find a new way to launch a virus that could again
  274. shut down the Internet. Given the loss of centralized control, restarting it
  275. could be much more time-consuming if this were to happen again. 
  276.  
  277. But reestablishing a centralized control today like what existed at the time
  278. of the "Morris Worm" is likely to be impossible. Even if it were possible,
  279. the original ARPANET architects were probably correct in their assessment
  280. that the Net would become more susceptible for massive failure rather than
  281. less if some centralized control were in place.
  282.  
  283. Perhaps the single most significant feature of today's Internet is this lack
  284. of centralized control. No person or organization is now able to control the
  285. Internet. In fact, the difficulty of control became an issue as early as its
  286. first year of operation as ARPANET. In that year email was spontaneously
  287. invented by its users. To the surprise of ARPANET's managers, by the second
  288. year email accounted for the bulk of the communication over the system.
  289.  
  290. Because the Internet had grown to have a fully autonomous, decentralized
  291. life of its own, in April 1995, the NSF quit funding  NSFNET, the fiber
  292. optics communications backbone which at one time had given NSF the
  293. technology to control the system. The proliferation of parallel
  294. communications links and hosts had by then completely bypassed any
  295. possibility of centralized control.
  296.  
  297. There are several major features of the Internet:
  298.  
  299. * World Wide Web -- a hypertext publishing network and now the fastest
  300. growing part of the Internet. 
  301. * email -- a way to send electronic messages
  302. * Usenet -- forums in which people can post and view public messages
  303. * telnet -- a way to login to remote Internet computers 
  304. * file transfer protocol -- a way to download files from remote Internet
  305. computers
  306. * Internet relay chat -- real-time text conversations -- used primarily by
  307. hackers and other Internet old-timers
  308. * gopher -- a way of cataloging and searching for information. This is
  309. rapidly growing obsolete.
  310.  
  311. As you port surfers know, there are dozens of other interesting but less
  312. well known services such as whois, finger, ping etc.
  313.  
  314. The World Wide Web
  315.  
  316. The World Wide Web is the newest major feature of the Internet, dating from
  317. the spring of 1992. It consists of  "Web pages," which are like pages in a
  318. book, and links from specially marked words, phrases or symbols on each page
  319. to other Web pages. These pages and links together create what is known as
  320. "hypertext." This technique makes it possible to tie together many different
  321. documents which may be written by many people and stored on many different
  322. computers around the world into one hypertext document.
  323.  
  324. This technique is based upon the Universal Resource Locator (URL) standard,
  325. which specifies how to hook up with the computer and access the files within
  326. it where the data of a Web page may be stored.
  327.  
  328. A URL is always of the form http://<rest of address>, where <rest of
  329. address> includes a domain name which must be registered with an
  330. organization called InterNIC in order to make sure that two different Web
  331. pages (or email addresses, or computer addresses) don't end up being
  332. identical. This registration is one of the few centralized control features
  333. of the Internet.
  334.  
  335. Here's how the hypertext of the World Wide Web works. The reader would come
  336. to a statement such as "our company offers LTL truck service to all major US
  337. cities." If this statement on the "Web page" is highlighted, that means that
  338. a click of the reader's computer mouse will take him or her to a new Web
  339. page with details. These may include complete schedules and a form to fill
  340. out to order a pickup and delivery.
  341.  
  342. Some Web pages even offer ways to make electronic payments, usually through
  343. credit cards. 
  344.  
  345. However, the security of money transfers over the Internet is still a major
  346. issue. Yet despite concerns with verifiability of financial transactions,
  347. electronic commerce over the Web is growing fast. In its second full year of
  348. existence, 1994, only some $17.6 million in sales were conducted over the
  349. Web. But in 1995, sales reached $400 million. Today, in 1996, the Web is
  350. jammed with commercial sites begging for your credit card information.
  351.  
  352. In addition, the Web is being used as a tool in the distribution of a new
  353. form of currency, known as electronic cash. It is conceivable that, if the
  354. hurdle of verifiability may be overcome, that electronic cash (often called
  355. ecash) may play a major role in the world economy, simplifying international
  356. trade. It may also eventually make national currencies and even taxation as
  357. we know it obsolete.
  358.  
  359. Examples of Web sites where one may obtain ecash include the Mark Twain Bank
  360. of St. Louis, MO (http://www.marktwain.com) and Digicash of Amsterdam, The
  361. Netherlands (http://www.digicash.com).
  362.  
  363. The almost out-of-control nature of the Internet manifests itself on the
  364. World Wide Web. The author of a Web page does not need to get permission or
  365. make any arrangement with the authors of other Web pages to which he or she
  366. wishes to establish links. Links may be established automatically simply by
  367. programming in the URLs of desired Web page links.
  368.  
  369. Conversely, the only way the author of a Web page can prevent other people
  370. from reading it or establishing hypertext links to it is to set up a
  371. password protection system (or by not having communications links to the
  372. rest of the Internet).
  373.  
  374. A problem with the World Wide Web is how to find things on it. Just as
  375. anyone may hook a new computer up to the Internet, so also there is no
  376. central authority with control or even knowledge of what is published where
  377. on the World Wide Web. No one needs to ask permission of a central authority
  378. to put up a Web page. 
  379.  
  380. Once a user knows the address (URL) of a Web page, or at least the URL of a
  381. Web page that links eventually to the desired page, then it is possible (so
  382. long as communications links are available) to almost instantly hook up with
  383. this page. 
  384.  
  385. Because of the value of knowing URLs, there now are many companies and
  386. academic institutions that offer searchable indexes (located on the Web) to
  387. the World Wide Web. Automated programs such as Web crawlers search the Web
  388. and catalog the URLs they encounter as they travel from hypertext link to
  389. hypertext link. But because the Web is constantly growing and changing,
  390. there is no way to create a comprehensive catalog of the entire Web. 
  391.  
  392. Email
  393.  
  394. Email is the second oldest use of the Internet, dating back to the ARPAnet
  395. of 1972.  (The first use was to allow people to remotely log in to their
  396. choice of one of the four computers on which ARPAnet was launched in 1971.)
  397.  
  398. There are two major uses of email: private communications, and broadcasted
  399. email. When broadcasted, email serves to make announcements (one-way
  400. broadcasting), and to carry on discussions among groups of people such as
  401. our Happy Hacker list. In the group discussion mode, every message sent by
  402. every member of the list is broadcasted to all other members.
  403.  
  404. The two most popular program types used to broadcast  to email discussion
  405. groups are majordomo and listserv.
  406.  
  407. Usenet
  408.  
  409. Usenet was a natural outgrowth of the broadcasted email group discussion
  410. list. One problem with email lists is that there was no easy way for people
  411. new to these groups to join them. Another problem is that as the group
  412. grows, a member may be deluged with dozens or hundreds of email messages
  413. each day.
  414.  
  415. In 1979 these problems were addressed by the launch of Usenet. Usenet
  416. consists of news groups which carry on discussions in the form of "posts."
  417. Unlike an email discussion group, these posts are stored, typically for two
  418. weeks or so, awaiting potential readers. As new posts are submitted to a
  419. news group, they are broadcast to all Internet hosts that are subscribed to
  420. carry the news groups to which these posts belong.
  421.  
  422. With many Internet connection programs you can see the similarities between
  423. Usenet and email. Both have similar headers, which track their movement
  424. across the Net. Some programs such as Pine are sent up to send the same
  425. message simultaneously to both email addresses and newsgroups. All Usenet
  426. news readers allow you to email the authors of posts, and many also allow
  427. you to email these posts themselves to yourself or other people.
  428.  
  429. Now, here is a quick overview of the Internet basics we plan to cover in the
  430. next several issues of Guide to (mostly) Harmless Hacking:
  431.  
  432. 1. Unix
  433. We discuss "shells" which allow one to write programs ("scripts") that
  434. automate complicated series of Unix commands. The reader is introduced to
  435. the concept of scripts which perform hacking functions. We introduce Perl,
  436. which is a shell programming language used for the most elite of hacking
  437. scripts such as SATAN.
  438.  
  439. 3. TCP/IP and UUCP
  440.  
  441. This chapter covers the communications links that bind together the Internet
  442. from a hackers' perspective. Extra attention is given to UUCP since it is so
  443. hackable.
  444.  
  445. 4. Internet Addresses, Domain Names and Routers
  446.  
  447. The reader learns how information is sent to the right places on the
  448. Internet, and how hackers can make it go to the wrong places! How to look up
  449. UUCP hosts (which are not under the domain name system) is included.
  450.  
  451. 5. Fundamentals of Elite Hacking: Ports, Packets and File Permissions
  452.  
  453. This section lets the genie of serious hacking out of the bottle. It offers
  454. a series of exercises in which the reader can enjoy gaining access to almost
  455. any randomly chosen Internet host. In fact, by the end of the chapter the
  456. reader will have had the chance to practice several dozen techniques for
  457. gaining entry to other peoples' computers. Yet these hacks we teach are 100%
  458. legal!
  459.  
  460. _________________________________________________________
  461. Want to see back issues of Guide to (mostly) H