UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS
Information Technology Security
Vasileios Evangelos Athanasiou
Student ID: 19390005
Supervision
Supervisor: Ioanna Kantzavelou, Associate Professor
Co-supervisor: Angelos Georgoulas, Assistant Professor
Athens, June 2023
This laboratory project demonstrates an Android Repackaging Attack, a technique in which a legitimate Android application is disassembled, modified to include malicious functionality, and then reassembled and redistributed.
In this scenario, the injected malicious code is triggered by a system event and is capable of either deleting a victim’s contacts or tracking the victim’s location.
| Section | Path / File | Description |
|---|---|---|
| 1 | assign/ |
Official laboratory exercise specifications |
| 1.1 | assign/Exercise 4 (Android Repackaging)_2023.pdf |
Assignment description (English) |
| 1.2 | assign/Άσκηση 4 (Android Repackaging)_2023.pdf |
Assignment description (Greek) |
| 2 | docs/ |
Project report and analysis |
| 2.1 | docs/Android-Repackaging.pdf |
Technical report (English) |
| 2.2 | docs/Ανασυσκευασία-Εφαρμογών-Android.pdf |
Technical report (Greek) |
| 3 | manuals/ |
Reference manuals and lab environment documentation |
| 3.1 | manuals/AndroidVM.html |
Android virtual machine setup guide |
| 3.2 | manuals/SEEDAndroid_UserManual.pdf |
SEED Android user manual |
| 3.3 | manuals/SEEDAndroid_VirtualBox.pdf |
SEED Android VirtualBox configuration |
| 4 | screens/ |
Experimental screenshots and step-by-step evidence |
| 5 | README.md |
Repository overview and usage notes |
The attack is carried out using two virtual machines connected to the same NAT network:
- Attacker Environment: SEEDUbuntu 16.04 (32-bit)
- Victim Environment: SEEDAndroid
- adb (Android Debug Bridge): Used to communicate with the Android VM and install applications.
- apktool: Used to disassemble and rebuild APK files.
- keytool & jarsigner: Used to generate digital keys and sign the modified APK so it can be installed on Android devices.
The target application (RepackagingLab.apk) is disassembled to access its internal components:
apktool d RepackagingLab.apkThis process produces:
- smali files: Compiled Java bytecode representation
AndroidManifest.xml: Application configuration and permissions- Resources: Layouts, assets, and metadata
Malicious code (e.g., MaliciousCode.smali) is inserted into the application’s directory structure (such as /smali/com).
The AndroidManifest.xml file is altered to:
- Request unauthorized permissions (e.g.,
READ_CONTACTS,WRITE_CONTACTS) - Register a custom BroadcastReceiver
The malicious logic is configured to execute when a TIME_SET broadcast event occurs (i.e., when the system time is changed).
After modifications, the application must be rebuilt and digitally signed:
apktool b RepackagingLabkeytool -genkey -v -keystore mykey.keystore -alias distjarsigner -keystore mykey.keystore RepackagingLab.apk distSigning is required because Android will not install unsigned or tampered applications.
The signed malicious APK is installed on the victim device using:
adb install RepackagingLab.apkOnce the victim grants the requested permissions and a system time change occurs, the registered BroadcastReceiver activates and executes the injected smali code.
Upon the TIME_SET event, the malicious code deletes all contacts stored on the victim’s device.
The malicious code retrieves the victim’s GPS coordinates (simulated via MockLocation) and sends them to an attacker-controlled web server.
This lab highlights how Android repackaging attacks exploit user trust in legitimate applications. By modifying application code and abusing system broadcasts and permissions, attackers can introduce severe privacy and security threats. The exercise emphasizes the importance of application integrity checks, trusted distribution channels, and careful permission management in Android environments.
This guide describes how to set up the required environment to reproduce the Android Repackaging Attack laboratory exercise using the SEED virtual machines.
- Host OS: Windows / Linux / macOS
- Virtualization Software:
- Oracle VirtualBox (recommended)
- Minimum Hardware:
- 8 GB RAM (4 GB minimum)
- CPU with virtualization enabled (Intel VT-x / AMD-V)
- ~20 GB free disk space
Two virtual machines are required and must be connected to the same NAT Network.
- SEEDUbuntu 16.04 (32-bit)
- Used for:
- APK disassembly
- Malicious code injection
- Repackaging and signing
- SEEDAndroid
- Used for:
- Installing and executing the repackaged APK
- Observing malicious behavior
- Download the SEEDUbuntu 16.04 (32-bit) VM image.
- Open VirtualBox → File → Import Appliance.
- Select the SEEDUbuntu .ova file.
- Assign:
- RAM: ≥ 2048 MB
- CPU: ≥ 1 core
- Import the appliance.
- Download the SEEDAndroid VM image.
- Import it into VirtualBox using the same procedure.
- Do not start the VM yet.
Both VMs must be on the same NAT Network. For each VM:
- Settings → Network
- Adapter 1:
- Attached to: NAT Network
- Name: e.g. seed-nat
This enables communication between the attacker and victim environments.
sudo apt update
sudo apt upgrade- Java Development Kit (JDK)
sudo apt install openjdk-8-jdkVerify:
java --version- apktool
sudo apt install apktoolVerify:
apktool- Android Debug Bridge (adb)
sudo apt install adbVerify:
adb version- Keytool & Jarsigner These are included with the JDK installation. Verify:
keytool -help
jarsigner -helpInside the SEEDAndroid VM:
- Open Settings
- Go to About Tablet / Phone
- Tap Build Number multiple times to enable Developer Mode
- Enable:
- USB Debugging
- Mock Locations (if required for the location attack)
On SEEDUbuntu:
adb devicesYou should see the SEEDAndroid device listed. If not:
adb kill-server
adb start-servergit clone https://github.com/Information-Technology-Security/Android-Repackaging.git
cd Android-RepackagingAt this point, the environment is fully configured and ready for:
- APK disassembly using apktool
- Smali code modification
- Manifest permission injection
- APK rebuilding and signing
- Deployment to the Android VM via adb
Proceed to the Attack Workflow section of this repository to execute the repackaging scenarios.
- Always sign the rebuilt APK before installation.
- Unsigned or improperly signed APKs will fail to install.
- Ensure both VMs remain on the same NAT Network.
- Use 32-bit SEEDUbuntu only, as required by the lab.
- Navigate to the
docs/directory - Open the report corresponding to your preferred language:
- English:
Android-Repackaging.pdf - Greek:
Ανασυσκευασία-Εφαρμογών-Android.pdf
- English:
