whats wrong oauth_authn

45
ここがダメだよ OAuth 認証 @nov

Upload: nov-matake

Post on 24-May-2015

742 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Whats wrong oauth_authn

ここがダメだよOAuth認証@nov

Page 2: Whats wrong oauth_authn

大人の事情により

一部割愛および

置換されています

Page 3: Whats wrong oauth_authn

GREE Power Lunch 2013.03

@nov - Nov Matake

OpenID Foundation Japan Evangelist

Idcon Organizer

ID厨

OAuth.jp

OAuthおにーさん

Rubyist

Page 4: Whats wrong oauth_authn

GREE Power Lunch 2013.03

外部IDを受け入れるセキュリティ上の利点・欠点

Page 5: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Passwords Leak

Page 6: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Twitter、25万人のパスワードを含む個人情報漏えいの可能性(ITMedia, 2013.02.02)

使い回しパスワードは特に注意、米Yahoo!でアカウント情報流出 (@IT, 2012.07.13)

LinkedIn、侵入および「一部」ユーザーのパスワード漏洩を認める (TechCrunch, 2012.06.07)

Facebookのパスワードが1万件以上流出の恐れ、真偽は未確認 (ITPro, 2011.10.20)

Page 7: Whats wrong oauth_authn

GREE Power Lunch 2013.03

池田信夫、自らのメールアカウントを乗っ取られ今日も見事な醜態を晒す

Page 8: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Page 9: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Page 10: Whats wrong oauth_authn

GREE Power Lunch 2013.03

いやー、馬鹿って本当に面白いですね。

Page 11: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Same password onTwitter and Facebook?

Page 12: Whats wrong oauth_authn

GREE Power Lunch 2013.03

How many sitesare you using?

Page 13: Whats wrong oauth_authn

GREE Power Lunch 2013.03

1 LeakAll Hacked

Page 14: Whats wrong oauth_authn

GREE Power Lunch 2013.03

リスクは分散すべきものリソースは集中すべきもの

Page 15: Whats wrong oauth_authn

GREE Power Lunch 2013.03

パスワードは使い分けるものできないならID連携

Page 16: Whats wrong oauth_authn

GREE Power Lunch 2013.03

100 sites 100 different password

100 sites 1 password + 99 OpenID

Page 17: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Page 18: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Page 19: Whats wrong oauth_authn

GREE Power Lunch 2013.03

OAuth認証

「アクセス権限付与 + UserIDを返すAPI」

アクセス権限付与のプロトコル (= OAuth) は標準化

UserID取得APIは各API Providerごとにバラバラ

Page 20: Whats wrong oauth_authn

GREE Power Lunch 2013.03

OAuth使って認証するためのRFCなど無い。

Page 21: Whats wrong oauth_authn

GREE Power Lunch 2013.03

単なる OAuth 2.0 を認証に使うと、車が通れるほどのどでかいセキュリティー・ホールができる

Page 22: Whats wrong oauth_authn

GREE Power Lunch 2013.03

Demo

Page 23: Whats wrong oauth_authn
Page 24: Whats wrong oauth_authn

Your Server

GET /me

User Info

Page 25: Whats wrong oauth_authn

GET /me

User Info

:Different User Data

Token ReplaceYour Server

Page 26: Whats wrong oauth_authn

GREE Power Lunch 2013.03

OAuthの仕様を理解してFB APIの仕様も理解して

ドキュメント通りに実装したらアカウント乗っ取られる。

Page 27: Whats wrong oauth_authn

大人の事情により割愛

Page 28: Whats wrong oauth_authn

GET /me

User Info

:Different User Data

Token Replace

Weak Point

Page 29: Whats wrong oauth_authn

GREE Power Lunch 2013.03

OAuth + 認証どうすればセキュアに...?

Page 30: Whats wrong oauth_authn

それ、OpenID Connect

でできるよ。

Page 31: Whats wrong oauth_authn
Page 32: Whats wrong oauth_authn
Page 33: Whats wrong oauth_authn

♥OpenID Connect

~ OpenID based on OAuth 2.0 ~

Page 34: Whats wrong oauth_authn

ỴỶἙὅἘỵἘỵޖỊˌɦỉờỉử੩̓

ͻ ㄆド䜢ཷ䛡䛯䛾䛛 ㄡ䛜

ͻ ㄆド䜢ཷ䛡䛯䛾䛛 䛹䛣䛷

ͻ ㄆド䜢ཷ䛡䛯䛾䛛 䛔䛴

ͻ ㄆド䜢ཷ䛡䛯䛾䛛 䛹䛾䜘䛖䛻

ͻ ᒓᛶ䜢ᥦ౪䛧䛶䛟䜜䜛䛛 䛹䛾

ͻ ᥦ౪䛧䛶䛟䜜䜛䛛 䛺䛬

12

Page 35: Whats wrong oauth_authn

Access Token + ID TokenRelying Party OpenID Provider

Initiate

Request Authorization

Authenticate & Authorize

Authorization Grant

Authorization Grant

Access Token + ID Token

End User

Page 36: Whats wrong oauth_authn

ID Token

• JWT token representing logged-in session

• Claims:

• iss – Issuer

• sub – Identifier for user

• aud – Audience for ID Token

• iat, exp - issued at & expiry

Page 37: Whats wrong oauth_authn

JSON Web Token

• JSON + Signature (+ Encryption)

•XML Signature for JSON

Page 38: Whats wrong oauth_authn
Page 39: Whats wrong oauth_authn

誰が (issuer)

誰を (subject)

誰のために (audience)

認証したのか

Page 40: Whats wrong oauth_authn

Your Server

Signed using FB private key

Verified usingFB public key

Page 41: Whats wrong oauth_authn

最後に

Page 42: Whats wrong oauth_authn

****よりFB / Googleの方がセキュアだし外部IDは受け入れた方がよい。

「1password使えや」とかユーザーに言えるの空気読めない楽◯社長くらい

Page 43: Whats wrong oauth_authn

ただし「OAuth認証」は仕様通り(とDeveloperが思ってる通り)

に実装すると穴ができるので注意。

たぶん既に穴何カ所かある気がする...

Page 44: Whats wrong oauth_authn

****がOpenID Connect Providerになるのは大変そうだけど

ID Tokenだけ発行するならあり。

Backend API Call無いと認証できないとかけっこうつらくない?

Page 45: Whats wrong oauth_authn

slideshare.net/matake

github.com/nov

twitter.com/nov