home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / hackersclub / km / library / articles / spoofing.txt < prev    next >
Text File  |  1998-03-25  |  22KB  |  451 lines

  1.                     Web Spoofing: An Internet Con Game
  2.  
  3.        Edward W. Felten, Dirk Balfanz, Drew Dean, and Dan S. Wallach
  4.  
  5.                           Technical Report 540-96
  6.  
  7.             Department of Computer Science, Princeton University
  8.  
  9. Introduction
  10.  
  11. This paper describes an Internet security attack that could endanger the
  12. privacy of World Wide Web users and the integrity of their data. The attack
  13. can be carried out on today's systems, endangering users of the most common
  14. Web browsers, including Netscape Navigator and Microsoft Internet Explorer.
  15.  
  16. Web spoofing allows an attacker to create a "shadow copy" of the entire
  17. World Wide Web. Accesses to the shadow Web are funneled through the
  18. attacker's machine, allowing the attacker to monitor the all of the
  19. victim's activities including any passwords or account numbers the victim
  20. enters. The attacker can also cause false or misleading data to be sent to
  21. Web servers in the victim's name, or to the victim in the name of any Web
  22. server. In short, the attacker observes and controls everything the victim
  23. does on the Web.
  24.  
  25. We have implemented a demonstration version of this attack.
  26.  
  27. Spoofing Attacks
  28.  
  29. In a spoofing attack, the attacker creates misleading context in order to
  30. trick the victim into making an inappropriate security-relevant decision. A
  31. spoofing attack is like a con game: the attacker sets up a false but
  32. convincing world around the victim. The victim does something that would be
  33. appropriate if the false world were real. Unfortunately, activities that
  34. seem reasonable in the false world may have disastrous effects in the real
  35. world.
  36.  
  37. Spoofing attacks are possible in the physical world as well as the
  38. electronic one. For example, there have been several incidents in which
  39. criminals set up bogus automated-teller machines, typically in the public
  40. areas of shopping malls [1]. The machines would accept ATM cards and ask
  41. the person to enter their PIN code. Once the machine had the victim's PIN,
  42. it could either eat the card or "malfunction" and return the card. In
  43. either case, the criminals had enough information to copy the victim's card
  44. and use the duplicate. In these attacks, people were fooled by the context
  45. they saw: the location of the machines, their size and weight, the way they
  46. were decorated, and the appearance of their electronic displays.
  47.  
  48. People using computer systems often make security-relevant decisions based
  49. on contextual cues they see. For example, you might decide to type in your
  50. bank account number because you believe you are visiting your bank's Web
  51. page. This belief might arise because the page has a familiar look, because
  52. the bank's URL appears in the browser's location line, or for some other
  53. reason.
  54.  
  55. To appreciate the range and severity of possible spoofing attacks, we must
  56. look more deeply into two parts of the definition of spoofing:
  57. security-relevant decisions and context.
  58.  
  59. Security-relevant Decisions
  60.  
  61. By "security-relevant decision," we mean any decision a person makes that
  62. might lead to undesirable results such as a breach of privacy or
  63. unauthorized tampering with data. Deciding to divulge sensitive
  64. information, for example by typing in a password or account number, is one
  65. example of a security-relevant decision. Choosing to accept a downloaded
  66. document is a security-relevant decision, since in many cases a downloaded
  67. document is capable of containing malicious elements that harm the person
  68. receiving the document [2].
  69.  
  70. Even the decision to accept the accuracy of information displayed by your
  71. computer can be security-relevant. For example, if you decide to buy a
  72. stock based on information you get from an online stock ticker, you are
  73. trusting that the information provided by the ticker is correct. If
  74. somebody could present you with incorrect stock prices, they might cause
  75. you to engage in a transaction that you would not have otherwise made, and
  76. this could cost you money.
  77.  
  78. Context
  79.  
  80. A browser presents many types of context that users might rely on to make
  81. decisions. The text and pictures on a Web page might give some impression
  82. about where the page came from; for example, the presence of a corporate
  83. logo implies that the page originated at a certain corporation.
  84.  
  85. The appearance of an object might convey a certain impression; for example,
  86. neon green text on a purple background probably came from Wired magazine.
  87. You might think you're dealing with a popup window when what you are seeing
  88. is really just a rectangle with a border and a color different from the
  89. surrounding parts of the screen. Particular graphical items like file-open
  90. dialog boxes are immediately recognized as having a certain purpose.
  91. Experienced Web users react to such cues in the same way that experienced
  92. drivers react to stop signs without reading them.
  93.  
  94. The names of objects can convey context. People often deduce what is in a
  95. file by its name. Is manual.doc the text of a user manual? (It might be
  96. another kind of document, or it might not be a document at all.) URLs are
  97. another example. Is MICR0S0FT.COM the address of a large software company?
  98. (For a while that address pointed to someone else entirely. By the way, the
  99. round symbols in MICR0S0FT here are the number zero, not the letter O.) Was
  100. dole96.org Bob Dole's 1996 presidential campaign? (It was not; it pointed
  101. to a parody site.)
  102.  
  103. People often get context from the timing of events. If two things happen at
  104. the same time, you naturally think they are related. If you click over to
  105. your bank's page and a username/password dialog box appears, you naturally
  106. assume that you should type the name and password that you use for the
  107. bank. If you click on a link and a document immediately starts downloading,
  108. you assume that the document came from the site whose link you clicked on.
  109. Either assumption could be wrong.
  110.  
  111. If you only see one browser window when an event occurs, you might not
  112. realize that the event was caused by another window hiding behind the
  113. visible one.
  114.  
  115. Modern user-interface designers spend their time trying to devise
  116. contextual cues that will guide people to behave appropriately, even if
  117. they do not explicitly notice the cues. While this is usually beneficial,
  118. it can become dangerous when people are accustomed to relying on context
  119. that is not always correct.
  120.  
  121. TCP and DNS Spoofing
  122.  
  123. Another class of spoofing attack, which we will not discuss here, tricks
  124. the user's software into an inappropriate action by presenting misleading
  125. information to that software [3]. Examples of such attacks include TCP
  126. spoofing [4], in which Internet packets are sent with forged return
  127. addresses, and DNS spoofing [5], in which the attacker forges information
  128. about which machine names correspond to which network addresses. These
  129. other spoofing attacks are well known, so we will not discuss them further.
  130.  
  131. Web Spoofing
  132.  
  133. Web spoofing is a kind of electronic con game in which the attacker creates
  134. a convincing but false copy of the entire World Wide Web. The false Web
  135. looks just like the real one: it has all the same pages and links. However,
  136. the attacker controls the false Web, so that all network traffic between
  137. the victim's browser and the Web goes through the attacker.
  138.  
  139. Consequences
  140.  
  141. Since the attacker can observe or modify any data going from the victim to
  142. Web servers, as well as controlling all return traffic from Web servers to
  143. the victim, the attacker has many possibilities. These include surveillance
  144. and tampering.
  145.  
  146. Surveillance The attacker can passively watch the traffic, recording which
  147. pages the victim visits and the contents of those pages. When the victim
  148. fills out a form, the entered data is transmitted to a Web server, so the
  149. attacker can record that too, along with the response sent back by the
  150. server. Since most on-line commerce is done via forms, this means the
  151. attacker can observe any account numbers or passwords the victim enters.
  152.  
  153. As we will see below, the attacker can carry out surveillance even if the
  154. victim has a "secure" connection (usually via Secure Sockets Layer) to the
  155. server, that is, even if the victim's browser shows the secure-connection
  156. icon (usually an image of a lock or a key).
  157.  
  158. Tampering The attacker is also free to modify any of the data traveling in
  159. either direction between the victim and the Web. The attacker can modify
  160. form data submitted by the victim. For example, if the victim is ordering a
  161. product on-line, the attacker can change the product number, the quantity,
  162. or the ship-to address.
  163.  
  164. The attacker can also modify the data returned by a Web server, for example
  165. by inserting misleading or offensive material in order to trick the victim
  166. or to cause antagonism between the victim and the server.
  167.  
  168. Spoofing the Whole Web
  169.  
  170. You may think it is difficult for the attacker to spoof the entire World
  171. Wide Web, but it is not. The attacker need not store the entire contents of
  172. the Web. The whole Web is available on-line; the attacker's server can just
  173. fetch a page from the real Web when it needs to provide a copy of the page
  174. on the false Web.
  175.  
  176. How the Attack Works
  177.  
  178. The key to this attack is for the attacker's Web server to sit between the
  179. victim and the rest of the Web. This kind of arrangement is called a "man
  180. in the middle attack" in the security literature.
  181.  
  182. URL Rewriting
  183.  
  184. The attacker's first trick is to rewrite all of the URLs on some Web page
  185. so that they point to the attacker's server rather than to some real
  186. server. Assuming the attacker's server is on the machine www.attacker.org,
  187. the attacker rewrites a URL by adding http://www.attacker.org to the front
  188. of the URL. For example, http://home.netscape.com becomes
  189. http://www.attacker.org/http://home.netscape.com. (The URL rewriting
  190. technique has been used for other reasons by two other Web sites, the
  191. Anonymizer and the Zippy filter. See page 9 for details.)
  192.  
  193. Figure 1 shows what happens when the victim requests a page through one of
  194. the rewritten URLs. The victim's browser requests the page from
  195. www.attacker.org, since the URL starts with http://www.attacker.org. The
  196. remainder of the URL tells the attacker's server where on the Web to go to
  197. get the real document.
  198.  
  199. ---------------------------------------------------------------------------
  200.  
  201.  
  202.  
  203. Figure 1: An example Web transaction during a Web spoofing attack. The
  204. victim requests a Web page. The following steps occur: (1) the victim's
  205. browser requests the page from the attacker's server; (2) the attacker's
  206. server requests the page from the real server; (3) the real server provides
  207. the page to the attacker's server; (4) the attacker's server rewrites the
  208. page; (5) the attacker's server provides the rewritten version to the
  209. victim.
  210.  
  211. ---------------------------------------------------------------------------
  212.  
  213. Once the attacker's server has fetched the real document needed to satisfy
  214. the request, the attacker rewrites all of the URLs in the document into the
  215. same special form by splicing http://www.attacker.org/ onto the front. Then
  216. the attacker's server provides the rewritten page to the victim's browser.
  217.  
  218. Since all of the URLs in the rewritten page now point to www.attacker.org,
  219. if the victim follows a link on the new page, the page will again be
  220. fetched through the attacker's server. The victim remains trapped in the
  221. attacker's false Web, and can follow links forever without leaving it.
  222.  
  223. Forms
  224.  
  225. If the victim fills out a form on a page in a false Web, the result appears
  226. to be handled properly. Spoofing of forms works naturally because forms are
  227. integrated closely into the basic Web protocols: form submissions are
  228. encoded in URLs and the replies are ordinary HTML Since any URL can be
  229. spoofed, forms can also be spoofed.
  230.  
  231. When the victim submits a form, the submitted data goes to the attacker's
  232. server. The attacker's server can observe and even modify the submitted
  233. data, doing whatever malicious editing desired, before passing it on to the
  234. real server. The attacker's server can also modify the data returned in
  235. response to the form submission.
  236.  
  237. "Secure" connections don't help
  238.  
  239. One distressing property of this attack is that it works even when the
  240. victim requests a page via a "secure" connection. If the victim does a
  241. "secure" Web access ( a Web access using the Secure Sockets Layer) in a
  242. false Web, everything will appear normal: the page will be delivered, and
  243. the secure connection indicator (usually an image of a lock or key) will be
  244. turned on.
  245.  
  246. The victim's browser says it has a secure connection because it does have
  247. one. Unfortunately the secure connection is to www.attacker.org and not to
  248. the place the victim thinks it is. The victim's browser thinks everything
  249. is fine: it was told to access a URL at www.attacker.org so it made a
  250. secure connection to www.attacker.org. The secure-connection indicator only
  251. gives the victim a false sense of security.
  252.  
  253. Starting the Attack
  254.  
  255. To start an attack, the attacker must somehow lure the victim into the
  256. attacker's false Web. There are several ways to do this. An attacker could
  257. put a link to a false Web onto a popular Web page. If the victim is using
  258. Web-enabled email, the attacker could email the victim a pointer to a false
  259. Web, or even the contents of a page in a false Web. Finally, the attacker
  260. could trick a Web search engine into indexing part of a false Web.
  261.  
  262. Completing the Illusion
  263.  
  264. The attack as described thus far is fairly effective, but it is not
  265. perfect. There is still some remaining context that can give the victim
  266. clues that the attack is going on. However, it is possible for the attacker
  267. to eliminate virtually all of the remaining clues of the attack's
  268. existence.
  269.  
  270. Such evidence is not too hard to eliminate because browsers are very
  271. customizable. The ability of a Web page to control browser behavior is
  272. often desirable, but when the page is hostile it can be dangerous.
  273.  
  274. The Status Line
  275.  
  276. The status line is a single line of text at the bottom of the browser
  277. window that displays various messages, typically about the status of
  278. pending Web transfers.
  279.  
  280. The attack as described so far leaves two kinds of evidence on the status
  281. line. First, when the mouse is held over a Web link, the status line
  282. displays the URL the link points to. Thus, the victim might notice that a
  283. URL has been rewritten. Second, when a page is being fetched, the status
  284. line briefly displays the name of the server being contacted. Thus, the
  285. victim might notice that www.attacker.org is displayed when some other name
  286. was expected.
  287.  
  288. The attacker can cover up both of these cues by adding a JavaScript program
  289. to every rewritten page. Since JavaScript programs can write to the status
  290. line, and since it is possible to bind JavaScript actions to the relevant
  291. events, the attacker can arrange things so that the status line
  292. participates in the con game, always showing the victim what would have
  293. been on the status line in the real Web. Thus the spoofed context becomes
  294. even more convincing.
  295.  
  296. The Location Line
  297.  
  298. The browser's location line displays the URL of the page currently being
  299. shown. The victim can also type a URL into the location line, sending the
  300. browser to that URL. The attack as described so far causes a rewritten URL
  301. to appear in the location line, giving the victim a possible indication
  302. that an attack is in progress.
  303.  
  304. This clue can be hidden using JavaScript. A JavaScript program can hide the
  305. real location line and replace it by a fake location line which looks right
  306. and is in the expected place. The fake location line can show the URL the
  307. victim expects to see. The fake location line can also accept keyboard
  308. input, allowing the victim to type in URLs normally. Typed-in URLs can be
  309. rewritten by the JavaScript program before being accessed.
  310.  
  311. Viewing the Document Source
  312.  
  313. There is one clue that the attacker cannot eliminate, but it is very
  314. unlikely to be noticed.
  315.  
  316. By using the browser's "view source" feature, the victim can look at the
  317. HTML source for the currently displayed page. By looking for rewritten URLs
  318. in the HTML source, the victim can spot the attack. Unfortunately, HTML
  319. source is hard for novice users to read, and very few Web surfers bother to
  320. look at the HTML source for documents they are visiting, so this provides
  321. very little protection.
  322.  
  323. A related clue is available if the victim chooses the browser's "view
  324. document information" menu item. This will display information including
  325. the document's real URL, possibly allowing the victim to notice the attack.
  326. As above, this option is almost never used so it is very unlikely that it
  327. will provide much protection.
  328.  
  329. Bookmarks
  330.  
  331. There are several ways the victim might accidentally leave the attacker's
  332. false Web during the attack. Accessing a bookmark or jumping to a URL by
  333. using the browser's "Open location" menu item might lead the victim back
  334. into the real Web. The victim might then reenter the false Web by clicking
  335. the "Back" button. We can imagine that the victim might wander in and out
  336. of one or more false Webs. Of course, bookmarks can also work against the
  337. victim, since it is possible to bookmark a page in a false Web. Jumping to
  338. such a bookmark would lead the victim into a false Web again.
  339.  
  340. Tracing the Attacker
  341.  
  342. Some people have suggested that this attack can be deterred by finding and
  343. punishing the attacker. It is true that the attacker's server must reveal
  344. its location in order to carry out the attack, and that evidence of that
  345. location will almost certainly be available after an attack is detected.
  346.  
  347. Unfortunately, this will not help much in practice because attackers will
  348. break into the machine of some innocent person and launch the attack there.
  349. Stolen machines will be used in these attacks for the same reason most bank
  350. robbers make their getaways in stolen cars.
  351.  
  352. Remedies
  353.  
  354. Web spoofing is a dangerous and nearly undetectable security attack that
  355. can be carried out on today's Internet. Fortunately there are some
  356. protective measures you can take.
  357.  
  358. Short-term Solution
  359.  
  360. In the short run, the best defense is to follow a three-part strategy:
  361.  
  362.   1. disable JavaScript in your browser so the attacker will be unable to
  363.      hide the evidence of the attack;
  364.   2. make sure your browser's location line is always visible;
  365.   3. pay attention to the URLs displayed on your browser's location line,
  366.      making sure they always point to the server you think you're connected
  367.      to.
  368.  
  369. This strategy will significantly lower the risk of attack, though you could
  370. still be victimized if you are not conscientious about watching the
  371. location line.
  372.  
  373. At present, JavaScript, ActiveX, and Java all tend to facilitate spoofing
  374. and other security attacks, so we recommend that you disable them. Doing so
  375. will cause you to lose some useful functionality, but you can recoup much
  376. of this loss by selectively turning on these features when you visit a
  377. trusted site that requires them.
  378.  
  379. Long-term Solution
  380.  
  381. We do not know of a fully satisfactory long-term solution to this problem.
  382.  
  383. Changing browsers so they always display the location line would help,
  384. although users would still have to be vigilant and know how to recognize
  385. rewritten URLs.
  386.  
  387. For pages that are not fetched via a secure connection, there is not much
  388. more that can be done.
  389.  
  390. For pages fetched via a secure connection, an improved secure-connection
  391. indicator could help. Rather than simply indicating a secure connection,
  392. browsers should clearly say who is at the other end of the connection. This
  393. information should be displayed in plain language, in a manner intelligible
  394. to novice users; it should say something like "Microsoft Inc." rather than
  395. "www.microsoft.com."
  396.  
  397. Every approach to this problem seems to rely on the vigilance of Web users.
  398. Whether we can realistically expect everyone to be vigilant all of the time
  399. is debatable.
  400.  
  401. Related Work
  402.  
  403. We did not invent the URL rewriting technique. Previously, URL rewriting
  404. has been used as a technique for providing useful services to people who
  405. have asked for them.
  406.  
  407. We know of two existing services that use URL rewriting. The Anonymizer,
  408. written by Justin Boyan at Carnegie Mellon University, is a service that
  409. allows users to surf the Web without revealing their identities to the
  410. sites they visit. The Zippy filter, written by Henry Minsky, presents an
  411. amusing vision of the Web with Zippy-the-Pinhead sayings inserted at
  412. random.
  413.  
  414. Though we did not invent URL rewriting, we believe we are the first to
  415. realize its full potential as one component of a security attack.
  416.  
  417. Acknowledgments
  418.  
  419. The URL-rewriting part of our demonstration program is based on Henry
  420. Minsky's code for the Zippy filter. We are grateful to David Hopwood for
  421. useful discussions about spoofing attacks, and to Gary McGraw and Laura
  422. Felten for comments on drafts of this paper. The figure was designed by
  423. Gary McGraw.
  424.  
  425. For More Information
  426.  
  427. More information is available from our Web page at
  428. http://www.cs.princeton.edu/sip, or from Prof. Edward Felten at
  429. felten@cs.princeton.edu or (609) 258-5906.
  430.  
  431. References
  432.  
  433. [1] Peter G. Neumann. Computer-Related Risks. ACM Press, New York, 1995.
  434.  
  435. [2] Gary McGraw and Edward W. Felten. Java Security: Hostile Applets, Holes
  436. and Antidotes. John Wiley and Sons, New York, 1996.
  437.  
  438. [3] Robert T. Morris. A Weakness in the 4.2BSD UNIX TCP/IP Software.
  439. Computing Science Technical Report 117, AT&T Bell Laboratories, February
  440. 1985.
  441.  
  442. [4] Steven M. Bellovin. Security Problems in the TCP/IP Protocol Suite.
  443. Computer Communications Review 19(2):32-48, April 1989.
  444.  
  445. [5] Steven M. Bellovin. Using the Domain Name System for System Break-ins.
  446. Proceedings of Fifth Usenix UNIX Security Symposium, June 1995.
  447.  
  448. [6] Web site at http://www.anonymizer.com
  449.  
  450. [7] Web site at http://www.metahtml.com/apps/zippy/welcome.html
  451.