Exercise 3

Application is leaking data - Fix in Smali

Process

  • Extract data from apk with apktool: apktool d app-release.apk

  • Fix the smali code.

  • Repackage the apk: apktool b app-release

The issue

  • Clear the log: adb logcat -c

  • Filter by pid; adb logcat --pid=$(adb shell pidof pt.ua.deti.hello)

  • Ignore all processes, except for tag hello: adb logcat -s "*:S hello"

Offending code

app-release/smali/pt/ua/deti/hello/MainActivity.smali

The fix

Deploy

  • apktool b app-release --use-aapt2

  • java -jar uber-apk-signer-1.2.1.jar --apks app-release/dist/app-release.apk

  • adb uninstall pt.ua.deti.hello

  • adb install app-release/dist/app-release-alisigned-debugSigned.apk

Verification

  • adb logcat -s "*:S hello"

Last updated