Google CTF 2018 - Shall We Play a Game?

Google CTF 2018 - Vamos Jogar um Jogo?

Aprenda hacking AWS do zero ao herói com htARTE (HackTricks AWS Red Team Expert)!

Outras maneiras de apoiar o HackTricks:

Baixe o APK aqui:

Vou fazer upload do APK para https://appetize.io/ (conta gratuita) para ver como o apk está se comportando:

Parece que você precisa ganhar 1000000 vezes para obter a flag.

Seguindo os passos do pentesting Android você pode descompilar o aplicativo para obter o código smali e ler o código Java usando o jadx.

Lendo o código java:

Parece que a função que vai imprimir a flag é m().

Alterações no Smali

Chamando m() pela primeira vez

Vamos fazer o aplicativo chamar m() se a variável this.o != 1000000 para fazer isso, basta mudar a condição:

if-ne v0, v9, :cond_2

Google CTF 2018: Shall we play a game?


Introduction

Welcome to the Google CTF 2018 competition! In this challenge, we will be looking at an Android application called "Shall we play a game?". This app presents us with a simple game where we need to guess a number between 0 and 20. Let's dive into the app and see if we can find any security vulnerabilities.

Reconnaissance

APK Analysis

First, we need to extract the APK file from the Android application. We can do this by using tools like JADX or APKTool. Once we have the APK file, we can start analyzing the app's code and resources.

Static Analysis

Next, we perform static analysis on the APK file to identify any potential security issues. We can look for hardcoded secrets, insecure storage of sensitive data, or any other vulnerabilities that may exist in the code.

Dynamic Analysis

After static analysis, we move on to dynamic analysis by running the application in an emulator or on a physical device. This allows us to interact with the app and observe its behavior at runtime. We can look for any unexpected behavior or security weaknesses that may not be apparent from static analysis alone.

Exploitation

Once we have identified a security vulnerability, we can proceed with exploiting it to gain unauthorized access or control over the application. This may involve bypassing authentication mechanisms, manipulating input data, or exploiting insecure communication channels.

Conclusion

In this challenge, we explored the "Shall we play a game?" Android application from the Google CTF 2018 competition. By conducting reconnaissance, static analysis, dynamic analysis, and exploitation, we were able to uncover security vulnerabilities and demonstrate the importance of thorough security testing in mobile applications.

if-eq v0, v9, :cond_2

Siga os passos do pentest Android para recompilar e assinar o APK. Em seguida, faça o upload para https://appetize.io/ e veja o que acontece:

Parece que a flag está escrita sem estar completamente descriptografada. Provavelmente a função m() deve ser chamada 1000000 vezes.

Outra maneira de fazer isso é não alterar a instrução, mas mudar as instruções comparadas:

Uma outra maneira é, em vez de comparar com 1000000, definir o valor como 1 para que this.o seja comparado com 1:

Uma quarta maneira é adicionar uma instrução para mover o valor de v9 (1000000) para v0 (this.o):

Solução

Faça o aplicativo executar o loop 100000 vezes quando você vencer pela primeira vez. Para fazer isso, você só precisa criar o loop :goto_6 e fazer o aplicativo pular para lá se this.o não tiver o valor 100000:

Você precisa fazer isso em um dispositivo físico, pois (não sei por que) isso não funciona em um dispositivo emulado.

Aprenda hacking AWS do zero ao avançado com htARTE (HackTricks AWS Red Team Expert)!

Outras maneiras de apoiar o HackTricks:

Last updated