R136A1

[InsecureBank] 2. Intent Sniffing and Injection 본문

Android/InsecureBankv2

[InsecureBank] 2. Intent Sniffing and Injection

r136a1x27 2021. 11. 5. 11:59

개념

인텐트 Intent: 다른 app component에 action을 요청할 때 사용하는 메시지 오브젝트

- 암시적 인텐트 implicit intent: action을 지정해놓고, 그것을 실행할 수 있는 app을 기기 전체에서 찾음

ex) Intent intent = new Intent(ACTION값);

 

- 명시적 인텐트 explicit intent: 특정 app component(앱 안의 특정 activity, service)를 지정함

ex) Intent intent = new Intent(getApplicationContext(), 특정 액티비티.class);

 

=> 두 인텐트는 인자값으로 구분됨.

 

특히 implicit intent에서 startActivity(intent);가 아닌 this.sendBroadcast(intent);를 통해 실행되는 경우 주목

즉 implicit intent는 모든 어플리케이션에 broadcast됨. 즉, drozer에도 intent가 도착하며 이것을 스니핑할 수 있다.

그렇다면 Insecure bank에서 implicit intent를 사용하는 기능을 찾아야 한다.

→ bytecode viewer에서 class 하나하나 들여다보면서 intent를 생성하는 코드(new Intent)를 보고,

   인자 또는 set 메소드를 보고 암시적 intent를 찾은 뒤, sendBroadcast(intent);가 실행되는 경우를 찾는다.

 

*추가 참고

https://bb-library.tistory.com/107

https://jsue.tistory.com/16

아직까지 Receiver와 intent의 완전한 동작 매커니즘은 잘 모르겠다.

 

취약점 찾기

DoLogin.class에 있는 아래 Intent는 명시적 Intent이다.

PostLogin.class에 있는 아래 Intent는 명시적 Intent이다.

명시적 Intent는 너무 많다. (아래 하나 빼고 다 startActivity로 실행되는 명시적 intent이다)

 

 

ChangePassword.class에 있는 아래 Intent는 암시적 Intent에 Broadcast를 사용하고 있다.

Insecure bank에서는 민감한 정보인 비밀번호를 변경할 때 implicit intent+Broadcast를 사용하고 있다.

왜 굳이 비밀번호를 변경할 때 Broadcast를 사용할까..?

 

Exploit 하기

run app.broadcast.sniff --action "theBroadcast"

drozer 앱에 브로드캐스트 리시버를 등록한다. (스니핑하기 위한)

브로드캐스트 리시버는 1. Flawed Broadcast Receivers에서 분석했듯이,

"theBroadcast"라는 이름을 가지는 action을 받는다. 또 이 이름으로 전송하기도 한다(?)

등록한 상태에서, Change Password 기능을 사용할 경우 intent를 sniffing하여 변경된 패스워드를 확인할 수 있다.

 

 

 

 

 

Comments