
Chromium 확장 프로그램 및 APK에 선언된 권한을 해싱하는 프레임워크로, 잠재적으로 악성인 패키지 전반에 걸친 클러스터링, 헌팅, 피보팅을 가능하게 합니다.
Permhash는 Chromium 기반 브라우저 확장 프로그램과 APK에 적용된 선언된 권한을 해시하여 가져오기 해싱(import hashing) 및 리치 헤더 해싱(rich header hashing)과 유사하게 클러스터링, 헌팅, 피벗이 가능하도록 하는 확장 가능한 프레임워크입니다.
Permhash는 현재 네 가지 유형의 파일에서 실행할 수 있지만 그 이상으로 확장할 수 있습니다:
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 블로그를 참조하세요.
Permhash Google 그룹을 사용하여 토론을 진행할 수 있습니다.
이 제품은 공식적으로 지원되는 Google 제품이 아닙니다.