안드로이드는 모바일 폰, TV, 웨어러블 디바이스 등 다양한 스마트 디바이스를 위한 구글의 오픈소스 플랫폼이다. 안드로이드 어플리케이션으로 기업과 사용자를 위한 다양한 서비스가 제공되고 있다. 안드로이드 어플리케이션은 주로 Java로 제작하고 안드로이드 플랫폼 API를 사용한다. 안드로이드 어플리케이션은 사용자 인터페이스를 제공하는 액티비티(Activity) 컴포넌트와 백그라운드에서 기능을 제공하는 서비스(Service) 컴포넌트, 시스템으로 방송되는 방송메시지로 기능을 수행하는 브로드캐스트 리시버(Broadcast Receiver) 컴포넌트, 어플리케이션 간 데이터를 공유하는 컨텐트 프로바이더(Content Provider) 컴포넌트로 구성된다. 안드로이드 플랫폼에서는 인텐트(Intent) 메시지를 이용해 컴포넌트 간 통신(ICC: Inter Component Communication)을 지원한다. 인텐트 메시지는 호출하는 대상 컴포넌트를 지정하고 해당 컴포넌트가 요구하는 데이터를 제공한다. 호출되는 컴포넌트를 함수에 비유하면 인텐트는 함수를 호출하며 전달하는 함수의 인자와 같은 정보이다. 최근 연구 결과에 따르면 안드로이드는 인텐트로 인해 발생하는 취약점이 많다고 한다. 안드로이드 시스템은 컴포넌트에서 요구하는 인텐트 형태와 다르게 누락된 데이터가 있거나 타입이 다른 잘못된 인텐트를 컴포넌트에 전달하면 어플리케이션이 비정상적으로 종료되거나 안드로이드 OS가 재부팅되는 문제가 발생한다. 이러한 문제는 안드로이드 시스템에서 잘못된 인텐트를 컴파일 시간 검출하지 못하기 때문에 발생한다. 그러므로 실행시간에 잘못된 인텐트가 컴포넌트에 전달되어야 비로소 취약점이 확인된다. 기존 연구들은 이러한 취약점을 방어하고 파악하기 위해 인텐트를 실행시간에 검사하는 방법과 인텐트의 랜덤 생성한 인텐트로 테스트하는 방법을 사용한다. 실행시간에 검사하는 방법은 인텐트의 Extra 필드를 실행시간에 검사해 누락된 값을 기본값으로 대체하는 Dart와 실행시간에 데이터 값이 같은지 비교하는 Jackson 두 가지있다. 테스트 하는 방법은 대상만 지정된 빈 인텐트를 전달하는 Intent Fuzzer와 Intent Fuzzer를 확장한 실험으로 인텐트의 Action, Data, Extra를 랜덤 생성한 인텐트로 테스트하는 jarjarbinks, 정적분석을 통해 Action과 Extra를 파악하고 이 정보를 기반으로 랜덤 생성한 인텐트로 테스트하는 Intent Fuzzer with static analysis 세 가지가 있다. 기존 연구들은 인텐트의 형태를 선언할 수 있는 방법이 없어 인텐트의 일부 필드만을 방어하고, 테스트시 랜덤 생성하는 인텐트를 변경하기 위해 소스코드를 직접 변경해야 하는 단점이 있다. 본 논문에서는 기존 연구들의 문제점을 보안하고 안드로이드에서 인텐트로 발생하는 취약점을 개선하기 위해서 인텐트의 형태를 선언할 수 있는 인텐트 스펙을 제안한다. 또한, 인텐트 스펙을 응용하여 인텐트로 인해 발생하는 취약점을 방어하는 방법 한 가지와 파악하는 세 가지 방법을 제안한다. 첫째, 실행시간 검사방법은 인텐트 스펙으로 컴포넌트가 요구하는 인텐트를 선언하고 선언된 인텐트 스펙과 전달된 인텐트를 실행시간에 검사하여 잘못된 인텐트를 검출한다. 검출된 잘못된 인텐트를 정상 인텐트로 개발자가 복구할 수 있도록 에러 코드와 메시지를 제공한다. 이 방법은 기존 연구에서 일부 필드를 이용해 방어하는 방법과 달리 인텐트 스펙으로 선언한 모든 필드를 검사해 방어한다. 둘째, 유닛 테스트 방법은 테스터가 인텐트 스펙으로 선언한 인텐트를 기반으로 랜덤 생성한 인텐트를 디바이스에 전달하고 디바이스에서 발생하는 취약점을 자동으로 파악하는 자동된 테스트 방법이다. 이 방법은 기존 연구들에서 하지못한 테스트 자동화를 제공하고 인텐트 스펙으로 랜덤 생성하는 인텐트의 형태를 자유롭게 변경할 수 있는 장점이 있다. 셋째, 인텐트 스펙 자동생성 테스트 방법은 안드로이드 설정파일(매니페스트)에 선언되는 인텐트를 이용해 인텐트 스펙을 추출하고 추출된 인텐트 스펙으로 랜덤 생성한 인텐트를 이용해 테스트한다. 안드로이드 설정파일은 프로젝트에도 포함되고 컴파일된 바이너리 파일에도 포함되어 있어 소스코드가 없는 환경에서도 인텐트로 발생하는 취약점을 파악할 수 있다. 넷째, JUnit 테스트 검사 방법은 안드로이드 스튜디오의 JUnit을 이용한 테스트 방법으로 JUnit 테스트 케이스를 인텐트 스펙을 기반으로 자동 생성하는 방법이다. 이 방법은 테스트 케이스를 자동으로 생성해 기존에 테스트 케이스를 자바코드로 직접 작성해야하는 불편함을 제거한다. 본 논문의 구성은 다음과 같다. 2장에서 안드로이드 개요와 관련 연구에 대해서 설명한다. 3장에서는 인텐트 형태를 선언할 수 있는 인텐트 스펙을 제안한다. 4장에서는 인텐트 스펙을 응용한 네 가지 취약점 개선 방안을 제안한다. 네 가지 방법은 실행시간 검사 방법, 인텐트 스펙 기반 랜덤 테스팅 방법, 앱 바이너리에서 인텐트 스펙 자동 생성 방법, 인텐트 스펙 기반 JUnit 테스트 케이스 자동 생성 방법이다. 5장에서는 결론 및 향후 연구를 논의한다.
In this thesis, we propose Intent specification framework which improves the vulnerability caused by intent in android. Intent is the message for Inter-Component Communication(ICC) between components. An android component delivers the intent to android system, and activates as a target component to deliver the required data by the target component. Comparing the component in android to a function, the intent can be regarded as the function argument. An android application can be stoped abnormally if the malformed intent is delivered, which does not follow what the component expects. This vulnerability is due to the fact that android system cannot decide whether it is a malformed intent. With this vulnerability, android application can be stoped abnormally, or even the android system can get rebooted. In this thesis, to remedy the vulnerability caused by intent, the following are proposed : one defending method of Android components by checking the intent in runtime, and three testing methods discover out the vulnerability in runtime. Under the previous research work, it is hard to describe the clear shape of intent which the 87 component expects, and it is necessary to change the code for testing due to the trickiness of changing the shape of intent. To solve these problems, we suggest intent spec, which can describe the shape of intent. The intent spec allows intent shape to describe easily and it is easy to generate intents in various shapes. Applying the approach described above, we propose four different methods to improve the vulnerabilities that might be caused by intent. The first method is a defending method by which the system enables to compare the shape of intent described by intent spec and the intent delivered to the component in runtime so that it can identify the malformed intent and defend the system against it. The second one is a testing method which assists in testing the target component and recognizing the test results automatically by generating random intent corresponding to the description for target intent to be tested. The third one is for testing vulnerability with android application binary file, which doesn’t have source code. We build random intent with extracted intent from android application binary file. Using this produced random intent, we suggest the target application testing method. The final one is an automated method that generates the random test cases for JUnit tests based on intent spec, which is unit test tool of Android studio. The advantages of the proposed methods are that they can defend wrong intent directly and prevent the abnormal termination. Therefore, they can provide normal service and be able to run various ways of test as generating freely the intent which is based on intent spec. The test results demonstrated that the proposed methods are useful for defending and identifying the vulnerabilities caused by the intent in open source applications and commercial applications.