Contentful Access Token Disclosure in Android APK
A Contentful access token and space identifier were hardcoded in the Android APK's BuildConfig file. An attacker could use the token to query Contentful's API and retrieve the application's stored content.
Hello, My name is Ali, a Penetration Tester and a Certified Ethical Hacker. It’s my first write-up of 2022 on Android APK Pen testing.
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 Contentful access token was embedded in the app's build configuration instead of being kept server-side or protected.
Impact
An attacker could retrieve the application's content stored on Contentful, as the token granted access.
What the attacker needed
Download the APK; Static analysis tools
How it was found
- Download the Android APK.
- Perform static analysis by reviewing the code.
- Locate the BuildConfig file in the APK.
- Find the CONTENTFUL_ACCESS_TOKEN and CONTENTFUL_SPACE keys.
- Read Contentful documentation to learn how to authenticate.
- Use the token as a query parameter in a curl request to retrieve content.
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.
When developers build an app, they sometimes leave secret passwords or keys inside the app's code. Anyone who downloads the app can open it up and read those secrets. Here, a key for a content service was left in the app, so anyone could use it to read the app's content.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.