M 412: Reversing FlareBear (15 pts)

What You Need for This Project


To practice reading decompiled Java code and deducing how to win a game.

This challenge came from the FLARE-ON 2019 Challenges.

Installing jadx-gui

If you don't already have it, install jadx-gui on your host system as explained below.

You can use Windows or MacOS to run Jadx. Choose one of them and follow the instructions below.

Using 64-Bit Windows

Copy the in.gov.uidai.mAadhaarPlus_2018-09-26.apk file into your Windows machine.

Installing Java

First open Control Panal and uninstall all old Java versions.

Then open a Web browser and go here:


Download "Windows Offline (64-bit)" version and install it. as shown below.

Installing Jadx on Windows

Go here:


Download jadx-gui, as shown below.

Launch Jadx.

Using a Mac

In a Terminal, execute these commands:
brew install jadx

Install FlareBear

Download this APK:


Install it on your Android device and run it.

Click the "NEW FlARE BEAR" button, give your bear a name, and click the "LET'S GO" button.

You see a bear, as shown below.

There are three buttons you can use to feed, play, or clean the bear.

Click the buttons. The bear's state changes.

The goal of the game is to get the bear into a special state, which will display the flag.

Reading Java

Open the APK in jadx-gui.

Navigate to the danceWithFlag method, as shown below.

This method extracts data from two resources named R.raw.ecstatic and R.raw.ecstatic2 and decrypts them using a password from the getPassword method. That's the flag we want.

Just above the danceWithFlag method, examine the setMood method, as shown below.

To run the danceWithFlag method, two conditions must be true: isHappy and isEcstatic.

Examine the isEcstatic method.

As shown below, this condition requires these values:

These three values all start at zero. To see what the three buttons do, examine these methods:

Figure out how many times to perform each action to reach the Ecstatic state.

Flag M 412.1: Ecstatic (20 pts)

When you win the game, the flag appears, covered by a green rectangle in the image below.

Posted 4-7-21
jadx-gui installation added 6-22-23