Skip to content
Access control Write-up Beginner

How I Found My First Bug in Android App

An exported Android activity that handled redirection could be launched by any other app, bypassing the app's PIN lock and biometric authentication. An attacker could therefore open the TOTP secret display without knowing the PIN or passing biometric checks.

Barath Stalin Follow

Published on medium.com

I used an app for 2FA to get TOTP. Little curious about the applock function so I decompiled the app using JADX-GUI(a tool to decompile the apk) and saw the Androidmanifest.xml file to get the details of the app. [com.demo.app.HandleRedirectionActivity] is exported=true(means any app can call this activity ) so read…

Barath Stalin, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

This is a short account of a first Android bug, found in a two-factor authentication (2FA) app that generates TOTP codes. The app has an app lock feature, described in the report as an applock function, which is meant to gate access to the TOTP activity behind a password and biometrics. The researcher's interest was in whether that lock could be walked around.

The weakness class is an authentication bypass through an exported activity and an insecure intent: the lock is enforced on one screen, but another exported activity can be launched directly and leads into the protected screen without the lock ever being checked.

Setup

The researcher came to this from web application testing, done while learning online during the COVID-19 period, and moved into Android after becoming curious about app development. The tools used were:

  • JADX-GUI, described in the report as a tool to decompile the APK.
  • ADB, for launching activities from a shell.
  • Android Studio, for building a small proof-of-concept app.

Finding it

The researcher was using the app for 2FA to get TOTP codes and became curious about the applock function. Decompiling the APK with JADX-GUI and reading AndroidManifest.xml gave the exported components. One activity stood out:

Text
com.demo.app.HandleRedirectionActivity

It is declared exported=true, which means any app on the device can call this activity. Reading its code showed nothing of interest on its own: it is just a redirection handler activity.

The important part came from reading the app lock code, com.demo.app.PinLock. While analysing it, the researcher found that it does not validate the activity call. In other words, the lock screen does not validate the activity call.

Exploitation

Step 1: call the exported activity directly with ADB

With the exported activity identified, the researcher launched it straight from a shell:

Bash
$ adb shell am start -n com.demo.app/.HandleRedirectionActivity

am start -n starts a named component, here the exported HandleRedirectionActivity in the com.demo.app package. The result, in the researcher's words, was that the app lock activity does not authenticate the redirection handler activity.

Step 2: build a proof of concept without ADB

Most VDP programs do not allow the use of ADB, so the researcher reproduced the same call from an ordinary Android app built in Android Studio:

Text
intent intent = new Intent();

intent.setClassName(“com.demo.app”, “com.demo.app.HandleRedirectionActivity”);

startActivity(intent);

This creates an explicit intent aimed at the target package and class with setClassName, then fires it with startActivity. When the attacker app is opened, it bypassed the biometric entry into the TOTP activity. That is the whole exploit: no password, no biometric prompt, just a component launch.

Root cause

The design puts the lock on the PinLock screen but leaves HandleRedirectionActivity exported. Because PinLock does not validate the activity call, nothing checks that the flow arrived through the lock. The exported flag makes the redirection handler reachable by any app on the device, and the lock does not validate the activity call.

Impact

On a device where the attacker can get an app installed and opened, the app lock and biometric entry can be bypassed and the TOTP activity reached without authentication. The report frames this as low-hanging fruit: a simple issue in an Android app rather than a deep chain. The practical exposure depends on the attacker already having code running on, or the ability to install an app on, the victim's device.

Fix

The report does not describe a fix or a vendor response.

Variants to test

  1. Enumerate exported activities. Decompile the APK, read AndroidManifest.xml, and list every component with exported=true. A positive result is an exported activity that lands on a screen which should sit behind a login, PIN or biometric prompt.
  2. Launch each exported activity with ADB. Use adb shell am start -n <package>/.<Activity> for each candidate. A positive result is a protected screen appearing without any authentication prompt.
  3. Reproduce from a second app. Build a minimal app that fires an explicit intent with setClassName at the candidate component, as above. A positive result is the same bypass without ADB, which is what most VDP rules require.
  4. Check the lock for caller validation. Read the lock activity's code and look for any check on the calling component or intent.
  5. Try other entry points into the same flow. Where a redirection or deep-link handler exists, test whether it can be aimed at protected screens.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A security researcher found a way to get past the password and fingerprint lock on an Android app that generates one-time login codes. The app is a two-factor authentication (2FA) app: you use it to get a short code that proves it is really you when you log in somewhere. The app has a lock screen that asks for a PIN or fingerprint.

