Skip to content

Instantly share code, notes, and snippets.

@ritou
Last active December 14, 2015 07:49
Show Gist options
  • Select an option

  • Save ritou/5053810 to your computer and use it in GitHub Desktop.

Select an option

Save ritou/5053810 to your computer and use it in GitHub Desktop.

Revisions

  1. ritou revised this gist Feb 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    これの話です。
    [http://togetter.com/li/463503](http://togetter.com/li/463503)

    (追記 : この考察ではiframeでTwitterの認可URL指定してもX-Frame-Options設定されてるやんけ問題が未解決)
    (追記 : この考察ではiframeでTwitterの認可URL指定してもX-Frame-Options設定されてるやんけ問題が未解決と思ったらなにやら更新されてたのでもう様子見)

    ## 前提条件

  2. ritou revised this gist Feb 28, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    これの話です。
    [http://togetter.com/li/463503](http://togetter.com/li/463503)

    (追記 : この考察ではiframeでTwitterの認可URL指定してもX-Frame-Options設定されてるやんけ問題が未解決)

    ## 前提条件

    あくまでこれ前提で考えてます。間違ってたらごめんなさいね。
    @@ -22,6 +24,7 @@
    * Request Tokenを取得。このとき、設定でcallbackを指定してるアプリケーションはそれ以外のoauth_callbackに任意のドメインを指定できちゃう(←アカン) [POST oauth/request_token](https://dev.twitter.com/docs/api/1/post/oauth/request_token)
    * 認可画面を開く。キャプチャ画像にあったとおり、oauth/authenticateを使う [GET oauth/authenticate](https://dev.twitter.com/docs/api/1/get/oauth/authenticate)
    * 一度でも認可したことがあればスキップしてoauth_callbackにoauth_verifierが戻る。あとはどこまででも行ける
    * ところでiframeあたりはどうやった?

    ってことですね。

  3. ritou revised this gist Feb 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@
    ## これ作った人がやっていること

    * 有名Twitter ClientとかのConsumer Key/Secretを持ってる
    * Request Tokenを取得。このとき、oauth_callbackに自分のドメインを指定できちゃう(←アカン) [POST oauth/request_token](https://dev.twitter.com/docs/api/1/post/oauth/request_token)
    * Request Tokenを取得。このとき、設定でcallbackを指定してるアプリケーションはそれ以外のoauth_callbackに任意のドメインを指定できちゃう(←アカン) [POST oauth/request_token](https://dev.twitter.com/docs/api/1/post/oauth/request_token)
    * 認可画面を開く。キャプチャ画像にあったとおり、oauth/authenticateを使う [GET oauth/authenticate](https://dev.twitter.com/docs/api/1/get/oauth/authenticate)
    * 一度でも認可したことがあればスキップしてoauth_callbackにoauth_verifierが戻る。あとはどこまででも行ける

  4. ritou revised this gist Feb 28, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@
    ## DMのリンク先で行われているらしいこと

    * iframeがいっぱい開かれた
    * 有名なTwitter Clientの認可画面だ : Request Tokenが取得できる時点でCunsumer Key/Secretが漏えいしてる
    * 画面を開くだけで自動認証だ
    * 有名なTwitter Clientの認可画面だ : (本家の認可URLもしくはCunsumer Key/Secretを知っててRequest Token取得できた?)
    * 画面を開くだけで自動認証だ : (oauth_callbackを自分のサーバーのURLに?)
    * DM送信はあとからしれっとやるらしい?

    ## これ作った人がやっていること
  5. ritou revised this gist Feb 28, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,8 @@

    ## 前提条件

    あくまでこれ前提で考えてます。間違ってたらごめんなさいね。

    * モバイルアプリの通信盗聴や某市長の手違いみたいな感じでConsumer Key/Secretを入手したやつがいる

    ## DMのリンク先で行われているらしいこと
  6. ritou created this gist Feb 28, 2013.
    33 changes: 33 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    # DM踏んだだけでアレな件はTwitterのOAuth実装がク○だと思う

    これの話です。
    [http://togetter.com/li/463503](http://togetter.com/li/463503)

    ## 前提条件

    * モバイルアプリの通信盗聴や某市長の手違いみたいな感じでConsumer Key/Secretを入手したやつがいる

    ## DMのリンク先で行われているらしいこと

    * iframeがいっぱい開かれた
    * 有名なTwitter Clientの認可画面だ : Request Tokenが取得できる時点でCunsumer Key/Secretが漏えいしてる
    * 画面を開くだけで自動認証だ
    * DM送信はあとからしれっとやるらしい?

    ## これ作った人がやっていること

    * 有名Twitter ClientとかのConsumer Key/Secretを持ってる
    * Request Tokenを取得。このとき、oauth_callbackに自分のドメインを指定できちゃう(←アカン) [POST oauth/request_token](https://dev.twitter.com/docs/api/1/post/oauth/request_token)
    * 認可画面を開く。キャプチャ画像にあったとおり、oauth/authenticateを使う [GET oauth/authenticate](https://dev.twitter.com/docs/api/1/get/oauth/authenticate)
    * 一度でも認可したことがあればスキップしてoauth_callbackにoauth_verifierが戻る。あとはどこまででも行ける

    ってことですね。

    * 有名どころを並べればまぁどれかは認可してる的発想
    * ○○だとDM読めないじゃんってTweetがあったけど、READ/WRITEならDM送れる

    ## 考察

    * Consumer Key/Secretは漏れる
    * Twitterがoauth_callbackに意図しないURLを設定できるのが原因。世の中の実装を見て、アプリケーション単位でホワイトリスト的な制限をすべき
    * ちなみにOAuth 1.0はオワコンなのでTwitterさんはOAuth 2.0頑張って