近年のgame security診断 について - nevermoe...自己紹介 nevermoe •...
TRANSCRIPT
![Page 1: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/1.jpg)
近年のGame Security診断についてnevermoe
—OWASP NIGHT MEETING
![Page 2: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/2.jpg)
自己紹介✦ nevermoe
• 趣味:水泳、スキー、引きこもり• 履歴:
• 仕事:Web、Mobile App、Game等のセキュリティ診断八ヶ月前:XXXX株式会社セキュリティ室に新卒入社
3年前:渡日 東京大学大学院(CG研究)
26年前:中国で生まれ
![Page 3: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/3.jpg)
目次• セキュリティ診断概要• バイナリー解析• 通信解析• 対策&まとめ
![Page 4: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/4.jpg)
目次• セキュリティ診断概要• バイナリー解析• 通信解析• 対策&まとめ
![Page 5: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/5.jpg)
セキュリティ診断概要
Cl ient
• XSS• CSRF• Path Traversal• Open-Redirect • etc.
Server Server
• Analyzing the protocol• Abusing/Cheating• Bot (un-official client)• etc.
Cl ient
![Page 6: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/6.jpg)
セキュリティ診断概要
• XSS• CSRF• Path Traversal• Open-Redirect • etc.
Server
• Analyzing the protocol• Abusing/Cheating• Bot (un-official client)• etc.
Cl ient
![Page 7: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/7.jpg)
目次• セキュリティ診断概要• バイナリー解析• 通信解析• 対策&まとめ
![Page 8: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/8.jpg)
ゲームエンジン✦Unity3D
• 2Dでも、3Dでも• Cross Platform• sourceの一部公開
✦Cocos2d-x• 2Dゲームに特化• Cross Platform• Open Source
✦FlashAIR/Unreal/Corona等✦自作
圧倒的にシェアが高い
![Page 9: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/9.jpg)
Unity3dゲーム現状✦Android -> Mono• パッキング• 難読化
✦iOS -> IL2CPP• 取得は簡単• パッキング、難読化一切なし
★ただし、最近Androidも IL2CPPサポートするようになった
=> 難読かされた=> コードをリバーシング?
=> シンボルのない=> アセンブラを=> リバーシング?
![Page 10: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/10.jpg)
✦Android
✦iOS
Assembly-Csharp.dll
Java smali file
native so file
ILコード、逆コンパイルは簡単
IL2CPP紹介(without IL2CPP)
![Page 11: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/11.jpg)
IL2CPP紹介(with IL2CPP)✦Android
✦iOS
libil2cpp.so
![Page 12: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/12.jpg)
IL2CPP紹介
libiPhone.a (libil2cpp)
Bulk_Assembly-Csharp.cpp○○○.cpp…
link
compile DWARF (exe)
h
h
![Page 13: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/13.jpg)
Metadata
Data/Managed/Metadata/global-metadata.dat
Bulk_Assembly-Csharp.cpp
![Page 14: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/14.jpg)
シンボル復号
IDA Plugin: https://github.com/nevermoe/unity_metadata_loaderSlide: https://www.nevermoe.com/wp-content/uploads/2016/11/avtokyo_jp_re.pdf
![Page 15: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/15.jpg)
目次• セキュリティ診断概要• バイナリー解析• 通信解析• 対策&まとめ
![Page 16: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/16.jpg)
通信改ざん対策✦SSL Pinning △
• ただしく実装されない可能性がある• 汎用性ツールによるbypass可能?
✦電文、パケットのHashチェック △• integrityが保証されるが、通信内容が見える(protocol分析される)
✦通信暗号化 ◯• バイナリー解析しないとリバーシング難しい• 汎用性解析ツールがない• 現状一番使われいる
![Page 17: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/17.jpg)
• SSL Pinning Bypass
Client
SSL Pinning現状
Normal App (Android)
Normal App (iOS)
Game (Unity3d)
Game (Cocos2d-x)
SSL Pinning ◯ ◯ ✖ △
Bypass Tool JustTrustMe ssl-kill-switch ✖ ✖
ce rt if ica te
Server第三者 Client
![Page 18: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/18.jpg)
通信プロトコル✦ 通常のApp
• JSON• XML• Protobuf: https://developers.google.com/protocol-buffers/• Thrift: https://thrift.apache.org/• MessagePack: http://msgpack.org
✦ ゲームにとって• JSON• MessagePack• Protobuf
![Page 19: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/19.jpg)
通信プロトコル比較✦ JSON
• 人間の目で読める• パースが簡単• overheadが大きい
✦ MessagePack• JSON-like• 人間の目で読めない(バイナリー)• パースが簡単
✦ Protobuf• Dense data• 人間の目で読めない(バイナリー)• schema (.proto)ファイルがないとdecodeが難しい• 処理速度が速い• 暗号化手法ではない!
![Page 20: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/20.jpg)
✦ Protobuf
Protobuf解析
// .proto
// .cpp // .java
compilet
.cpp
.java
.py
import / include
![Page 21: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/21.jpg)
✦ .protoファイルあればもちろん復号できる✦ java、c#のILをdecompileすればも復号可能
★ IL2CPPを使用すると?
• Protobuf Encoding (https://developers.google.com/protocol-buffers/docs/encoding)
Protobuf解析
![Page 22: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/22.jpg)
Protobuf解析
valuekey
wire_type (3 bit)id
![Page 23: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/23.jpg)
Protobuf解析
key
Varintid
10101100 00000010
0000010 0101100 = 300
ZigZag Encoding
most significant bit (msb)
![Page 24: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/24.jpg)
Protobuf解析
valuekey
32 bitid
32 bit
![Page 25: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/25.jpg)
Protobuf解析
valuekey
64 bitid
64 bit
![Page 26: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/26.jpg)
Protobuf解析
stringkey
stringid
length
length
![Page 27: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/27.jpg)
Protobuf解析
key
embedded messagesid
length key1 value1 key2 value2
length
![Page 28: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/28.jpg)
✦ 再帰的にtry catchで当たってみる。
Protobuf解析
![Page 29: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/29.jpg)
✦ 再帰的にtry catchで当たってみる。
Protobuf解析
protoc --decode_raw
float型
自作decoder
encode
JSON出力、編集、Re-encodingもサポート
![Page 30: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/30.jpg)
Protobuf解析✦ burp pluginにしてみる id、timestamp、座標?
source: https://github.com/nevermoe/protobuf-decoder
![Page 31: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/31.jpg)
目次• セキュリティ診断概要• バイナリー解析• 通信解析• 対策&まとめ
![Page 32: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/32.jpg)
対策&まとめ✦パケットでも、バイナリーでも、 Non-Cryptographic手法をやめよう• バイナリー暗号化、難読化!• 通信暗号化!
✦Game SecurityはDynamicで、 一つの手法に頼ってはいけない• 対処法:開発 —> Anti-cheat SDK —>セキュリティ診断 —> モニタリング
![Page 33: 近年のGame Security診断 について - Nevermoe...自己紹介 nevermoe • 趣味:水泳、スキー、引きこもり • 履歴: • 仕事:Web、Mobile App、Game等のセキュリティ診断](https://reader033.vdocuments.us/reader033/viewer/2022060405/5f0f13297e708231d4425d7c/html5/thumbnails/33.jpg)
Q&A
Thank you!