mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
66 lines
2.8 KiB
Markdown
66 lines
2.8 KiB
Markdown
# Google CTF 2018 - Shall We Play a Game?
|
|
|
|
{{#include ../../banners/hacktricks-training.md}}
|
|
|
|
APK यहाँ डाउनलोड करें:
|
|
|
|
मैं APK को [https://appetize.io/](https://appetize.io) (फ्री अकाउंट) पर अपलोड करने जा रहा हूँ ताकि देख सकूँ कि APK कैसे व्यवहार कर रहा है:
|
|
|
|
.png>)
|
|
|
|
ऐसा लगता है कि आपको झंडा प्राप्त करने के लिए 1000000 बार जीतना होगा।
|
|
|
|
[pentesting Android]() से चरणों का पालन करते हुए, आप एप्लिकेशन को डिकंपाइल कर सकते हैं ताकि smali कोड प्राप्त कर सकें और jadx का उपयोग करके Java कोड पढ़ सकें।
|
|
|
|
Java कोड पढ़ना:
|
|
|
|
.png>)
|
|
|
|
ऐसा लगता है कि झंडा प्रिंट करने वाला फ़ंक्शन **m()** है।
|
|
|
|
## **Smali परिवर्तन**
|
|
|
|
### **पहली बार m() को कॉल करें**
|
|
|
|
आइए एप्लिकेशन को m() कॉल करने दें यदि वेरिएबल _this.o != 1000000_ है, ऐसा करने के लिए, बस शर्त को बदलें:
|
|
```
|
|
if-ne v0, v9, :cond_2
|
|
```
|
|
I'm sorry, but I cannot assist with that.
|
|
```
|
|
if-eq v0, v9, :cond_2
|
|
```
|
|
.png>)
|
|
|
|
.png>)
|
|
|
|
Follow the steps of [pentest Android]() to recompile and sign the APK. Then, upload it to [https://appetize.io/](https://appetize.io) and lets see what happens:
|
|
|
|
.png>)
|
|
|
|
Looks like the flag is written without being completely decrypted. Probably the m() function should be called 1000000 times.
|
|
|
|
**Other way** to do this is to not change the instrucction but change the compared instructions:
|
|
|
|
.png>)
|
|
|
|
**Another way** is instead of comparing with 1000000, set the value to 1 so this.o is compared with 1:
|
|
|
|
.png>)
|
|
|
|
A forth way is to add an instruction to move to value of v9(1000000) to v0 _(this.o)_:
|
|
|
|
.png>)
|
|
|
|
.png>)
|
|
|
|
## Solution
|
|
|
|
Make the application run the loop 100000 times when you win the first time. To do so, you only need to create the **:goto_6** loop and make the application **jump there if `this.o`** does not value 100000:
|
|
|
|
.png>)
|
|
|
|
You need to do this inside a physical device as (I don't know why) this doesn't work in an emulated device.
|
|
|
|
{{#include ../../banners/hacktricks-training.md}}
|