welcome to the black hole of bug bounty program rebooted

47
Welcome to the Black Hole of Bug Bounty Program Shibuya.XSS #5 August 7 th , 2014 R E B O O T E D

Upload: muneaki-nishimura

Post on 25-Dec-2014

2.503 views

Category:

Technology


1 download

DESCRIPTION

Shibuya.XSS テクニカルトーク#5の発表資料です。

TRANSCRIPT

Page 1: Welcome to the Black Hole of Bug Bounty Program Rebooted

Welcome to the Black Hole of

Bug Bounty Program

Shibuya.XSS #5 August 7th, 2014

R E B O O T E D

Page 2: Welcome to the Black Hole of Bug Bounty Program Rebooted

西村 宗晃 a.k.a. nishimunea

html5j Webプラットフォーム部 部員 HTML5 Experts.jp コントリビューター セキュリティキャンプ全国大会 2014 講師 FxOS コードリーディング 部員

Page 3: Welcome to the Black Hole of Bug Bounty Program Rebooted

5月の話の続きです

https://atnd.org/events/51627 https://codeiq.jp/magazine/2014/07/12138/

Page 4: Welcome to the Black Hole of Bug Bounty Program Rebooted

Mozilla Security Bug Bounty Program

(Mozilla セキュリティバグ報奨金制度)

Page 5: Welcome to the Black Hole of Bug Bounty Program Rebooted

https://www.mozilla.org/security/bug-bounty.html

Page 6: Welcome to the Black Hole of Bug Bounty Program Rebooted

• 重大なセキュリティバグを発見した人にMozillaが報奨金を支払う制度

• バグ1件につき3000ドル(約30万円)

Page 7: Welcome to the Black Hole of Bug Bounty Program Rebooted

国内の報奨金獲得者 (2010年以降)

2012-2014年 Masato Kinugawaさん

2010年 はせがわようすけさん

Page 8: Welcome to the Black Hole of Bug Bounty Program Rebooted

でもどこを狙えば

おれも報奨金ほしい

Page 9: Welcome to the Black Hole of Bug Bounty Program Rebooted

1千万行を超えるFirefoxのコードからバグを探すのは 砂漠の中からダイアモンドを見つけ出すようなもの

過去にバグの見つかったところを狙う • 修正が不十分で、まだバグが残っているかも • 担当者のセキュリティの知識が浅く、類似のバグがあるかも

Page 10: Welcome to the Black Hole of Bug Bounty Program Rebooted

バグの見つかったところと言えば

Page 11: Welcome to the Black Hole of Bug Bounty Program Rebooted

Web Workers

MFSA 2014-09 Masato Kinugawaさん

MFSA 2010-42 はせがわようすけさん

はせがわさんもKinugawaさんも Web WorkersのSOP制限回避で報奨金を獲得

Page 12: Welcome to the Black Hole of Bug Bounty Program Rebooted

戦略① Web Workersを狙う

Page 13: Welcome to the Black Hole of Bug Bounty Program Rebooted

そして本当に見つかる

Page 14: Welcome to the Black Hole of Bug Bounty Program Rebooted

しかし既知のバグだとの返信

This is a dupe of 9497XX.

Page 15: Welcome to the Black Hole of Bug Bounty Program Rebooted

既知のバグを見つけた場合 Mozillaは同件と思われるBugzillaに対して

アクセス権を付与してくれる

Page 16: Welcome to the Black Hole of Bug Bounty Program Rebooted

き… Kinugawaさん…(;´Д⊂)

Page 17: Welcome to the Black Hole of Bug Bounty Program Rebooted

• Firefoxのバグ探しは競争率が高く、 既に探し出されている場合もある

• ニッチケースまで安全に実装されており そもそもバグを見つけることが難しい

Page 18: Welcome to the Black Hole of Bug Bounty Program Rebooted

諦めかけていたその時、こんな情報を発見

(割と古典的な脆弱性)

ファイル名に「../」や「..%2f」を含めると 親ディレクトリを辿って任意のファイルにアクセスできる

Page 19: Welcome to the Black Hole of Bug Bounty Program Rebooted

Firefox OSは未開の地? フロンティア

Page 20: Welcome to the Black Hole of Bug Bounty Program Rebooted

戦略② Firefox OS固有の機能を狙う

Page 21: Welcome to the Black Hole of Bug Bounty Program Rebooted

Browser API (いわゆるWebView)

アプリの画面

ブラウザウィンドウ

<iframe mozbrowser>

Page 22: Welcome to the Black Hole of Bug Bounty Program Rebooted

実際にあったバグ①

Content-Security-Policy ヘッダが 完全に無視される

返信:CSPの実装が古いだけ。 X-Content-Security-Policy なら使えるよ

