짱짱해커가 되고 싶은 나

[안드로이드 취약점 진단] 3-2. Intent Sniffing and Injection 본문

모바일

[안드로이드 취약점 진단] 3-2. Intent Sniffing and Injection

동로시 2022. 6. 11. 01:10

Intent

4가지 컴포넌트들이 서로 호출, 메시지 및 데이터를 수신하는 역할 수행

  • 명시적(explicit) intent : 수신 대상을 구체적으로 명시
Intent i = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(i);
  • 암시적(implicit) intent : 수신 대상을 명시하지 않고 호출
Intent i = new Intent("blah");
startActivity(i);

-> startActivity(intent)가 아닌 this.sendBroadcast(intent)를 사용하는 경우 암시적 intent를 모든 apk에 브로드캐스트하게 된다. 즉, 드로저에서도 intent가 도착하면 스니핑이 가능하다는 것이다.

 

인시큐어뱅크 - Flawed Broadcast Receivers

intent를 사용하는 곳은 아주 많고 implicit 인텐트를 사용하는 곳도 많다. 

브로드캐스트에 인텐트를 사용하는 곳은?

이 중에서 ChangePassword 를 타겟으로 해보자

ChangePassword

broadcastChangepasswordSMS 함수를 보면 intent에 theBroadcast 액션을 넣고 phonenumber와 newpass를 넣어서 브로드캐스트를 보낸다. 그리고 해당 함수는 postData -> doInBackground 에서 실행된다.

여기서 theBroadcast 액션은 1에서 본 친구랑 같이 exported=true 였기 때문에 밖으로 인텐트를 뿜뿜해준다.

그렇다면 이 브로드캐스트를 받아보자..

 

Exploit

run app.broadcast.sniff --action "theBroadcast" 로 드로저 앱에 리시버를 등록한다.

그리고 인시큐어뱅크에서 change password를 누를 경우 드로저에서 전화번호와 새 비밀번호를 확인할 수 있다.

(드로저 설치하고 직접 해보겠습니다..)

 

그렇다면 스니핑만 되냐? injection도 된다. (3-1과 동일)

run app.broadcast.send --action theBroadcast --extra string phonenumber 123456789 --extra string newpass supersecurepass

 

Comments