Challenges
Smali: reverse engineering the password
Mobile
Medium
Smali pseudo-code
Solves: 8
Smali: reverse engineering the password
Author: CyberSamSU
Points
40
Smali is a language that translates Android's Dalvik/ART bytecode into a readable text format; extracted from the APK using apktool. Here is a simplified smali-style pseudo-code — it compares the entered password (p1) with an internal array.
.method private checkPassword(Ljava/lang/String;)Z
.locals 6
const/16 v0, 0x25 # kutilgan uzunlik (37)
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v1
if-ne v1, v0, :fail
const/16 v2, 0x9a # XOR kaliti (154)
const/4 v3, 0x0 # i = 0
:loop
if-ge v3, v0, :ok
invoke-virtual {p1, v3}, Ljava/lang/String;->charAt(I)C
move-result v4
xor-int/2addr v4, v2
aget v5, expected, v3 # kutilgan[i] massividan
if-ne v4, v5, :fail
add-int/lit8 v3, v3, 1
goto :loop
:fail
const/4 v0, 0x0
return v0
:ok
const/4 v0, 0x1
return v0
.end method
The expected array used for comparison:
216, 219, 195, 200, 213, 203, 225, 215, 170, 216, 197, 201, 215,
219, 214, 211, 197, 194, 213, 200, 197, 202, 219, 200, 213, 214,
211, 212, 211, 197, 206, 213, 202, 222, 211, 215, 231
Read the code and find out what password must be entered for checkPassword to return true — this is the flag itself.
Theory: learn the topic
To submit a flag, log in.