Analysis
FlagOneLoginActivity
onCreate
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView((int) R.layout.activity_flag_one_login);
j.g.a(this);
C((Toolbar) findViewById(R.id.toolbar));
((FloatingActionButton) findViewById(R.id.fab)).setOnClickListener(new a(this));
}
onCreate에서 다음과 같은 역할을 한다.
- activity_flag_one_login에 해당하는 레이아웃을 리소스를 불러와 뷰 생성
submitFlag
public final void submitFlag(View view) {
EditText editText = (EditText) findViewById(R.id.editText2);
d.b(editText, "editText2");
if (d.a(editText.getText().toString(), "F1ag_0n3")) {
Intent intent = new Intent(this, FlagOneSuccess.class);
new FlagsOverview().J(true);
new j().b(this, "flagOneButtonColor", true);
startActivity(intent);
}
}
public class d {
public static boolean a(Object obj, Object obj2) {
return obj == null ? obj2 == null : obj.equals(obj2);
}
public static void b(Object obj, String str) {
if (obj == null) {
IllegalStateException illegalStateException = new IllegalStateException(str + " must not be null");
h(illegalStateException);
throw illegalStateException;
}
}
}
submitFlag() 함수에서 다음과 같이 진행된다.
- editText 변수를 선언 후 findViewByID() 함수와 "editText2"의 id값을 이용하여 값을 가져온다.
- 가져온 값은 가장 먼저 d class내부 b함수를 통해 비어있는지 확인하여 비어있다면 예외 함수를 실행한다.
- 다음으로 d class 내부 a 함수에 "editText2" id값을 참조하여 가져온 값을 문자열로 변경한 값과 "F1ag_0n3"라는 문자열 값을 인자로 보내준다.
- a() 함수에서는 첫 번째 인자 값이 null이거나 두 인자 값이 다르다면 널을 반환하고 두 인자의 값이 같다면 1을 반환한다.
- 만약 두 인자 값이 같아 1을 반환한다면 이후 인텐트를 사용하여 FlagOneSuccess를 활성화시킨다.
Exploit
문제를 해결하기 위해서는 submitFlag 함수의 if문 내부로 들어가 FlagOneSuccess 액티비티를 활성화를 해야 된다.
이를 위해서는 간단하게 사용자의 입력값을 함수에 그대로 저장된 문자열과 동일하게 입력을 하면 된다.
Reference
'Android > InjuredAndroid' 카테고리의 다른 글
FLAG FOUR - Login 2 (0) | 2021.09.21 |
---|---|
FLAG THREE - RESOURCES (0) | 2021.09.21 |
FLAG TWO - EXPORTED ACTIVITY (0) | 2021.09.21 |
XSSTEST (0) | 2021.09.13 |
무결성 검증 - smali 변조 (0) | 2021.09.13 |