参考资料
- https://www.owasp.org/index.php/Main_Page
- https://github.com/OWASP/owasp-mstg/raw/master/Checklists/Mobile_App_Security_Checklist.xlsx
常见工具
反编译
- jadx反编译工具:https://github.com/skylot/jadx
- 重新编译:https://ibotpeaches.github.io/Apktool/
- smali语法:https://source.android.com/devices/tech/dalvik/dalvik-bytecode
#反编译
java -jar apktool_2.3.4.jar decode keep.apk -o keep_source
#修改smali指令
#vim keep_source/smali/com/gotokeep/keep/KApplication.smali
#重新编译
java -jar apktool_2.3.4.jar build keep_source/ -o keep-new.apk
#生成一个证书,只执行一次即可
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias
#用证书签名
jarsigner -verbose -keystore my-release-key.jks -signedjar keep-new-signed.apk keep-new.apk my-alias
#安装到手机,需要删除原来的Keep
adb install -r keep-new-signed.apk
#检测修改结果
adb logcat | grep testerhome
修改smali指令
method public onCreate()V
.locals 4
.prologue
const/4 v1, 0x1
const/4 v2, 0x0
.line 162
invoke-super {p0}, Landroid/app/Application;->onCreate()V
#新增指令开始
const-string v0, "testerhome"
const-string v1, "hello from seveniruby"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
const/4 v1, 0x1
const/4 v2, 0x0
#新增修改结束
修改完成的结果
09-09 11:34:21.358 25656 25656 E testerhome: hello from seveniruby
09-09 11:34:21.643 25715 25715 E testerhome: hello from seveniruby
09-09 11:34:21.667 25743 25743 E testerhome: hello from seveniruby
问题记录:
如果出现未处理成功的png图片,简单修改下对应的png图片的后缀名为.bak即可,删除的话会报错
动态破解
- XPosed: http://repo.xposed.info/module/de.robv.android.xposed.installer
- Frida
- Substrate
XPosed使用教程:https://github.com/rovo89/XposedBridge/wiki/Development-tutorial
创建xposed的扩展:https://github.com/rovo89/XposedExamples/blob/master/RedClock/src/de/robv/android/xposed/examples/redclock/RedClock.java
- 把installer安装到一个root过的机器上
- 安装框架
- 增加application的meta-data
- 添加xposed bridge api jar包并设置为不要打包进去
- 增加Class 替换方法
- 增加assets/xposed_init,填充类的路径
- 安装,并用xposed installer加载
- 重启
问题
- android 模拟器需要superuser
- bridge api jar包不要打包进去
服务端安全
- 演练环境: http://jenkins.testing-studio.com:8082/login.php
- BurpSuite
- Zap: GitHub - zaproxy/zaproxy: The OWASP ZAP core project
- Sqlmap: http://sqlmap.org/
sql注入
python sqlmap.py \\
-u 'http://jenkins.testing-studio.com:8082/vulnerabilities/sqli/?id=1&Submit=Submit' \\
--cookie='PHPSESSID=etnulu8he9abjppi8gg6u42el7;security=low' \\
--batch \\
--dbms=mysql
作业1
- 反编译一个雪球应用,找下雪球的Application
- 重新编译Keep
把上面的两个结果,截图贴到回复里
作业2
对dvwa测试系统进行安全测试,使用sqlmap或者zap去扫描里面的随便一个漏洞。把扫描出来的漏洞贴图到回复里