You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's take a look what is necessary to get to `puts("You are winner!");` address. We see that we need to pass this test where _ebp + 0x1c_ must be equals to _0x19_.
0x080486f8 68ab880408 push str.You_are_winner ; 0x80488ab ; "You are winner!"
107
+
0x080486fd e86efdffff call sym.imp.puts ; int puts(const char *s)
108
+
```
109
+
110
+
Looking around the assembly, we can see that there is an instruction that adds _1_ to _ebp + 0x1c_.
111
+
112
+
```asm
113
+
0x080486eb 8345e401 add dword [local_1ch], 1
114
+
```
115
+
116
+
We also notice that there is a loop at the bottom of the assembly.
117
+
118
+
```asm
119
+
; CODE XREF from sym.do_magic (0x80486f3)
120
+
0x08048707 8345e801 add dword [local_18h], 1
121
+
; CODE XREF from sym.do_magic (0x80486bb)
122
+
0x0804870b 8b45e8 mov eax, dword [local_18h]
123
+
0x0804870e 3b45f0 cmp eax, dword [local_10h]
124
+
0x08048711 7caa jl 0x80486bd
125
+
```
126
+
127
+
Debugging the program, we can see that the number of loops it does corresponds to the number of characters inputted.
128
+
129
+
We also see that there's an XOR function, where _eax_ is the characters you put in and _ecx_ are the characters provided by the binary.
130
+
131
+
```asm
132
+
0x080486d3 31c8 xor eax, ecx
133
+
```
134
+
135
+
Putting everything together, it is trying to loop through every character in the input, xor it with the characters in the binary make sure it equates to the initial message. The initial message is: _You have now entered the Duck Web, and you're in for a honkin' good time._
136
+
137
+
Writing some pseudo code, it will look something like this
138
+
139
+
```
140
+
count = 0
141
+
for (i = 0; i < length_of_user_input; i++) {
142
+
data = user_input[i] xor binary_data[i]
143
+
if (data == initial_message[i]) {
144
+
count += 1
145
+
}
146
+
if (count == 25) {
147
+
print "You are winner!"
148
+
}
149
+
}
150
+
```
151
+
152
+
Let's leak the values of the binary string. We see that the string is located in here
153
+
154
+
```asm
155
+
0x080486c0 0558880408 add eax, obj.sekrutBuffer
156
+
```
157
+
Get the value from the address
158
+
159
+
```asm
160
+
[0x08048642]> px @ obj.sekrutBuffer
161
+
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0 commit comments