Pretty-Bad-Proxy: II. SAME-ORIGIN-POLICY AND HTTPS

II. SAME-ORIGIN-POLICY AND HTTPS 
html

 第二部分:同源策略和HTTPSios


A. Same-Origin Policy A. 同源協議 Browsers support the functionality of downloading contents and executing scripts from different websites at the same time. Given some websites may contain malicious contents, it is crucial that browsers isolate the contents and scripts of different websites in order to prevent crossdomain interference. In addition, browser should allow scripts to access the contents of the same websites in order to perform normal web functionalities. This access-control policy is referred to as the same-origin policy.git

瀏覽器支持同時從不一樣網站下載內容並執行腳本。能夠看一些可能包含惡意內容的網站,瀏覽器經過隔離不一樣網站的內容和腳原本防止交叉干擾是相當重要的。另外,瀏覽器又應該容許腳本處理同一個網站的內容來執行網站正常功能。這種訪問控制策略即同源策略。web


Scripts and static contents are rendered and composed into webpages. The same-origin policy is enforced by isolating webpages according to their own security contexts derived from their URLs. A typical URL is represented in the format of 「protocol://serverName:port /path?query」 and the corresponding security context is a three-tuple <protocol,serverName,port>. As an example, the protocol can be HTTP or HTTPS, the serverName can be www.ebay.com, and the port can be 80, 443, or 8080, etc. 數組

腳本和靜態內容被渲染組合成網頁。經過網站的URL推斷的他們的安全上下文來隔離不一樣網站的網頁,這樣就強制執行了同源策略。一個有表明性的URL格式以下「protocol://serverName:port /path?query」其相對應的安全內容是一個三元數組《協議,域名,端口》。舉個例子,協議能夠是HTTP或者HTTPS,域名能夠是www.ebay.com,端口能夠是80,44,或者8080,諸如此類。瀏覽器


Each webpage is hosted in a frame or an inline frame. A browser window is a top level frame, which hosts the webpage downloaded from the URL shown in the address bar. A webpage can create multiple frames and inline frames to host webpages from different URLs. The access control mechanism between these webpages conforms to the same-origin policy described above. For example, suppose frame w1 loads a webpage from https://bank.com and frame w2 loads a webpage from http://bank.com or https://evil.com. If the script running in w2 attempts to access an HTML object inside w1, the access will be denied by the browser’s security mechanism because of the sameorigin policy. Without the same-origin policy, the document content of https://bank.com would be accessible to a script embedded in the webpage from http://bank.com (which could be faked by proxies and routers because it is not encrypted) or from https://evil.com, which would defeat the purpose of HTTPS.安全

每個網頁都承載在一個框架或者內聯框架裏。瀏覽器窗口是頂層框架,承載在地址欄展現的URL下載的網頁。一個網頁能夠創造多個框架和內聯框架來承載不一樣URL對應的網頁。這些網頁之間的訪問控制機制符合上面描述的同源策略。舉個例子:假設框架w1從https://bank.com加載了一個網頁,w2從http://bank.com 或https://evil.com加載了一個網頁。若是w2上運行的腳本試圖訪問w1裏的html對象,因爲同源策略,這種訪問將被瀏覽器安全機制拒絕,若是沒有同源策略,那來自http://bank.com (因爲沒有加密,極可能被代理和路由仿冒)或https://evil.com(能夠擊敗HTTPS)網頁裏的嵌入式腳本將能夠訪問 https://bank.com 裏的內容。服務器


Similar to frame, other objects, such as XML and XMLHTTPRequest, rely on the same-origin policy to protect their documents as well. Also, webpages can be attached with a type of plain-text data called cookies. Cookies have a slightly different same-origin policy, which will be described in Section IV.B. cookie

和框架相似,其餘對象,例如XML和XMLHTTPRequest,也依靠同源策略來保護文檔。另外,網頁也能夠被一種叫cookies的無格式數據依附。cookies和同源策略有一點細微的差異,咱們將在第四部分的B描述它。網絡


B. Basics of HTTPS and Tunneling

B.HTTPS和隧道的基礎知識


