Android Security: Attack Vectors, Defense Strategies & Best Practices for 2025

2025-04-14 07:32:19 - xone

1. Android Development Tools

Configuration environment, development tools, test machine or virtual machine, adb

2. Practice app security

2.2 Check the app's certificate and signature

Unzip the apk file

Output certificate content 
keytool -printcert -file META-INF/CERT.RSA

View the signature file content 
cat META-INF/CERT.SF

View the certificate 
openssl pkcs7 -inform DER -in META-INF/CERT.RSA -noout -print_certs -text

2.3 Signing Android apps

	
Generate keystore 
keytool -genkey -alias demo.keystore -keyalg RSA -validity 40000 -keystore demo.keystore

Re-sign the APK 
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore demo.keystore -signedjar demo_signed.apk



2.4 Verify the app signature

Verify the APK signature 
jarsigner -verify -verbose demo_signed.apk





3. Android Security Assessment Tools

Integrated environment: Santoku (based on Ubuntu, integrating some mobile security tools)

drozer

Start drozer agent 
adb forward tcp:31415 tcp:31415 
drozer console connect run 
app.package.list run 
app.package.list -f app namerun 
app.package.info -a package 
namerun 
app.activity.info -a package 
namerun app.provider.info -a package namerun app.service.info -a package 
namerun app.broadcast.info -a package 
namerun app.package.attacksurface package 
namerun app.activity.start --action *** --category *** --component ***

Writing the drozer module

4. Exploiting vulnerabilities in the app

5. Protect the app

6. Reverse app

	
java To dex 
javac -source 1.6 -target 1.6 Example.java

#dx path: D:\AndroidSDK\build-tools\22.0.1\lib\dx.jar 
dx --dex --output=Example.dex Example.class

dex file format 
dex file parsing: 
#dexdump path: D:\AndroidSDK\build-tools\22.0.1\dexdump 
dexdump Example.dex 
dx --dex --verbose-dump --dump-to=outfile.txt Example.class

dex To smali 
baksmali.jar Example.dex -o out

smali To dex 
smali.jar out -o out.dex

dex2java 
dex2jar Example.dex 
jd-gui

NDK so library 
objdump -D ×××.so 
gdbserver+gdb

7. Cybersecurity


8. Exploitation and analysis of vulnerabilities in native code


9. Encryption and using device management policies during development


More Posts