Skip to content
Leaked secrets Write-up Intermediate

How My First Android Pentest Led To An Exposed Aws Secret Key And How I Verified It

An Android app built with React Native contained a hardcoded AWS secret access key in its JavaScript bundle, which was compiled to Hermes bytecode. An attacker who extracted the APK could decompile the bundle and obtain the key, potentially gaining unauthorised access to the client's cloud infrastructure.

Andrew Keitany Follow

Published on infosecwriteups.com

We often find our greatest challenges — and lessons — in the most unexpected places. For me, it was during a casual, personal engagement with a client.

Andrew Keitany, on infosecwriteups.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 developers hardcoded an AWS secret access key directly into the React Native JavaScript bundle instead of storing it securely on a backend.

Impact

The exposed key could have allowed unauthorised access to the client's cloud infrastructure, potentially leading to data breaches, financial loss, and reputational damage.

What the attacker needed

Access to the APK file

How it was found

  1. Disassemble the APK using apktool.
  2. Locate the index.android.bundle file in the assets folder.
  3. Identify that the bundle is Hermes bytecode.
  4. Decompile the Hermes bytecode to pseudo-JavaScript using hermes-dec.
  5. Search the decompiled JavaScript for secretAccessKey using grep.
  6. Confirm the exposed AWS secret access key.

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.

Mobile apps sometimes store secret keys inside the app itself. If someone downloads the app, they can unpack it and read those secrets. Here, a cloud access key was left in the app's code, so anyone with the app could find it and use it to access the cloud account.

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.