Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google IO 2019 recap Security
Search
LINE Developers
May 22, 2019
Technology
1
1.8k
Google IO 2019 recap Security
Google I/O 2019 Recap at LINE
コキチーズ
LINE Developers
May 22, 2019
Tweet
Share
More Decks by LINE Developers
See All by LINE Developers
LINEスタンプのSREing事例集:大きなスパイクアクセスを捌くためのSREing
line_developers
3
2.3k
Java 21 Overview
line_developers
6
1.2k
Code Review Challenge: An example of a solution
line_developers
1
1.4k
KARTEのAPIサーバ化
line_developers
1
550
著作権とは何か?〜初歩的概念から権利利用法、侵害要件まで
line_developers
5
2.2k
生成AIと著作権 〜生成AIによって生じる著作権関連の課題と対処
line_developers
3
2.2k
マイクロサービスにおけるBFFアーキテクチャでのモジュラモノリスの導入
line_developers
9
3.6k
A/B Testing at LINE NEWS
line_developers
3
1k
LINEのサポートバージョンの考え方
line_developers
2
1.3k
Other Decks in Technology
See All in Technology
Rustから学ぶ 非同期処理の仕組み
skanehira
1
140
JTCにおける内製×スクラム開発への挑戦〜内製化率95%達成の舞台裏/JTC's challenge of in-house development with Scrum
aeonpeople
0
220
LLMを搭載したプロダクトの品質保証の模索と学び
qa
0
1.1k
DevIO2025_継続的なサービス開発のための技術的意思決定のポイント / how-to-tech-decision-makaing-devio2025
nologyance
1
390
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
570
スマートファクトリーの第一歩 〜AWSマネージドサービスで 実現する予知保全と生成AI活用まで
ganota
2
220
これでもう迷わない!Jetpack Composeの書き方実践ガイド
zozotech
PRO
0
510
La gouvernance territoriale des données grâce à la plateforme Terreze
bluehats
0
180
なぜテストマネージャの視点が 必要なのか? 〜 一歩先へ進むために 〜
moritamasami
0
220
未経験者・初心者に贈る!40分でわかるAndroidアプリ開発の今と大事なポイント
operando
5
610
Aurora DSQLはサーバーレスアーキテクチャの常識を変えるのか
iwatatomoya
1
980
会社紹介資料 / Sansan Company Profile
sansan33
PRO
6
380k
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
96
6.2k
Bash Introduction
62gerente
615
210k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Rails Girls Zürich Keynote
gr2m
95
14k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The World Runs on Bad Software
bkeepers
PRO
70
11k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Visualization
eitanlees
148
16k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Transcript
Google I/O 2019 recap Security コキチーズ@k2wanko Google I/O 2019 Recap
at LINE Slideは DarkTheme セキュリティエンジニア
コキチーズ@k2wanko セキュリティエンジニア 会社のサービスの脆弱性探したり Bug Bountyを運営したりしてる WebとAndroidとGoとGCPとFirebaseとかが好き Splatoon 2のウデマエはX2300~2500くらい PUBGも好きです。
今年は セキュリティとプライバシーを 強調していた (とコキチーズは思った)
Incognito mode
Incognito mode
Android
Platform - Encryption - Qからはハードウェアアクセラレーションがサポートされないデバイスでも ストレージを暗号化する - Adiantumで遅くならないようにしてる - TLS1.3がデフォルトで有効
- Project Mainline - OSのコンポーネントのいくつかを Play Storeから配信するプロジェクト - WebViewとは違って、もっと低レイヤーのコンポーネントのアップデートが可能になる - Hardening - ソフトウェアコーデックの Sandbox - アドレス空間のランダム化 (ASLR) - https://security.googleblog.com/2019/05/queue-hardening-enhancements.html - App Signing by Google Play - 弱い暗号鍵はGoogleが強い暗号鍵にして署名してくれるようになる
Privacy Checklist https://developer.android.com/preview/privacy/checklist - Scoped storage - More user control
over location permissions - Background activity starts - Non-resettable hardware identifiers - Permission for wireless scanning
Scoped storage - /sdcard へのアクセスを制限 - getExternalFilesDir() で読み書きは変わらない ただし、他のアプリが作成したファイルにはアクセスできなくなる -
他のアプリが作ったファイルへのアクセスはDocumentProviderを使う - 写真、音声、動画は MediaStoreからアクセスする - EXIFへのアクセスにはACCESS_MEDIA_LOCATIONが必要
More user control over location permissions - バックグラウンドで位置情報を取得する場合の権限が分離 - ユーザーが選べるようになった
<manifest> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> </manifest>
None
Jetpack Security - セキュリティのベストプラクティスに従って 暗号化の処理ができるライブラリ - SharedPreferenceの暗号化などに使える - Android 6.0以上をサポート
使えるAPI - EncryptedFile - EncryptedSharedPreferences
EncryptedFile String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC ); File file = new
File(context.getFilesDir(), "secret_data"); // write to the encrypted file EncryptedFile encryptedFile = EncryptedFile.Builder(file, context, masterKeyAlias, EncryptedFile.FileEncryptionScheme .AES256_GCM_HKDF_4KB ).build(); // read the encrypted file FileOutputStream encryptedOutputStream = encryptedFile.openFileOutput (); FileInputStream encryptedInputStream = encryptedFile.openFileInput();
EncryptedSharedPreferences String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC ); // use the shared
preferences and editor as you normally would SharedPreferences sharedPreferences = EncryptedSharedPreferences .create("secret_shared_prefs" , masterKeyAlias, context, EncryptedSharedPreferences .PrefKeyEncryptionScheme .AES256_SIV, EncryptedSharedPreferences .PrefValueEncryptionScheme .AES256_GCM); SharedPreferences .Editor editor = sharedPreferences .edit();
Web
Google Vulnerability Reward Program payputs in 2018 - Googleに報告される脆弱性の半分はWebの脆弱性
Content Security Policy (CSP) - サイトが読み込めるリソースをホワイトリストできめ細やかに設定できる - Response Headerに「Content-Security-Policy: <policy>」と書くと有効にできる。
- 「Content-Security-Policy-Report-Only」でリソースを実際にブロックせず エラーだけ確認することもできる。
nonce & strict-dynamic based CSP - Googleは nonceとstrict-dynamicを使ったCSPを推奨している - nonceはランダムな値
Content-Security-Policy: script-src ‘nonce-random123’ - nonce属性が一致しない場合は実行されない <script>alert(‘xss’)</script> // block! <script nonce=”random123”>alert(‘this is fine!’)</script> // run
nonce & strict-dynamic based CSP - strict-dynamicがある場合は nonceで許可されたscriptが動的にリソースを読み込むことを許可する Content-Security-Policy: script-src
‘nonce-random123’ ‘strict-dynamic’; <script nonce=”random123”> var s = document.createElement('script') s.src = '/path/to/script.js' ✔ document.head.appendChild(s) </script>
CSP hashes - 静的ファイルの場合はハッシュを埋め込んで許可することもできる Content-Security-Policy: script-src ‘sha256-...’ ‘strict-dynamic’;
Detailed guide https://csp.withgoogle.com/docs/index.html
CSPが安全か確認するツール https://csp-evaluator.withgoogle.com/
Trusted Type - CSPでは防げないDOM Based XSSを防ぐためのAPI - innerHTMLやlocation.hrefなど危険なAPIに値を入れるときは stringではなく信頼できる型に変換して入力するようにする
TrustedTypeの作成 const templatePolicy = TrustedTypes.createPolicy('template', { createHTML: (templateId) => {
const tpl = templateId if (/^[0-9a-z-]$/.test(tpl)) { return `<link rel="stylesheet" href="./templates/${tpl}/style.css">` } throw new TypeError(); } }); const html = templatePolicy.createHTML(location.hash.match(/tplid=([^;&]*)/)[1]) // html instanceof TrustedHTML document.head.innerHTML += html
CSPでポリシーを制御 Content-Security-Policy: trusted-types template
Trusted Typeのpolyfilled https://github.com/WICG/trusted-types
Fetch Metadata - ブラウザがリソースを取得する際にrequestに Metadataを付与する仕様 Sec-Fetch-Mode: no-cors Sec-Fetch-Site: same-origin
Cross-Origin-Opener-Policy - window.openの挙動についての仕様 - Cross-Origin-Opener-Policyヘッダーをつけて same originやsame siteに制限できる Cross-Origin-Opener-Policy: same-origin
No Security No Life @k2wanko