분류 전체보기
-
Android NDK - C Language Build ( Native )Mobile/Android 2020. 4. 24. 00:48
Android에서 독립적으로 실행할 수 있는 Native Binary를 빌드하기 위한 방법이다. 보통의 경우에는 AndroidStudio에서 Java/Kotlin+Native의 형태로 많이 사용되지만, Native Binary만 독립적으로 사용해야 하는 경우에는 이 방법으로 빌드하면 된다. 나 같은 경우에는 Android System Exploit 연구를 하면서 C언어로 Exploit Code를 작성하고 빌드해야 하기 때문에 이 방법을 사용한다. Android NDK 환경 설정 먼저 아래 링크에서 최신버전의 Android NDK를 다운로드 한다. https://developer.android.com/ndk/downloads 호스트 플랫폼에 맞는 패키지를 다운로드하고 적당한 위치에 압축을 풀어준다. 나는 ..
-
Taint Analysis ( IDA lighthouse & FRIDA )System/Reversing 2020. 4. 17. 00:53
Taint Analysis란, 프로그램이 동작하면서 실행되는 코드의 흐름을 파악하는 분석 기술이다. 좀 더 직관적으로 설명하면, 실행되는 Instruction마다 색을 칠해놓고 전체적인 결과를 보면 실행된 Instruction만 색이 칠해져 있을 것이다. 실제 코드가 실행되는 부분을 파악할 수 있기 때문에 분석할 때 엄청난 이점이 될 수 있다. IDA의 lighthouse은 DBI툴로 얻은 Taint Analysis결과를 코드블럭에 표시해주는 플러그인이다.lighthouse와 호환되는 DBI툴은 PIN, DynamoRIO, FRIDA가 있으며, 그 중 FRIDA를 사용하는 방법을 소개하려고 한다. PIN툴은 Intel아키텍처에서만 지원되고, DynamoRIO는 MacOS 64bit를 지원하지 않는 것 같..
-
Ubuntu16.04 python3.6 설치 (에러 해결)ETC 2020. 4. 4. 04:13
sudo add-apt-repository ppa:jonathonf/python-3.6 sudo apt update sudo apt install python3.6 보통 위 명령어를 사용하면 된다고들 한다. 근데 나는 아래처럼 apt-repository 403 Error가 발생한다. W: The repository 'http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial Release' does not have a Release file. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8)..
-
Telegram Extractor (텔레그램 대화내용 추출)Issue 2020. 3. 25. 02:52
'텔레그램'하면 제일 먼저 떠오르는게 'Private' ,'Secure'일 것이다. 텔레그램에서도 이 부분을 가장 강조하고 있으며, 지속적인 업데이트로 더욱 더 견고해지고 있다. 또한, 모든 소스코드를 오픈소스로 공개하여 암호화를 크래킹하면 보상을 지급하는 CryptoContest도 진행하고 있다. https://github.com/telegramdesktop/tdesktop - Telegram Desktop Github https://telegram.org/blog/cryptocontest - Telegram Crypto Contest 요즘 말이 많은 '그 사건'에서 많은 메신저들 중 텔레그램을 선택한 이유도 위와 같은 'Private한 성격' 때문일 것이다. 그러라고 만든게 아닐텐데 말이다. 이런 사..
-
Universal SSL Pinning Bypass ( Android )Mobile/Frida 2020. 3. 8. 20:01
function SSLContext() { var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager'); var SSLContext = Java.use('javax.net.ssl.SSLContext'); // build fake trust manager var TrustManager = Java.registerClass({ name: 'com.sensepost.test.TrustManager', implements: [X509TrustManager], methods: { checkClientTrusted: function (chain, authType) { }, checkServerTrusted: function (chain, authType) {..
-
FRIDA Cheat SheetMobile/Frida 2020. 3. 2. 06:32
1. 메모리 스캔 및 검색 2. Boolean 값 생성 3. Class 인스턴스 생성 및 Method 호출 4. ByteArray 출력 5. Native 함수 NOP 처리 6. Natvie 함수 인자값 및 반환값 조작 메모리 스캔 및 검색 function Memory_scan() { var ranges = Process.enumerateRangesSync({protection: 'r--', coalesce: true}); var range; function Next_Range(){ range = ranges.pop(); if(!range) { console.log("Memory Scan Done!"); return; } Memory.scan(range.base, range.size, "70 79 30 7..
-
Anti-Debugging 우회 ( ptrace 선점 )Mobile/Frida 2020. 2. 29. 03:23
안티디버깅이 적용되어 있는 어플을 IDA나 GDB로 Attach하려고 하면 앱이 바로 종료되어 버린다. 또한, ptrace를 미리 선점하는 방식으로 안티디버깅이 적용된 경우도 있다. 이런 방식의 안티디버깅을 우회할 수 있는 방법 중 dlopen( )으로 우리가 원하는 라이브러리가 로드됐을 때, 바로 sleep을 걸어서 안티디버깅이 동작하기 전에 디버거를 Attach 해주는 방법이 있다. Interceptor.attach(Module.findExportByName(null, "dlopen"), { onEnter: function(args) { this.libc_name = Memory.readUtf8String(args[0]); if (this.libc_name.indexOf("libfoo.so") !==..