Skip to content
Leaked secrets Write-up Intermediate

How Two Hardcoded Credentials Led To Payment System Takeover, Exp

Hardcoded credentials were found in an Android APK and in the mobile app's payment flow. An attacker could forge JWTs to take over support user accounts and use a leaked payment API key to retrieve credit card data, PII, and issue arbitrary refunds.

Berserker Follow

Published on medium.com

Hardcoded credentials can be easy to find but hard to spot. In this blog, I will write about my methodology for finding and exploiting them.

Berserker, 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, sensitive signing keys and API secrets were embedded in the mobile application and its network traffic instead of being kept server-side.

Impact

An attacker could take over any support user's chat account and use the payment API key to retrieve over 20,000 credit card details with expiry dates and PII, and issue refunds for arbitrary amounts, even exceeding the original payment.

What the attacker needed

Access to the mobile app or APK; ability to intercept app traffic; third-party API documentation

The fix

Hardcoded credentials should be removed from the app and its traffic, and API endpoints should be protected with robust access controls.

How it was found

  1. Download and decompile the APK, then read its constants to find an API key or secret.
  2. Trace the secret key in the source code to learn it signs JWTs.
  3. Create a script that generates a JWT for any user ID.
  4. Intercept the support chat request and replace the JWT to take over any support account.
  5. Intercept every request in the mobile app flow without Advanced Scope to spot third-party headers.
  6. Find a Bearer token starting with sk_ in the payment flow and use it with the third-party API documentation to retrieve credit cards and issue refunds.

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.

Hardcoded credentials are secrets like passwords or API keys written directly into an app's code. If someone extracts them, they can pretend to be the app and access systems the developer intended to keep private. Here, one secret let the researcher create login tokens for support staff, and another let them read payment data and issue refunds.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.