HTTPS is the protocol for HTTP communications over Secure Sockets Layer (SSL) or Transport Layer Security (TLS) [6]. For simplicity, in the rest of the paper, we use 「SSL」 to refer to both SSL and TLS. HTTPS is widely used to protect sensitive communications, such as online banking and online trading, from eavesdropping and man-in-the-middle attacks. At the beginning of an HTTPS connection, the browser and the web server go through an SSL handshake phase to ensure that: 1) the browser receives a legitimate certificate of the website issued by a trusted Certificate Authority (CA); and 2) the browser and the server agree on various cryptographic parameters, such as the cipher suite and the master key, in order to secure their connection. Once the handshake succeeds, encrypted data flow between the browser and the server. A malicious proxy or router may disrupt the communication by dropping packets, but it should not be able to eavesdrop or forge data.

HTTPS是基於SSL或TLS的HTTP通訊協議。爲簡單起見,後文咱們使用SSL來表示SSL和TLS。HTTPS普遍應用於保護相似在線銀行和在線交易等敏感通訊不被竊取和中間人攻擊。在HTTPS鏈接創建之初,瀏覽器和網站服務器經過SSL握手階段來確保:1.瀏覽器接收到該網站的來自CA機構認證的可信任證書 2.瀏覽器和服務器協商使用多個加密參數來保護鏈接,相似密碼組和密鑰。一旦握手成功,加密數據開始在瀏覽器和服務器之間傳輸。一個惡意代理或路由可能經過丟包來破壞通訊,可是它不能竊取或僞造數據。


All major browsers support HTTPS communications through HTTP proxy. The mechanism is referred to as 「tunneling」. Before starting the SSL handshake, the browser sends an HTTP CONNECT request to the proxy, indicating the server name and port number. The proxy then maintains two TCP connections, with the browser and with the server, and serves as a forwarder of encrypted data. To tunnel the HTTPS packets between the two TCP connections, the proxy needs to set different values in the IP and TCP headers, such as IP addresses and port numbers. But it is not able to manipulate the encrypted payload besides copying it byte-by-byte. Therefore, the proxy does not have any additional information about HTTPS traffic beyond the IP and TCP headers. Normally an adversary must break the cryptographic schemes used by HTTPS in order to access the actual HTTPS contents. Note that a proxy is not a trusted entity in HTTPS communications. By design, confidentiality and authenticity of HTTPS should be guaranteed when the traffic is tunneled through an untrusted proxy; in reality, as we will show in Section V, proxies are widely used in many network environments where proxies are not expected to be trustworthy. Being merely an interconnecting host on the network, the proxy is not a trusted entity that the HTTPS security relies on.

全部的主流瀏覽器都支持經過HTTP代理進行HTTPS通訊。這種機制即「隧道」。在啓動SSL握手前,瀏覽器向代理髮起HTTP鏈接請求,標明瞭域名和端口號。而後代理就在瀏覽器和服務器之間維護兩個TCP鏈接,並轉發加密數據。爲了在這兩個TCP鏈接裏運送HTTPS包,代理須要設置不一樣的IP和TCP頭,例如IP地址和端口號等。可是它在字節級的拷貝過程當中沒法篡改加密包。所以,代理沒有任何超出IP和TCP頭以外的任何HTTPS傳輸的附加信息。一般一個敵對者必須破壞HTTPS使用的加密機制來訪問HTTPS的實際內容。注意代理並非HTTPS通訊裏的可信任實體。HTTPS在設計上就應該確保在經過不可信任的代理時數據的機密性和可靠性,實際上,咱們將在第五部分展現,代理被普遍的使用於不少網絡環境,這些環境裏原本就沒有指望代理的可信任性。僅僅做爲網絡上互相鏈接的主機之一,代理並非HTTPS安全性所依賴的可信任實體。


In the next two sections, we describe PBP attack scenarios. The versions of the browsers in our discussion are IE 7, IE 8, Firefox 2, Firefox 3, Safari 3, Opera 9, Chrome Beta and Chrome 1.

在如下兩部分,咱們將描述PBP攻擊場景。咱們這裏討論的瀏覽器版本是IE7,IE8,Firefox 2,Firefox 3,Safari 3, Opera 9, Chrome Beta 和 Chrome 1。

相關文章
相關標籤/搜索