Upgrade to Pro — share decks privately, control downloads, hide ads and more …

次世代プラットフォームのセキュリティモデル考察

 次世代プラットフォームのセキュリティモデル考察

セキュリティ・キャンプ全国大会2016の講義資料です。
講義の前編は、はせがわようすけさんの資料をご覧ください。
http://www.slideshare.net/hasegawayosuke/ss-64924759

MUNEAKI NISHIMURA

August 12, 2016
Tweet

More Decks by MUNEAKI NISHIMURA

Other Decks in Technology

Transcript

  1. ϞόΠϧ8FC /BUJWFΞϓϦ ˓ )5.-Ͱϫϯιʔε։ൃ ☓ 04͝ͱʹҟͳΔϓϩάϥϜݴޠͰ։ൃ ˓ 63-Λ։͚ͩ͘Ͱ࣮ߦ ☓ ࣮ߦʹ͸Πϯετʔϧ͕ඞཁ

    ☓ ར༻Ͱ͖Δ୺຤ͷػೳʹ੍ݶ ྫʣ௨࿩ ϑΝΠϧૢ࡞ͳͲېࢭ ˓ ༷ʑͳ୺຤ͷػೳΛ࢖͑Δ ྫʣ֤छηϯαʔ /'$ͳͲར༻Մೳ ☓ ར༻Ͱ͖Δ௨৴ϓϩτίϧʹ੍ݶ ྫʣ)551 8FC35$ͳͲʹݶఆ ˓ ೚ҙͷ௨৴ϓϩτίϧΛ࣮૷Մೳ ྫʣ44) *."1ͳͲجຊతʹࣗ༝ ϞόΠϧ8FC PS/BUJWFΞϓϦ
  2. ϞόΠϧ8FC /BUJWFΞϓϦ ˓ )5.-Ͱϫϯιʔε։ൃ ☓ 04͝ͱʹҟͳΔϓϩάϥϜݴޠͰ։ൃ ˓ 63-Λ։͚ͩ͘Ͱ࣮ߦ ☓ ࣮ߦʹ͸Πϯετʔϧ͕ඞཁ

    ☓ ར༻Ͱ͖Δ୺຤ͷػೳʹ੍ݶ ྫʣ௨࿩ ϑΝΠϧૢ࡞ͳͲېࢭ ˓ ༷ʑͳ୺຤ͷػೳΛ࢖͑Δ ྫʣ֤छηϯαʔ /'$ͳͲར༻Մೳ ☓ ར༻Ͱ͖Δ௨৴ϓϩτίϧʹ੍ݶ ྫʣ)551 8FC35$ͳͲʹݶఆ ˓ ೚ҙͷ௨৴ϓϩτίϧΛ࣮૷Մೳ ྫʣ44) *."1ͳͲجຊతʹࣗ༝ ϞόΠϧ8FC PS/BUJWFΞϓϦ /BUJWFΞϓϦ͸Ϛϧν1'ల։ͱ ϢʔβʔϦʔνʹ՝୊ ϞόΠϧ8FC͸ػೳෆ଍͕՝୊
  3. +4à /BUJWF BEE+BWBTDSJQU*OUFSGBDF "OESPJE 8,4DSJQU.FTTBHF)BOEMFS J04 QSPNQU "OESPJE J04 /BUJWFà

    +4 FWBMVBUF+BWB4DSJQU "OESPJE J04 8,6TFS4DSJQU J04 +4ͱ/BUJWFΛͭͳ͙ํ๏ʢҰྫʣ
  4. 8,4DSJQU.FTTBHF)BOEMFS J04 • NZ)BOEMFSͱ͍͏໊લͰ+4͔ΒϝοηʔδΛड͚ΒΕΔΑ͏ઃఆ controller.addScriptMessageHandler(self, name: "myHandler") 4XJGU func userContentController(userContentController:WKUserContentController,

    didReceiveScriptMessage message: WKScriptMessage) { // ToDo } 4XJGU • +4͔ΒͷϝοηʔδΛड৴͢ΔͨΊͷϋϯυϥؔ਺Λఆٛ webkit.messageHandlers.myHandler.postMessage("Hello from JS "); +4 • +4͔Β4XJGU΁ϝοηʔδΛૹ৴
  5. webview.setWebChromeClient(new WebChromeClient() { public boolean onJsPrompt(WebView view, String url, String

    message, String defaultValue, final JsPromptResult result) { // To Do }}); QSPNQU "OESPJE • +4ͷQSPNQUؔ਺ݺͼग़͠ΛϑοΫ͢ΔͨΊͷϋϯυϥΛఆٛ +BWB var result = prompt("Hello from JS"); +4 • +4ͰQSPNQUؔ਺Λݺͼग़͢ͱ্هͷPO+T1SPNQU͕࣮ߦ͞ΕΔ
  6. func webView(webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame:

    WKFrameInfo, completionHandler: (String?) -> Void) { // ToDo } QSPNQU J04 • +4ͷQSPNQUؔ਺ݺͼग़͠ΛϑοΫ͢ΔͨΊͷEFMFHBUFΛఆٛ 4XJGU var result = prompt("Hello from JS"); +4 • +4ͰQSPNQUؔ਺Λݺͼग़͢ͱ্هͷEFMFHBUF͕࣮ߦ͞ΕΔ
  7. FWBMVBUF+BWB4DSJQU "OESPJE J04 • จࣈྻΛ8FC7JFXʹ஫ೖ͠ɺ+4ͱ࣮ͯ͠ߦ String source = "alert('Hello from

    Java')"; webview.evaluateJavascript(source, null); +BWB let source = "alert('Hello from Swift')" webview.evaluateJavaScript(source, completionHandler: nil) 4XJGU
  8. 8,6TFS4DSJQU J04 • ͋Β͔͡Ίొ࿥͓͍ͯͨ͠+4Λ8FCϖʔδͷભҠຖʹࣗಈ࣮ߦ let source = "alert('Hello from Swift')”

    let script = WKUserScript(source: source, injectionTime: .AtDocumentEnd, forMainFrameOnly: true) webview.configuration.userContentController.addUserScript(script) 4XJGU
  9. ໰୊ͷώϯτ 2VFTUJPO 0SJHJO7BMJEBUJPO&SSPSͷ੬ऑੑ͕͋Δͧɻ 1BTTXPSE.BOBHFS͕8FC7JFXʹຒΊࠐΉ+4ͷίʔυʹண໨ͯ͠ΈΑ͏ 2VFTUJPO  0SJHJO7BMJEBUJPO&SSPSͷ੬ऑੑ͕͋Δͧɻ 1BTTXPSE.BOBHFS͕+4ͷίʔυΛຒΊࠐΉ৚݅ʹண໨ͯ͠ΈΑ͏ 2VFTUJPO 0SJHJO7BMJEBUJPO&SSPSͷ੬ऑੑ͕͋Δͧɻ

    1BTTXPSE.BOBHFS͕ͲͷΑ͏ʹݺͼग़͞ΕΔ͔ௐ΂ͯΈΑ͏ 2VFTUJPO +BWB4DSJQU*OKFDUJPOͷ੬ऑੑ͕͋Δͧɻ 1BTTXPSE.BOBHFS͕ຒΊࠐΉ+4ͷίʔυʹண໨ͯ͠ΈΑ͏ 2VFTUJPO 'SBNF$POGVTJPOͷ੬ऑੑ͕͋Δͧɻ 1BTTXPSE.BOBHFS͕+4ͷίʔυΛຒΊࠐΉ৚݅ʹண໨ͯ͠ΈΑ͏ɻ J04൛͸3BDF $POEJUJPOΛ࢖ͬͯղ͘ํ๏΋͋Δͧ
  10. 0SJHJO7BMJEBUJPO&SSPS • Α͋͘Δ࣮૷ޡΓ • 63-ʹʮTFDVSJUZDBNQPSHʯͱ͍͏จࣈྻؚ͕·ΕΔ͜ͱΛݕূ - IUUQFWJMFYBNQMFDPNTFDVSJUZDBNQPSH ͳͲͰᷖճ͞ΕΔ • 63-͕ʮIUUQTFDVSJUZDBNQPSHʯͱ͍͏จࣈྻͰ։࢝͢Δ͜ͱΛݕূ

    - IUUQTFDVSJUZDBNQPSHFWJMFYBNQMFDPN ͳͲͰᷖճ͞ΕΔ • 04ͷ"1*Ͱ63-Λ֤ύʔτʹ෼ղ͠ɺ֤ʑΛ׬શҰகͰൺֱ https://www.ietf.org/rfc/rfc3986.txt IUUQTBENJO!FYBNQMFDPN PWFSUIFSF OBNFGFSSFUOPTF TDIFNF VTFSJOGP IPTU QPSU QBUI RVFSZ GSBHNFOU
  11. 'SBNF$POGVTJPO • 8FC7JFXΦϒδΣΫτͷ63-Ͱ͸ͳ͘ɺϦΫΤετݩͷ63-Λݕূ • ΢Οϯυ΢ʢXJOEPXUPQʣͰ͸ͳ͘ϦΫΤετݩͷϑϨʔϜΛݕূ • ࣮૷ʹ͸ϦΫΤετݩͷ63-ΛݕূՄೳͳ"1*Λ࢖͏ඞཁ͕͋Δ +4à /BUJWF BEE+BWBTDSJQU*OUFSGBDF

    • ϦΫΤετݩͷ63-औಘෆՄ 8,4DSJQU.FTTBHF)BOEMFS • VTFS$POUFOU$POUSPMMFSͷҾ਺NFTTBHFͷ GSBNF*OGPTFDVSJUZ0SJHJOΛݕূʢJ04Ҏ߱ʣ QSPNQU • PO+T1SPNQUͷҾ਺VSMΛݕূʢ"OESPJEʣ • SVO+BWB4DSJQU5FYU*OQVU1BOFM8JUI1SPNQUͷ Ҿ਺GSBNFTFDVSJUZ0SJHJOΛݕূʢJ04Ҏ߱ʣ