dana-at-cp / backdoor-apk

backdoor-apk is a shell script that simplifies the process of adding a backdoor to any Android APK file. Users of this shell script should have working knowledge of Linux, Bash, Metasploit, Apktool, the Android SDK, smali, etc. This shell script is provided as-is without warranty of any kind and is intended for educational purposes only.
Apache License 2.0
2.17k stars 699 forks source link

Failed to locate smali file to hook #83

Closed wongcheehong closed 7 years ago

wongcheehong commented 7 years ago

I try it with random system apk. Why this happened [] Running backdoor-apk.sh v0.2.0 on Thu Feb 9 10:19:29 EST 2017 [+] Android payload options: 1) meterpreter/reverse_http 4) shell/reverse_http 2) meterpreter/reverse_https 5) shell/reverse_https 3) meterpreter/reverse_tcp 6) shell/reverse_tcp [?] Please select an Android payload option: 3 [?] Please enter an LHOST value: 192.168.1.150 [?] Please enter an LPORT value: 7777 [+] Handle the payload via resource script: msfconsole -r backdoor-apk.rc [] Generating RAT APK file...done. [] Decompiling RAT APK file...done. [] Decompiling original APK file...done. [] Merging permissions of original and payload projects...done. [] Running proguard on RAT APK file...done. [] Decompiling obfuscated RAT APK file...done. [] Creating new directories in original project for RAT smali files...done. [] Copying RAT smali files to new directories in original project...done. [] Fixing RAT smali files...done. [] Obfuscating const-string values in RAT smali files...done. [] Locating smali file to hook in original project...grep: android.intent.category.LAUNCHER: invalid context length argument grep: android.intent.action.MAIN: invalid context length argument grep: android.intent.category.LAUNCHER: invalid context length argument grep: android.intent.action.MAIN: invalid context length argument grep: android.intent.category.LAUNCHER: invalid context length argument done. [!] Failed to locate smali file to hook run.log.txt

dana-at-cp commented 7 years ago

@wongcheehong Which system APK? I actually never tried one.

wongcheehong commented 7 years ago

@dana-at-cp Miui system apk AnalyticsCore.zip

dana-at-cp commented 7 years ago

@wongcheehong Thanks. I'll check it out.

peterpt commented 7 years ago

firefox.apk is also bringing up that error . https://justpaste.it/13vej

Do you have any idea why ?

dana-at-cp commented 7 years ago

@wongcheehong I checked out the AnalyticsCore.apk file and it appears that there are no smali files after decompilation:

root@kali:/tmp/foo# apktool d AnalyticsCore.apk 
I: Using Apktool 2.2.1-dirty on AnalyticsCore.apk
I: Loading resource table...
I: Decoding Shared Library (com.mediatek), pkgId: 8
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /root/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

Here's the output for Pandora 7.4 (notice the classes.dex files):

root@kali:~/Code/github/backdoor-apk/backdoor-apk# apktool d -o /tmp/foobar Pandora_7.4.apk 
I: Using Apktool 2.2.1-dirty on Pandora_7.4.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /root/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
root@kali:~/Code/github/backdoor-apk/backdoor-apk#

I suspect that you are missing framework files required to fully decompile that particular APK. Consult the APK documentation for more information:

https://ibotpeaches.github.io/Apktool/documentation/

dana-at-cp commented 7 years ago

@peterpt The issue with the Firefox APK is a bug. I'll open a new issue.