このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


Egor Homakov: Using Content-安全-政策 for Evil

Monday, January 13, 2014

Using Content-安全-政策 for Evil

TL;DR How can we use technique created to 保護する websites for Evil? (We used XSS Auditor for Evil before) There's a neat way: taking advantage of CSP we can (悪事,秘密などを)発見する whether URL1 does redirect to URL2 and even bruteforce /path of URL2/path. This is a conceptual vulnerability in CSP design (違反 == (犯罪,病気などの)発見), and there's no obvious way to 直す/買収する,八百長をする it.

デモ & playground: http://homakov.github.io/csp.html


What is CSP
CSP header tells browsers what "inline scripts" and/or 3rd party scripts (you must 明示する hosts) can be 負担d/遂行する/発効させるd for this page. So if browser sees anything not 許すd by the header it raises an exception (違反). 
Chrome 16+, Safari 6+, and Firefox 4+ support CSP. IE 10 has very 限られた/立憲的な support.

As soon as 使用者 攻撃する,衝突するs HOST1 he gets 302 redirect to HOST2 and that's where 違反 happens, because HOST2 is not 許すd by CSP. It sends POST request to /q with "封鎖するd-uri":"http://HOST2" (only hostname, path is stripped for 類似の 安全 推論する/理由s).


You can see the exception in console of Web 視察官 (but you cannot catch it with JS).
Just console notice seemed not enough to 基準's authors, thus they introduced "報告(する)/憶測-uri" 指示的な which 通知するs host about the 違反. 使用者-スパイ/執行官 sends POST request with JSON 詳細(に述べる)s about 違反.


All 肉親,親類d of (犯罪,病気などの)発見s are bad.
Given HOST1 redirects to HOST2 for some 使用者s, we can (悪事,秘密などを)発見する if 現在の 使用者 was redirected: let's 明示する HOST1 as 許すd host in our CSP using に引き続いて HTML:

<meta http-equiv="Content-安全-政策" content="img-src HOST1;報告(する)/憶測-uri /q">
<img src="HOST1">


業績/成就 1: we can (悪事,秘密などを)発見する if 確かな URL redirects to HOST2 listening to "報告(する)/憶測-uri" 報告(する)/憶測s.


Privacy, 指紋s and OAuth.
OAuth is based on redirects, and this is a 抱擁する 枠組み design 問題/発行する (more 詳細(に述べる)s in other 地位,任命するs).
(弁護士の)依頼人 redirects to Provider/auth?client_id=123&redirect_uri=(弁護士の)依頼人/callback and in 事例/患者 this (弁護士の)依頼人 is already 権限を与えるd for 現在の 使用者, Provider redirects to (弁護士の)依頼人/callback automatically.

Using CSP trick we can check if 現在の 使用者 has 権限を与えるd 確かな (弁護士の)依頼人s (Farmville, Foursquare or PrivateYahtClubApp). Quickly. We 生成する something like this:
<img src="facebook/?client_id=1&redirect_uri=Client1">
<img src="facebook/?client_id=2&redirect_uri=Client2">
<img src="facebook/?client_id=3&redirect_uri=Client3">
...
All 権限を与えるd apps will 原因(となる) CSP 違反 報告(する)/憶測 having "封鎖するd-uri":"http://Client1" in it.

業績/成就 2: Using 100-500 most popular FB (弁護士の)依頼人s we can build sort of 使用者's 指紋: what apps you 権限を与える and what websites you frequently visit.


Bruteforcing with CSP
The new 実施 of CSP in Chrome (from 16 to 現在の 31+ 見解/翻訳/版)  can 明示する exact URLs, not just host 指名するs.
Using bunch of 許すd URLs we can bruteforce user_id when http://HOST/id redirects to http://HOST/id12345
For this we will need 地図/計画する-減ずる style 調査(する)ing (I used it before to brute <script>s with XSS Auditor). First we 負担 few iframes with big bunches in CSP header: 1 to 10000, 10000 to 20000 etc.