The researcher found that the lock only guards one screen. A second screen in the same app, a small piece of code whose only job is to send you to another screen, can be opened directly by any other app on the phone. That second screen can be opened directly by any other app on the phone. So a malicious app, once installed and opened, can jump over the lock and show the codes.

This is called an authentication bypass: the check that is supposed to prove who you are gets skipped. The specific mechanism is an exported activity reached through an insecure intent. Both of those terms are explained below.

The background

The researcher learned web application testing online during the COVID-19 period. Web application testing means poking at websites to see whether they behave badly when given unexpected input. They tested several web apps, but any bugs they reported were either informational or duplicates, meaning someone else had already reported the same thing.

Curiosity about how Android apps are built led them to learn app development. Knowing how apps are put together made it easier to spot security issues in them. The researcher calls these low-hanging fruit: problems that are easy to reach, like fruit on a branch low enough to pick without a ladder.

The tools

Three tools were used, and each one needs a short explanation if you have never done this before.

  • JADX-GUI: a program that takes an Android app file (an APK) and turns it back into readable code. An APK is the file you download and install, a bit like a zip file full of compiled code. Compiling turns human-readable code into something the phone can run; decompiling is the reverse, and JADX-GUI does that so a person can read it.
  • ADB: the Android Debug Bridge. It is a command-line tool that lets a computer talk to an Android phone or emulator, for example to start a screen inside an app. Think of it as a remote control for the phone that developers use while building apps.
  • Android Studio: the official program for building Android apps. It was used here to build a small attacker app as a proof of concept, meaning a demonstration that the problem is real and not just theoretical.

Step 1: looking inside the app

The researcher was already using the app to get TOTP codes. TOTP stands for Time-based One-Time Password: a code that changes every 30 seconds or so, generated from a shared secret, and used as the second factor when you log in. The app also had an applock function, a lock screen in front of the codes. Curiosity about how that lock worked started the investigation.

The first move was to decompile the APK with JADX-GUI and read a file called AndroidManifest.xml. The manifest is the app's identity card: it lists the app's parts and says which of them other apps are allowed to talk to. Reading it is the natural first step because it tells you the app's attack surface, the set of entry points an outsider can reach.

One entry stood out:

Text
com.demo.app.HandleRedirectionActivity

An activity is one screen of an Android app, with its own code behind it. The name here follows the usual Android pattern: com.demo.app is the package, the app's unique identifier on the phone, and HandleRedirectionActivity is the screen's name. The manifest declared it exported=true. Exported means any app on the device is allowed to call this activity. A non-exported activity can only be started from inside its own app.

Reading the code of that activity showed nothing interesting on its own: it is just a redirection handler, a screen whose only job is to forward the user to another screen.

The important discovery came from reading the code of the app lock, com.demo.app.PinLock. While analysing it, the researcher found that it does not validate the activity call. In plain words, the lock screen never checks who started it or how the user arrived. It does not ask whether the user came through the normal flow that should have required a PIN or fingerprint first.

Step 2: opening the screen directly with ADB

With an exported activity identified, the researcher launched it straight from a shell, a text command line on the computer:

Bash
$ adb shell am start -n com.demo.app/.HandleRedirectionActivity

Line by line:

  • adb shell opens a command shell on the connected phone through the Android Debug Bridge.
  • am is the Activity Manager, the part of Android that starts and manages screens.
  • start tells it to start something.
  • -n means the component is named explicitly, so Android should not guess which screen you mean.
  • com.demo.app/.HandleRedirectionActivity is that name: the package com.demo.app, a slash, and the activity. The leading dot is shorthand for the same package, so this is the same com.demo.app.HandleRedirectionActivity seen in the manifest.

The result, in the researcher's words, was that the app lock activity does not authenticate the redirection handler activity. The app lock activity does not authenticate the redirection handler activity.

Step 3: proving it without ADB

Most VDP programs do not allow the use of ADB. A VDP is a vulnerability disclosure program: an organisation invites people to report security problems, and sets rules for how testing may be done. Allowing ADB would mean letting testers reach deep into devices in ways that are hard to control, so it is commonly off limits.

To stay within those rules, the researcher rebuilt the same call inside an ordinary Android app made in Android Studio:

Text
intent intent = new Intent();

intent.setClassName(“com.demo.app”, “com.demo.app.HandleRedirectionActivity”);

startActivity(intent);

