bbit Min Hash 1 Software Engineering Laboratory Department
パッケージ単位のb-bit Min. Hashを利用した バイトコード中のライブラリ検出手法 コンピュータサイエンス専攻 井上研究室 伊藤 薫 1 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Javaにおけるソフトウェアの再利用 • Javaではクラスファイルを再利用 – ソースコードよりもクラスファイルの再利用が一般的という 調査[1] • ライブラリはJavaアーカイブ(JAR)形式で配布 – クラスファイル – プログラム中で利用するリソース [1] L. Heinemann, et al. , “On the extent and nature of software reuse in open source javaprojects. ”, 12 th International Conference on Software Reuse, Vol. 6727 of Lecture Notes in Computer Science, pp. 207– 222, 2011 2 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
ライブラリの利用法 • 通常は別のJARファイルを参照して利用 My. Software. jar Library. jar • JARに含まれるクラスファイルを取り込んでいるソフ トウェアも存在 – Maven Repository中のライブラリのうち 13%はほかのラ イブラリのクラスファイルを含む 3 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Google Web Toolkit 2. 7. 0 脆弱性を含むライブラリの再利用 Apache Ant Apache Commons Codec Apache Commons Collections Apache Http. Client Google Web Toolkit : ウェブアプリ開発ツール 再利用したライブラリのバージ ョン情報はドキュメントにない Apache Xalan HTML Unit … 4 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
Google Web Toolkit 2. 7. 0 脆弱性を含むライブラリの再利用 Apache Ant Apache Commons Codec Apache Commons Collections 脆弱性を持つバージョンが利 用されていた • Apache Commons Collections • Apache Xalan Apache Http. Client Apache Xalan 開発元がアナウンスするまで 利用者には不明 HTML Unit … 内部のファイルからわかる情報のみで バージョンを検出する必要 5 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
既存研究: クラスファイル比較による再利用分析 • Software Bertillonage[2] – クラスファイルの共有率から検出 • Software Ingredients[3] – ライブラリの共有クラスの割合の高い順に貪欲法で 複数のライブラリを検出 • 矢野らの手法[4] – 共通するクラスを持つライブラリ全てで組み合わせ検索し クラスの取りこぼしのないような組み合わせを検出 [2]Davies, et al. , “Softwarebertillonage: Finding the provenance of an entity. ” MSR 2011 [3]Ishio, et al. , “Software Ingredients: Detection of Third-party Component Reuse in Java Software Release”, MSR 2016 [4]矢野ら, “Javaバイトコード比較を用いたライブラリ再利用検出ツールの提案”, 情報処理学会研究報告, Vol. 2017 -SE-195, 2017 6 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
パッケージ間の類似度 • 類似度計算にb-bit Min. Hash法を利用 8 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
b-bit Min. Hash 最小値を選択 下位b-bit [6] Li, Ping, and Christian König. "b-Bit minwise hashing. " World wide web. ACM, 2010. Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 9
類似度の計算 [6] Li, Ping, and Christian König. "b-Bit minwise hashing. " World wide web. ACM, 2010. Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 10
手法の概要図 DB Input Tool Libraries in the target 11 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
再利用元の候補 Input. jar Database A-1. 0. jar パッケージ一覧 ・ 530 a 502. . . ・ffbc 6 ef. . . ・ 1 fb 4 e 15. . . ・efc 5 eed. . . ・c 223 c 19. . . ・ 8678 a 4 f. . . ・ 66 cb 8 fb. . . B-1. 1. jar ・c 223 c 19. . . ・ 8678 a 4 f. . . ・ 65 cb 8 fb. . . A-1. 1. jar ・ffbc 6 ef. . . ・ 1 fb 4 e 15. . . C-1. 0. jar ・c 223 c 19. . . ・ 8678 a 4 f. . . ・ 6 cc 9602. . . 類似度の高いものも検出 k個の 1ビットハッシュ値列の 16進表記 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 12
再利用元の検出 Input. jar パッケージ一覧 ・ 530 a 502. . . ・ffbc 6 ef. . . ・ 1 fb 4 e 15. . . ・efc 5 eed. . . ・c 223 c 19. . . ・ 8678 a 4 f. . . ・ 66 cb 8 fb. . . Database A-1. 0. jar ・ 530 a 502. . . ・ffbc 6 ef. . . ・ 1 fb 4 e 15. . . B-1. 1. jar ・c 223 c 19. . . ・ 8678 a 4 f. . . ・ 65 cb 8 fb. . . A-1. 1. jar ・ffbc 6 ef. . . ・ 1 fb 4 e 15. . . C-1. 0. jar ・c 223 c 19. . . ・ 8678 a 4 f. . . ・ 6 cc 9602. . . 再利用元として検出 13 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
評価実験 • 既存手法で用いられていたデータセットを利用 • 提案手法で内部のライブラリを検出し、計算コストと Precision, Recallで評価 14 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
実験環境 DB 172, 038ライブラリ in Maven Repository Input 解析対象 ランダムに 10~50個 ライブラリを合成した Jar CPU RAM Intel Xeon E 5 -2690 v 4 2. 60 GHz × 14 512 GB 1入力に対しては 1スレッドで実施 15 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
結果 • 実行時間 平均所要時間[s] 140 120 100 80 60 40 20 0 0 10 20 30 40 合成ライブラリ数 50 60 16 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
- Slides: 18