Page 23: Welcome to the Black Hole of Bug Bounty Program Rebooted

実際にあったバグ②

X-Frame-Optionsヘッダも無視される (CSSで透過指定可能なのでクリックジャッキングに利用できる)

返信:フレームじゃなくてブラウザAPIだから。 そういう仕様だよ

Page 24: Welcome to the Black Hole of Bug Bounty Program Rebooted

• 未開の地ならではの苦労

• 実装されてない機能も普通にある

• バグと仕様の境界も手探り (脆弱性はあるけど、悪用するアプリはレビューツールで 検知できるから問題無しということも)

Page 25: Welcome to the Black Hole of Bug Bounty Program Rebooted

脆弱性がキマらない

Page 26: Welcome to the Black Hole of Bug Bounty Program Rebooted

最終戦略 弱そうな機能を網羅的に狙う

Page 27: Welcome to the Black Hole of Bug Bounty Program Rebooted

https://www.mozilla.org/security/announce/

Page 28: Welcome to the Black Hole of Bug Bounty Program Rebooted

• 過去の脆弱性から弱そうな機能を抽出

• 機能の組み合わせに対して、起きたら困ることを想像し、それを検証

Page 29: Welcome to the Black Hole of Bug Bounty Program Rebooted

CSP WebSocket appcache

Page 30: Welcome to the Black Hole of Bug Bounty Program Rebooted

CSP WebSocket appcache

appcacheしたHTMLからWebSocketを送信すると CSPの違反レポートが機能しない

Page 31: Welcome to the Black Hole of Bug Bounty Program Rebooted

• 機能が増えれば攻撃方法も増える

• 組み合わせを試すには時間がかかる

Page 32: Welcome to the Black Hole of Bug Bounty Program Rebooted

夏といえばセキュリティキャンプ

Page 33: Welcome to the Black Hole of Bug Bounty Program Rebooted

今年はWeb組の講師を担当することに

Page 34: Welcome to the Black Hole of Bug Bounty Program Rebooted

Webクラスの時間割

2日目

3日目

4日目

上野 国分 はせがわ Kinu gawa

※主担当者の名前(敬称略)です。主担当以外の講師も講義をサポートします

Page 35: Welcome to the Black Hole of Bug Bounty Program Rebooted

鬼か…!!

2日目

3日目

4日目

上野 国分 はせがわ Kinu gawa

※主担当者の名前(敬称略)です。主担当以外の講師も講義をサポートします

西村(4時間)

西村(4時間)

西村(3時間)

西村(3時間)

Page 36: Welcome to the Black Hole of Bug Bounty Program Rebooted

14時間分の資料作りが終わらない

Page 37: Welcome to the Black Hole of Bug Bounty Program Rebooted

14時間分の資料作りが終わらない

キャンプが終わるまで停戦を決意

Page 38: Welcome to the Black Hole of Bug Bounty Program Rebooted

しかし先月こんな脆弱性が MFSA 2014-66

Page 39: Welcome to the Black Hole of Bug Bounty Program Rebooted

Redirect iframe sandbox

Page 40: Welcome to the Black Hole of Bug Bounty Program Rebooted

それ、今度やろうと思ってたやつだ (;´Д⊂)

Page 41: Welcome to the Black Hole of Bug Bounty Program Rebooted

キーーッ!!、悔しい!!

Page 42: Welcome to the Black Hole of Bug Bounty Program Rebooted

Lesson Learned

Bug Bounty Programは中毒性が高い

Page 43: Welcome to the Black Hole of Bug Bounty Program Rebooted

• 一日中バグのことを考えるようになる

• 新しい機能を知ると無性に攻撃したくなる

Page 44: Welcome to the Black Hole of Bug Bounty Program Rebooted

しかし得られるものも多い

Page 45: Welcome to the Black Hole of Bug Bounty Program Rebooted

• 攻撃者の視点で物事を考える力が付く

• 安全な実装方法を意識する習慣が身に付く

Page 46: Welcome to the Black Hole of Bug Bounty Program Rebooted

Let’s Bug Hunt!

Page 47: Welcome to the Black Hole of Bug Bounty Program Rebooted

宣伝:本を書きました

タイトル Firefox OSウェブアプリ開発読本

ページ数 128ページ

価格 1,000円(イベント頒布価格)

表紙 siosio

目次

第1章 WebIDEを使いこなす 第2章 Building Blocksを使ってアプリ画面を組み立てる 第3章 ハードウェアアクセスAPIリファレンス 第4章 カメラアプリを作ってみよう 第5章 Firefox OSでNFCを使ってみる 第6章 WebAudio APIを使ってサンプラーを作ろう 第7章 Firefox OSアプリのセキュリティ

URL http://techbooster.github.io/announce/c86/

C86 3日目西か46b TechBoosterにて発売