home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit 2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Texts / Improving-Security / security16.txt < prev    next >
Encoding:
Text File  |  1999-11-04  |  20.1 KB  |  420 lines

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