I Bypassed an Android Login Screen with One Line of Text — Here’s the Code That Let Me Do It
The Allsafe Android app's login screen concatenated user input directly into a SQL query, allowing an attacker to bypass authentication and dump all user credentials. The app also stored passwords as unsalted MD5 hashes, making them trivially crackable.
Published on medium.com
There’s a reason SQL Injection has lived at the top of the OWASP charts for over two decades. Not because it’s sophisticated — but because it’s everywhere, it’s forgiving of mistakes, and developers keep relearning the same lesson the hard way.
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
The app used raw SQL string concatenation with unparameterised user input in SQLiteDatabase.rawQuery(), and additionally stored passwords as unsalted MD5 hashes.
Impact
An attacker with physical access to the device could bypass the login and read all stored usernames and password hashes, which are immediately crackable due to unsalted MD5.
What the attacker needed
Physical access to the device; Allsafe app installed
The fix
The app should use parameterised queries with placeholders and replace MD5 with a modern password hashing algorithm such as Argon2 or bcrypt.
How it was found
- Open the Allsafe app's login screen.
- Enter a crafted username containing a SQL comment and a tautology, and any password.
- Tap Login; the app bypasses authentication and displays all user credentials in a toast.
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 built its login check by gluing together text from the username box and the password box into a database command. By typing special characters, a user could change the meaning of that command so it always said 'yes' and also printed every stored username and password. The passwords were stored in a weak, easily reversed form.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.