cgy12306

[Android] OS 변조 탐지 기능 적용 여부 본문

Mobile

[Android] OS 변조 탐지 기능 적용 여부

cgy12306 2022. 4. 17. 17:22

왜 루팅 탐지를 하는지?

스마트폰이 루팅 탐지되면 사용자의 연락처, email 또는 다른 기밀 데이터에 접근할 수 있게 됩니다. 또한 권한 상승을 할 수 있게 되며, 보호 기법들을 우회하여 다른 앱들의 기밀 데이터에 접근할 수 있게 됩니다.

 

루팅 탐지

빌드 방법 탐지

Test-Keys는 서드 파티 개발자로부터 생성된 서명된 커스텀 키입니다. ansdroid.os.Build.TAGS 속성에 접근하여 test-keys를 확인합니다.

private boolean detectTestKeys() {
    String buildTags = android.os.Build.TAGS;
    return buildTags != null && buildTags.contains("test-keys");
}

 

su 바이너리 확인

su 바이너리가 디바이스에서 superuser인지 확인합니다.

private boolean checkForSuBinary() {
    return checkForBinary("su"); // function is available below
}

 

 

busybox 바이너리 확인

만약 디바이스가 루팅이 되었다면 busybox가 설치되어 있는 경우도 많습니다. busybox는 리눅스 명령어를 사용하며, 디바이스가 루팅되었다는 의미입니다.

private boolean checkForBusyBoxBinary() {
   return checkForBinary("busybox");//function is available below
}
private String[] binaryPaths= {
        "/data/local/",
        "/data/local/bin/",
        "/data/local/xbin/",
        "/sbin/",
        "/su/bin/",
        "/system/bin/",
        "/system/bin/.ext/",
        "/system/bin/failsafe/",
        "/system/sd/xbin/",
        "/system/usr/we-need-root/",
        "/system/xbin/",
        "/system/app/Superuser.apk",
        "/cache",
        "/data",
        "/dev"
};
private boolean checkForBinary(String filename) {
    for (String path : binaryPaths) {
        File f = new File(path, filename);
        boolean fileExists = f.exists();
        if (fileExists) {
            return true;
        }
    }
    return false;
}

binaryPaths에 있는 경로에 busybox나 su 바이너리가 있는지 확인합니다.

 

참고 : https://medium.com/@deekshithmoolyakavoor/root-detection-in-android-device-9144b7c2ae07

'Mobile' 카테고리의 다른 글

[Android] split(분할된) APK 합치기  (0) 2023.07.05
[Mobile] Windows Apktool 설치  (0) 2022.12.21
[Mobile App] 어플리케이션 취약점 진단 세팅  (0) 2022.03.29
Comments