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
2
2.3k
Java 21 Overview
line_developers
6
1.2k
Code Review Challenge: An example of a solution
line_developers
1
1.3k
KARTEのAPIサーバ化
line_developers
1
540
著作権とは何か?〜初歩的概念から権利利用法、侵害要件まで
line_developers
5
2.2k
生成AIと著作権 〜生成AIによって生じる著作権関連の課題と対処
line_developers
3
2.1k
マイクロサービスにおけるBFFアーキテクチャでのモジュラモノリスの導入
line_developers
9
3.5k
A/B Testing at LINE NEWS
line_developers
3
980
LINEのサポートバージョンの考え方
line_developers
2
1.3k
Other Decks in Technology
See All in Technology
SREのためのeBPF活用ステップアップガイド
egmc
2
1.3k
20250708オープンエンドな探索と知識発見
sakana_ai
PRO
4
1k
CDKコード品質UP!ナイスな自作コンストラクタを作るための便利インターフェース
harukasakihara
2
230
Maintainer Meetupで「生の声」を聞く ~講演だけじゃないKubeCon
logica0419
0
110
PHPからはじめるコンピュータアーキテクチャ / From Scripts to Silicon: A Journey Through the Layers of Computing
tomzoh
2
120
Delegating the chores of authenticating users to Keycloak
ahus1
0
190
united airlines ™®️ USA Contact Numbers: Complete 2025 Support Guide
flyunitedhelp
1
470
american aa airlines®️ USA Contact Numbers: Complete 2025 Support Guide
aaguide
0
500
「Chatwork」のEKS環境を支えるhelmfileを使用したマニフェスト管理術
hanayo04
1
400
ソフトウェアQAがハードウェアの人になったの
mineo_matsuya
3
200
第64回コンピュータビジョン勉強会「The PanAf-FGBG Dataset: Understanding the Impact of Backgrounds in Wildlife Behaviour Recognition」
x_ttyszk
0
240
Four Keysから始める信頼性の改善 - SRE NEXT 2025
ozakikota
0
410
Featured
See All Featured
Done Done
chrislema
184
16k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Why Our Code Smells
bkeepers
PRO
337
57k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
GitHub's CSS Performance
jonrohan
1031
460k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Balancing Empowerment & Direction
lara
1
450
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Scaling GitHub
holman
460
140k
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