Reverse Engineering API Security: How I Broke and bypass “Reque
The Android app hardcoded an HMAC-SHA256 secret key used to sign API requests, and the author extracted it by decompiling the APK. This allowed generating valid request hashes for arbitrary API calls, bypassing the request validation mechanism.
Published on medium.com
This security research exposes a critical flaw in mobile API authentication where hardcoded HMAC-SHA256 keys in Android APKs allow complete bypass of request validation. Through reverse engineering, I extracted the secret key and demonstrated how to generate valid signatures for any API request, effectively breaking…
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 secret key used for HMAC request signing was embedded in the client application, so it could be extracted and used to forge signatures.
Impact
An attacker could generate valid request hashes for any API call, bypassing the request validation and potentially accessing or modifying data as any user with a token.
What the attacker needed
Access to the Android APK; a valid authentication token; ability to intercept network traffic
The fix
The secret key should not be embedded in the client; instead, use a secure key exchange or per-client keys that can be rotated.
How it was found
- Intercept the app's network traffic with a proxy and observe the Request-Hash, Request-Ts, and Authorization headers.
- Test that changing the timestamp, body, or hash causes rejection, confirming the hash covers those values.
- Decompile the APK with JADX and search for the string 'Request-Hash'.
- Locate the RequestHasher class and extract the hardcoded secret key and algorithm.
- Read the generateHash() function to learn the message format and HMAC-SHA256 usage.
- Write a script to generate a matching hash and verify it against the live API.
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 tried to prove each request came from its own client by attaching a special code (a hash) made with a secret key. But that key was stored inside the app itself, so anyone who unpacked the app could find it and make their own valid codes. This means the protection did not stop outsiders from calling the API.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.