
Chromium 拡張機能と APK で宣言された権限をハッシュ化し、潜在的に悪意のあるパッケージ間でのクラスタリング、ハンティング、ピボッティングを可能にするフレームワーク。
Permhashは、Chromiumベースのブラウザ拡張機能とAPKに適用された宣言済み権限をハッシュ化する拡張可能なフレームワークであり、インポートハッシュやリッチヘッダーハッシュと同様に、クラスタリング、ハンティング、ピボットを可能にします。
Permhashは現在、4種類のファイルに対して実行できますが、これ以外にも拡張可能です。
permhashライブラリをインストールします
pip install permhash
permhashをインポートします
from permhash import functions as permhash
permhashを使用します
# The path variable should be the full path to the file you wish to use to calculate the permhash.
# Calculate the permhash for a CRX
ph = permhash.permhash_crx(path)
# Calculate the permhash for a CRX manifest
ph = permhash.permhash_crx_manifest(path)
# Calculate the permhash for an APK
ph = permhash.permhash_apk(path)
# Calculate the permhash for an APK manifest
ph = permhash.permhash_apk_manifest(path)
permhashを一括計算する例です。
import csv
import os
from permhash import functions as permhash
def bulk_permhash_crx_manifest(path, output):
"""
Computes the permhash from a directory of CRX manifests
Outputs the results in a csv passed as input
:param path: The targeted directory
:type path: string
:param output:
:type path: string
"""
with open(output, mode="w", encoding="utf-8") as results:
out_writer = csv.writer(
results, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
)
out_writer.writerow(["filename", "permhash"])
for filename in os.listdir(path):
if path.endswith("/"):
full_path = path + filename
else:
full_path = path + "/" + filename
calculated_permhash = permhash.permhash_crx_manifest(full_path)
if calculated_permhash:
out_writer.writerow([filename, calculated_permhash])
Permhashはコマンドラインツールとしても使用できます。--path/-pスイッチでpermhashを計算するファイルへのフルパスを指定し、--type/-tスイッチで分析対象のファイルタイプを指定します。コマンドはpermhash、またはファイルが無効な場合はFalseを出力します。
permhash --type crx --path '[PATH TO CRX File]'
permhash --type crx_manifest --path '[PATH TO CRX Manifest File]'
permhash --type apk --path '[PATH TO APK File]'
permhash --type apk_manifest --path '[PATH TO APK Manifest Files]'
詳細については、Mandiant Permhash Blogを参照してください。
Permhash Google Groupは、ディスカッションを促進するために使用できます。
これはGoogleの公式サポート対象製品ではありません。