Kye0m's Security

[Diva] Hardcoding issues(Part2) 본문

앱 모의해킹/Diva

[Diva] Hardcoding issues(Part2)

Kye0m 2022. 10. 1. 16:59

Diva - Hardcoding issues(part2)

이번문제도 특정 key값을 입력하여 푸는 문제이다.

 

[풀이과정]

access버튼을 눌렀을 때, 파일함수 후킹을 통해 Hardcode2Activity.access에서 함수가 실행되는 것을 알 수 있다.

 

  public void access(View view) {
        EditText hckey = (EditText) findViewById(R.id.hc2Key);
        if (this.djni.access(hckey.getText().toString()) != 0) {
            Toast.makeText((Context) this, (CharSequence) "Access granted! See you on the other side :)", 0).show();
        } else {
            Toast.makeText((Context) this, (CharSequence) "Access denied! See you in hell :D", 0).show();
        }
    }
}

jadx-gui를 통해서 확인해보면, this.djni.access에 String을 입력했을 때, 참이되어서 나오면

통과할 수 있는 것을 확인할 수 있다.

 

public class DivaJni {
    private static final String soName = "divajni";
    public native int access(String str);
    public native int initiateLaunchSequence(String str);
    static {
        System.loadLibrary(soName);
    }
}

divajni 라이브러리를 호출하는것을 알 수 있다.

 

 

libdivanji.so를 분석을 위해, adb pull 명령어를 통해서 데스크탑으로 옮겨왔다.

 

ida로 분석을 해보면, Java_jakhar_aseem_diva_DivaJni_access에서 'olsdfgad;lh'와 memcmp를 한 결과를 반환한다.

비교하는 문자열이 하드코딩 되었기 때문에 해당 문자열을 입력하면 문제를 해결할 수 있다.

 

 

 

'앱 모의해킹 > Diva' 카테고리의 다른 글

[Diva] Access control issues(Part3)  (0) 2022.10.02
[Diva] - Hardcoding issues(Part1)  (1) 2022.09.29
[Diva] -Insecure Logging  (1) 2022.09.29