> For the complete documentation index, see [llms.txt](https://docs.cooku222.kr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cooku222.kr/security/mobile/dreamhack/codeengn-dreamhack-mobileapp-l01.md).

# \[CodeEngn/Dreamhack] MobileApp L01

### 문제 링크

<https://dreamhack.io/wargame/challenges/376>

* 해당 파일을 다운로드 해보면 .apk형식으로 되어있는데 .zip으로 파일 확장자명을 변경하면 다음과 같은 파일 조합을 발견할 수 있다.

<figure><img src="https://blog.kakaocdn.net/dna/c0V8uB/btsMBFoFaH5/AAAAAAAAAAAAAAAAAAAAAD1eX3Ao-LCdVZNm8pCAN39YNvM41FGkgvUk-tBBEKv_/img.png?credential=yqXZFxpELC7KVnFOS48ylbz2pIh7yKj8&#x26;expires=1782831599&#x26;allow_ip=&#x26;allow_referer=&#x26;signature=FpiydmBO%2BRirHFpH%2FJ8yDAPejYA%3D" alt="" height="185" width="607"><figcaption></figcaption></figure>

#### APK 파일의 구성

* AndroidManifest.xml: 앱의 메타데이터.
* classes.dex: 실행 코드.
* res/, assets/: 리소스 파일.
* META-INF/: 서명 정보.
* resources.arsc: 리소스 테이블.

→ 해당 파일의 압축 파일을 풀면 기존 apk 파일의 구성 중 파일 명이 다른 것을 발견할 수 있다(정상 파일의 classes.dex → 해당 파일의 class.dex)

<figure><img src="https://blog.kakaocdn.net/dna/cD4V9g/btsMCqYDDTn/AAAAAAAAAAAAAAAAAAAAAKqUf0kSgH-zrPEFKJJP6MdvWEiOKfgvKz9s9mRK6rF5/img.png?credential=yqXZFxpELC7KVnFOS48ylbz2pIh7yKj8&#x26;expires=1782831599&#x26;allow_ip=&#x26;allow_referer=&#x26;signature=Q0Pvk5KslaIvpeoU9oEiOOsTIGM%3D" alt="" height="206" width="661"><figcaption></figcaption></figure>

→ 해당 파일을 안드로이드 스튜디오에서 애뮬레이터로 열려고 cmd 창으로 시도해보았는데 계속 실패했다.\
→ 파일 구조를 확인해보니, 나의 안드로이드 애뮬레이터 ABI는 x86\_64를 가리키지만 해당 파일의 ABI는 armeabi-v7a 였다.\
→ api version을 확인해보기 위해 AndroidManifest.xml을 Android Studio에서 열어보았으나 파일 자체가 통으로 암호화 되어있는 것을 알 수 있다.\
→ <https://code.google.com/archive/p/android4me/downloads> 링크의 AXMLPrinter2.jar을 다운받아서 복호화를 시도한다.

```
java -jar ..\\..\\AXMLPrinter2.jar AndroidManifest.xml ..\\..\\Decrypt_AndroidManifest.xml
```

⇒ 위의 명령어를 cmd창에 복사해서 실행하면 SDK(API) 버전이 17인것을 확인할 수 있다.\
⇒ 위의 설정에 맞춰서 애뮬레이터를 설치하고 실행해준다.\
→ 그리고 keytool이라는 툴을 이용해서 테스트 키를 직접 작성해서 생성한다(cmd 창에 입력해서 생성한다)

```
keytool -genkey -v -keystore codeengn.keystore
 -alias alisas_name -keyalg RSA -keysize 2048 -validity 10000
```

→ jarsignerd으로 리사이닝을 시도한다.

```
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore codeengn.keystore ./original/modify_SmartApp\\ L01.apk alisas_name
```

→ 이 명령어를 통해 애뮬레이터를 실행하면 버튼이 하나 나온다. 버튼을 클릭하면 플래그가 도출된다.\
→ Key 값 :

```
H3ll0 C0de3ngn
```

&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cooku222.kr/security/mobile/dreamhack/codeengn-dreamhack-mobileapp-l01.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
