How I hacked modern vending machines
The Android app for a vending machine stored its local SQLite database encrypted with a key derived from the device's IMEI, which is easily obtainable. An attacker with physical access to a rooted phone could decrypt the database, modify the wallet credit, and use the inflated balance to make purchases.
hackernoon.com
Published on hackernoon.com
ENES
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the app used a predictable, device-specific value (the IMEI) as the encryption key for its local database, and stored the database on the device without additional protection.
Impact
An attacker could inflate the app's credit, buy items, and repeat the process, effectively obtaining goods for free.
What the attacker needed
Rooted Android phone; USB debugging enabled; physical access to the phone; target app installed
The fix
The app should not use a predictable device identifier as an encryption key; it should use a securely generated key stored in the Android Keystore, and the database should be protected against tampering.
How it was found
- Install the target app on a rooted Android phone with USB debugging enabled.
- Pull the APK from the device using adb.
- Decompile the APK with apktool and extract Java sources with jadx.
- Make the APK debuggable by editing AndroidManifest.xml, rebuild, sign, and install it.
- Find the database name (argenta.db) and pull it from the device.
- Open the database with a SQLite browser, edit the walletCredit field, and push it back to the phone.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The app kept a local database of your wallet balance on the phone, protected by a password made from the phone's own hardware ID (IMEI). Since anyone can read that ID, a person with a rooted phone could open the database, change the balance, and then use the app to buy things for free.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.