Line by line:

  • intent intent = new Intent(); creates an intent. An intent is Android's message object: it is how one part of Android asks another part to do something, most often to open a screen. Think of it as an envelope with a delivery address written on it.
  • intent.setClassName(...) writes the address on the envelope. It names the target package com.demo.app and the target class com.demo.app.HandleRedirectionActivity, so the intent is explicit: it says exactly which screen to open, rather than describing what kind of thing is wanted and letting Android choose.
  • startActivity(intent); posts the envelope. Android delivers it, and the named screen opens.

The result: when the attacker app is opened, it bypassed the biometric entry into the TOTP activity. Biometrics here means the fingerprint check. No password was typed, no fingerprint was scanned, and the codes were reachable. That is the whole exploit: a component launch, nothing more.

Why it works

The design puts the lock on the PinLock screen, but leaves HandleRedirectionActivity exported. Because PinLock does not validate the activity call, nothing checks that the user arrived through the lock. The exported flag makes the redirection handler reachable by any app on the phone, and the lock does not validate the activity call.

A useful comparison is a building with a reception desk. Visitors are supposed to sign in at the desk before going upstairs. But there is a side door marked for deliveries that opens straight onto the staircase, and nobody at the desk checks how anyone got in. The lock exists, it just is not on the path that was taken.

What the impact is

On a phone where an attacker can get an app installed and opened, the app lock and the biometric entry can be bypassed, and the TOTP screen can be reached without authentication. The researcher frames this as low-hanging fruit: a simple issue in an Android app rather than a deep chain of exploits.

The practical exposure depends on the attacker already having code running on the victim's device, or being able to install an app on it. That is a real precondition, not a small one, but it is also common: people install apps all the time, and a malicious app that looks harmless is enough.

How to fix it

The report does not describe a fix or a vendor response.

In the building comparison: take the side door off the street, and have the reception desk check that every visitor actually signed in, no matter which door they came through.

Other things to try

These are the same checks generalised, so they can be applied to other apps.

  1. List the exported activities. Decompile the APK, read AndroidManifest.xml, and write down every component marked exported=true. You are looking for an exported activity that lands on a screen which should sit behind a login, PIN or biometric prompt.
  2. Launch each exported activity with ADB. Use adb shell am start -n <package>/.<Activity> for each candidate. You have a finding if a protected screen appears without any authentication prompt.
  3. Reproduce it from a second app. Build a minimal app that fires an explicit intent with setClassName at the candidate component, as above. You have a finding if the same bypass works without ADB, which is what most VDP rules require.
  4. Check the lock for caller validation. Read the lock activity's code and look for any check on the calling component or the intent.
  5. Try other entry points into the same flow. Where a redirection or deep-link handler exists, test whether it can be aimed at protected screens. A deep link is a link that opens a specific place inside an app, like a web link but for apps.

Glossary

  • 2FA (two-factor authentication): logging in with two different proofs of identity, usually a password plus a code or fingerprint.
  • Activity: one screen of an Android app, with its own code behind it.
  • ADB (Android Debug Bridge): a command-line tool that lets a computer control an Android phone or emulator, including starting screens inside apps.
  • APK: the installable file of an Android app, containing its compiled code and resources.
  • Applock: a lock screen inside an app that asks for a PIN or fingerprint before letting you in.
  • Authentication bypass: getting past a check that is supposed to prove who you are, without providing the proof.
  • Biometrics: using a physical characteristic, such as a fingerprint, to prove identity.
  • Component: a part of an Android app that Android can start, such as an activity.
  • Decompile: turn compiled code back into readable source code.
  • Deep link: a link that opens a specific place inside an app rather than a website.
  • Explicit intent: an intent that names exactly which component it wants to open.
  • Exported: a setting that allows other apps on the device to call a component.
  • Intent: Android's message object used to ask another part of Android to do something, most often to open a screen.
  • JADX-GUI: a program that decompiles Android APKs so their code can be read.
  • Low-hanging fruit: an easy-to-reach problem, like fruit on a low branch.
  • Manifest (AndroidManifest.xml): the file that lists an app's components and which of them other apps may call.
  • Package: the unique identifier of an app on a phone, such as com.demo.app.
  • PIN: a short numeric password.
  • Proof of concept (POC): a small demonstration that a problem is real, not just theoretical.
  • Redirection handler: a screen whose only job is to forward the user to another screen.
  • TOTP (Time-based One-Time Password): a login code that changes every 30 seconds or so, generated from a shared secret.
  • VDP (vulnerability disclosure program): an invitation from an organisation to report security problems, with rules for how testing may be done.
  • Vulnerability: a weakness in software that someone could abuse.
  • Web application testing: poking at websites to see whether they behave badly when given unexpected input.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store From the original on medium.com
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

More by Barath Stalin

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.