Skip to content
Crypto Write-up Intermediate

Cracking the Code: How I Decrypted a Mobile App’s ‘Secure’ Login Secrets

The mobile app encrypted login credentials with AES using a hardcoded key and IV derived from a string resource. An attacker with the APK could extract the key and decrypt captured credentials.

gowthami09027 Follow

Published on medium.com

Hey there, fellow tech enthusiasts and aspiring hackers! Imagine this: You’re poking around a mobile app during a penetration test (pentest for short that’s when we ethically hack apps to find vulnerabilities), and you spot something fishy in the login traffic.

Blue_eye, on medium.com

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 symmetric encryption with a key and IV derived from a hardcoded string resource, making the key extractable from the APK.

Impact

An attacker who obtains the APK could decrypt captured login credentials, potentially leading to account compromise.

What the attacker needed

Access to the APK; ability to capture network traffic

The fix

The app should use proper key management instead of hardcoding secrets in the APK.

How it was found

  1. Capture login traffic with a proxy to see encrypted uName and uPassword fields.
  2. Decompile the APK with JADX and search for crypto-related terms and field names.
  3. Locate the encryption class and note how the key and IV are derived from a resource ID.
  4. Resolve the resource ID to the actual string in strings.xml.
  5. Derive the key and IV from that string.
  6. Normalize the captured string and decrypt it with AES.

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 scrambled your username and password before sending them, but it used a secret key that was stored inside the app itself. Anyone who downloads the app can find that key and unscramble the data, so the protection is useless.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by gowthami09027

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.