
TL;DR
If website uses OAuth multi-logins there is an 平易な way to スピードを出す/記録につける into somebody's account, 保護 is almost never 器具/実施するd and people don't take into account that OAuth is also used for authentication.
OAuth2 is an authorization 枠組み. 明らかに it's very popular now. 無視(する)s its 人気 a lot of people don't understand it 深く,強烈に enough to 令状 proper and 安全な・保証する 実施.
OAuth1.a and OAuth2 are 相いれない, some services use former(twitter, wtf, come on!), some latter, some of them have insufficient and poor documentation(ーに関して/ーの点でs of 安全) etc. It took me a few hours to read OAuth2 草案 完全に and I 設立する a few 利益/興味ing vectors. One of them I am exposing in this 地位,任命する.
It's really dangerous but very ありふれた vulnerability for multi-login OAuth websites.
A little bit of theory:
- response_type = code is server-味方する auth flow, should be used when possible, more 安全な・保証する than response_type = 記念品. Provider returns 'code' with 使用者's 使用者-スパイ/執行官 and (弁護士の)依頼人 sends along with (弁護士の)依頼人's 信任状 the code to 得る 'access_token'. Callback when 使用者 is redirected looks like 場所/位置.com/oauth/callback?code=AQCOtAVov1Cu316rpqPfs-8nDb-jJEiF7aex9n05e2dq3oiXlDwubVoC8VEGNq10rSkyyFb3wKbtZh6xpgG59FsAMMSjIAr613Ly1usZ47jPqADzbDyVuotFaRiQux3g6Ut84nmAf9j-KEvsX0bEPH_aCekLNJ1QAnjpls0SL9ZSK-yw1wPQWQsBhbfMPNJ_LqI
- I remind you, OAuth is all about authorization, not authentication. What's the difference, you might ask. OAuth just gives to (弁護士の)依頼人 接近 to 使用者's 資源s on Provider.
But very often (弁護士の)依頼人 authenticates you by 'profile_info' 資源, thus we can call it authentication 枠組み either.
切り開く/タクシー/不正アクセスing, Step-by-step:
- Choose (弁護士の)依頼人 which 控訴s 切り開く/タクシー/不正アクセス's "条件" - some 場所/位置.com(we will use Pinterest as showcase) Start authentication 過程 - click "追加する OAuth Provider login". You need to get callback from Provider but should not visit it. It's やめる difficult - all modern browsers redirect you automatically. I recommend bundle Firefox + NoRedirect 拡張.
- Do not visit the last URL(http://pinterest.com/connect/facebook/?code=AQCOtAVov1Cu316rpqPfs-8nDb-jJEiF7aex9n05e2dq3oiXlDwubVoC8VEGNq10rSkyyFb3wKbtZh6xpgG59FsAMMSjIAr613Ly1usZ47jPqADzbDyVuotFaRiQux3g6Ut84nmAf9j-KEvsX0bEPH_aCekLNJ1QAnjpls0SL9ZSK-yw1wPQWQsBhbfMPNJ_LqI#_=_), just save and put it into <img src="URL"> or <iframe> or anything else you prefer to send requests.
- Now all you need is to make the 使用者(some 確かな 的 or 無作為の 場所/位置.com 使用者) to send HTTP request on your callback URL. You can 軍隊 him to visit example.com/somepage.html which 含む/封じ込めるs <iframe src=URL>, 地位,任命する <img> on his 塀で囲む, send him an email/tweet, whatever. 使用者 must be logged in 場所/位置.com when he sends the request.
井戸/弁護士席 done, your oauth account is 大(公)使館員d to 使用者's account on 場所/位置.com. - Voila, 圧力(をかける) スピードを出す/記録につける In with that OAuth Provider - you are logged in 直接/まっすぐに to 使用者's account on 場所/位置.com.
Enjoy: read 私的な messages, 地位,任命する comments, change 支払い(額) 詳細(に述べる)s, have lulz, whatever. In fact account is yours now.
After you had enough fun you can just Disconnect that OAuth Provider and スピードを出す/記録につける out. Nobody will have an idea what has happened, you left no 指紋s!
How to (悪事,秘密などを)発見する, is 確かな OAuth 実施 攻撃を受けやすい?
If 場所/位置 doesn't send '明言する/公表する' param and redirect_uri param is static and doesn't 含む/封じ込める any 無作為の hashes - it's 攻撃を受けやすい.I know at least 10+ popular 攻撃を受けやすい 場所/位置s: e.g. pinterest, digg, soundcloud, snip.it, bit.ly, stumbleupon etc. If you know more 場所/位置s - please 減少(する) me a line at homakov@gmail.com
Also all Rails + Omniauth are 攻撃を受けやすい. Have fun(about 23,300 results)
updates:
- 直す/買収する,八百長をするd for django https://github.com/omab/django-social-auth/問題/発行するs/386
- 直す/買収する,八百長をするd in omniauth https://github.com/intridea/omniauth/問題/発行するs/612
- 報告(する)/憶測d and 直す/買収する,八百長をするd in soundcloud.com
- checking public libraries..
Mitigation:
You are supposed to send special optional param '明言する/公表する' - any 無作為の hash you get 支援する by Provider in 使用者's callback: ?code=123&明言する/公表する=HASH. Before 追加するing OAuth account you MUST 立証する 開会/開廷/会期[明言する/公表する] is equal params[明言する/公表する].
Classic: Insecure-by-default means insecure. 大多数 of developers don't use it at all - nobody 支払う/賃金s for "optional" weird param :trollface:
MUST READ SECTION.
Notices:
- $_SESSION['明言する/公表する'] == $_REQUEST['明言する/公表する'] is 攻撃を受けやすい code, was used a while ago in FB examples. Emtpy string equals empty string.
- I recommend you to filter 'code' in スピードを出す/記録につけるs config.filter_parameters += [:code]
- 明言する/公表する should not be equal form_authenticity_token(開会/開廷/会期[:csrf_token]) in rails
- if you 器具/実施するd response_type=記念品 flow w/o FB JS library, it's most likely 攻撃を受けやすい too.
At the moment I am working on "OAuth2 安全 提案". The 提案 目的(とする)s to make OAuth2 safer by changing its 政策s, 支配するs and workflows. Most of the points are supposed to be backwards 両立できる but some of them are やめる difficult to 適用する. Stay tuned, I am publishing it in a few days.
While the 脅し you 述べる is real, you've got your 条件 backwards. OAuth is about *authorization* and _not_ *authentication*. Authentication is about 立証するing a 使用者's 身元, 反して authorization is about 供給するing 接近 to 使用者 data to a 3rd party.
Reply削除するJuly 5, 2012 at 9:43 AM@blog, dude, thank you, I misused both 条件! Going to 交換(する) it! fail :)
Reply削除するIMHO, the 初めの sin is in using a 安全な HTTP method (GET) to change 明言する/公表する. The callback request should return a form asking the 使用者 to 確認する the OAuth provider 新規加入, 結局 showing some use r (警察などへの)密告,告訴(状) 得るd from that provider.
Reply削除するWhat do you think?
it is 述べるd as an 選択 in 草案s. for example if you 始める,決める up 地位,任命するing to facebook from your twitter you will be asked - is it your facebook account
削除するi don't like this 態度 - too many 活動/戦闘s. 受託する on provider, 受託する on (弁護士の)依頼人. '明言する/公表する' is やめる good to make sure that you are you and this account on provider is yours. why to ask again?
Just as a 事柄 of 原則: 避ける important 明言する/公表する changing 活動/戦闘s as a consequence of a GET method; always 要求する a POST in 返答 to an 認める form with CSRF 保護
Reply削除するI agree that the extra 確定/確認 can be a nuisance for the 使用者, however いつかs this extra step is より望ましい.
yes, that is an 絶対の truth, we should 避ける GET changing requests and 要求する POST+CSRF 保護 for everything. At least 3 of my previous 地位,任命するs are about this 支配する.
削除するBut you still can 嘘(をつく) on 使用者. For example if the hacker's account has his avatar, his first/last 指名する so when he sees connect You You Your Avatar he still can click 受託する.
I'm not に引き続いて you on the "still can 嘘(をつく) on 使用者". The ack. form with the CSRF 記念品 is 生成するd by the 合法的 (弁護士の)依頼人. The 攻撃者 would have to 得る this CSRF 記念品.
削除するthe attack is a bit longer.
削除するthere is User1, I create anoter account with same avatar/詳細(に述べる)s of User1 - User2.
I open an iframe or new window with src=場所/位置.com/callback?code=mycodeforUser2
It will still *要求する* click from User1 to 割り当てる my account User2 because of CSRF 記念品 but some 使用者s are naive.
Nevermind, just thought
Wou ld it work if you 始める,決める the 明言する/公表する hash on the cookie itself? Then when the provider redirected 支援する to you, you can compare between the cookie's 明言する/公表する and the get parameter's 明言する/公表する?
Reply削除するHowever can this still get spoofed?
明言する/公表する fixation? depends on 開会/開廷/会期 type - in rails it's 調印するd and you can't 取って代わる 明言する/公表する w/o breaking login
削除するi don't think it's 類似の. it's active only for 5 minutes
Reply削除する"明言する/公表する should not be equal form_authenticity_token(開会/開廷/会期[:csrf_token])"
Reply削除するCould you 拡大する on that? Why is it a bad idea to 再使用する form_authenticity_token as 明言する/公表する?
Because you send it to 外部の service and they can 再使用する it to 切り開く/タクシー/不正アクセス your app with CSRF
削除するHi Egor,
Reply削除する"$_SESSION['明言する/公表する'] == $_REQUEST['明言する/公表する'] is 攻撃を受けやすい code, was used a while ago in FB examples. Emtpy string equals empty string."
Could you 拡大する on that? Why exactl y is this 攻撃を受けやすい code?
SESSION[明言する/公表する] is empty in the beginning, so sending no '明言する/公表する' passes the 立証.
削除する