We start by looking at the source code.
After looking at the source code we find the piece that outputs the flag:
response = process_input(input_value)
if response == 'You won!\n':
with open("flag", "r") as flag_file:
flag_content = flag_file.read()
client_socket.send(flag_content.encode())
client_socket.close()
break
We see that
So we need to find a way to make
def process_input(input_value):
num1 = np.array([0], dtype=np.uint64)
num2 = np.array([0], dtype=np.uint64)
num2[0] = 0
a = input_value
if a < 0:
return "Exiting..."
num1[0] = (a + 65)
if (num2[0] - num1[0]) == 1337:
return 'You won!\n'
return 'Try again.\n'
But now we have another problem,
Maybe we can use an integer overflow to make
We will use Python to calculate the integer overflow:
>>> import numpy as np
>>> num1 = np.array([0], dtype=np.uint64)
>>> num1[0] -= 1402
>>> num1[0]
18446744073709550214
Now we will connect to edge.ctf.intigriti.io 1337 and provide