We define in CSP 範囲s of URLs from id=1 to id=10000, from id=10000 to id=20000 and so on. Every 違反 will 公表する/暴露する if 的 id was 名簿(に載せる)/表(にあげる)d in (手先の)技術d CSP header. As soon as we reach bunch not raising an exception (10 seconds timeout is enough), we can 分裂(する) that bunch into 10 smaller bunches, 1000 per each, until we 人物/姿/数字 out 的 id:


<iframe src="/between?from=20000&to=21000"></iframe>
<iframe src="/between?from=21000&to=22000"></iframe>


For social 網状組織 VK (m.vk.com/photos redirects to m.vk.com/photosMYID) 過程 of guessing will take unfeasibly long while, because they have over 100 million accounts. But for smaller websites 範囲s are smaller and (犯罪,病気などの)発見 is real.
業績/成就 3: with 地図/計画する-減ずる style bruteforce we can (悪事,秘密などを)発見する /path (not ?query) of redirect 目的地 (URL redirects to HOST2/path). Onerror/onload (犯罪,病気などの)発見 You might ask: "Will 除去 of 報告(する)/憶測-uri 指示的な 直す/買収する,八百長をする this 問題/発行する?" No. It is more high level 問題/発行する. Since CSP 封鎖するs not 許すd URLs, it doesn't 解雇する/砲火/射撃 up "onload" event, just as X-でっちあげる,人を罪に陥れる-選択s 封鎖する doesn't 解雇する/砲火/射撃 it up. 偉業/利用する gets even faster: でっちあげる,人を罪に陥れる.src = 'data:text/html,<meta http-equiv="Content-安全-政策" content="img-src '+許すd+';"><img src="'+url+'" onerror=parent.postMessage(1,"*") onload=parent.postMessage(2,"*")>' 業績/成就 4: we can really quickly (悪事,秘密などを)発見する if 確かな URL redirects to HOST2 利用するing onload/onerror events. Mitigation? IMO we should 除去する '報告(する)/憶測-uri' and invoke 'onload' event even if URL was 封鎖するd by CSP. I know, it is 混乱させるing approach, but it's the only way to get rid of (犯罪,病気などの)発見. My 初期の 報告(する)/憶測 (31 Oct) was 示すd as Severity: 非,不,無 by Chrome and not going to be 直す/買収する,八百長をするd soon. It will 要求する 直す/買収する,八百長をするing the 基準 anyway. 関係のある 問題/発行する Pwning privacy with hash based URL (犯罪,病気などの)発見

4 comments:

  1. 匿名の/不明のJuly 7, 2014 at 7:11 AM

    Most instances of this 偉業/利用する rely on trying to 負担 an HTML page 経由で an img tag. Wouldn't it be possible for the server to 認める this by the different 受託する request header? So the 偉業/利用する surface remaining is only real images 存在 負担d, which could be dealt with by not doing redirects on images, or at least not doing redirects that expose (警察などへの)密告,告訴(状).

    Indeed the デモ you 地位,任命するd no longer 作品, so Facebook and Github may already have 器具/実施するd this 反対する 手段.

    Reply削除する
    Replies
    1. > Wouldn't it be possible for the server to 認める this by the different 受託する request header?

      Maybe, but no one will spend time on 保護 from this, and by default they are all 攻撃を受けやすい

      I don't know what happened to デモ but it's not 直す/買収する,八百長をするd yet afaik.

      削除する
  2. I've spent some time on this and put together another proof of 概念 at http://myseosolution.de/実験(する)/csp-deanonymisierung.php?網状組織=Facebook&lang=en

    十分な explanation is 利用できる over here http://www.myseosolution.de/deanonymizing-facebook-使用者s-by-csp-bruteforcing/

    @Egor: Would love to know what you think.

    元気づけるs
    Pascal

    Reply削除する
    Replies
    1. It's good to remind people about this problem. I について言及するd CSP bucket-based (犯罪,病気などの)発見, and it can be really useful. But it's gonna be 直す/買収する,八百長をするd soon, while 類似の 問題/発行する with hash-ba sed (犯罪,病気などの)発見 is not.

      削除する