Makeshift - Cyber Apocalypse 2024: Hacker Royale CTF Writeup

Makeshift - Cyber Apocalypse 2024: Hacker Royale CTF Writeup

In the midst of the Cyber Apocalypse 2024: Hacker Royale CTF hosted by HackTheBox, participants faced the grueling challenge of “crypto_makeshift.” Struggling to survive in a barren landscape, scavengers hunted for a weapon to fend off hunger and potential adversaries. Let’s delve into the tactics and triumphs of decrypting “crypto_makeshift.”

Challenge Description:

In the desolate wilderness, resources were scarce, and survival hinged on ingenuity. Participants stumbled upon a long stick protruding from the undergrowth, recognizing its potential as a weapon. However, the stick required sharpening to become truly effective. Amidst the struggle for survival, this makeshift weapon held the promise of salvation.

The Hunt Begins:

To unlock the hidden message and secure their victory, participants were provided with a Python script named source.py and an output file output.txt. The script revealed a peculiar encryption process applied to the flag stored in the FLAG variable.

from secret import FLAG

flag = FLAG[::-1]
new_flag = ''

for i in range(0, len(flag), 3):
    new_flag += flag[i+1]
    new_flag += flag[i+2]
    new_flag += flag[i]

print(new_flag)

The output file output.txt contained the encrypted message, challenging participants to decrypt it and unveil the true flag.

!?}De!e3d_5n_nipaOw_3eTR3bt4{_THB

Sharpening the Weapon:

To decipher the encrypted message and retrieve the flag, participants needed to reverse engineer the encryption process. By understanding the swapping mechanism in the script, they could decrypt the ciphertext.

new_flag = '!?}De!e3d_5n_nipaOw_3eTR3bt4{_THB'
reversed_flag = ''

# Reverse the swapping process
for i in range(0, len(new_flag), 3):
    reversed_flag += new_flag[i+2]
    reversed_flag += new_flag[i]
    reversed_flag += new_flag[i+1]

# Reverse the reversed FLAG to get the original FLAG
original_flag = reversed_flag[::-1]

print(original_flag)

Claiming Victory:

With the decryption script in hand, participants decoded the encrypted message to reveal the flag, marking their triumphant escape from the brink of defeat.

HTB{4_b3tTeR_w3apOn_i5_n3edeD!?!}

Conclusion:

The “crypto_makeshift” challenge epitomized the resourcefulness and determination required to survive in the Cyber Apocalypse. Participants overcame the adversity of the barren landscape and unlocked the secrets hidden within the encrypted message, emerging victorious in their quest for survival.

As the Cyber Apocalypse 2024: Hacker Royale continued, participants braced themselves for further trials, armed with the lessons learned and the camaraderie forged in the heat of battle.

Stay tuned for more thrilling CTF adventures!

Comments