2024 Cyber Apocalypse: Makeshift
Challenge Information
| Attribute | Details |
|---|---|
| Event | 2024 Cyber Apocalypse |
| Category | Crypto |
| Challenge | Makeshift |
| Difficulty | Easy |
Summary
Makeshift implements a simple string transformation that reverses the flag and then rearranges characters in groups of three using the pattern ABC → BCA. The challenge is trivial to reverse by applying the inverse transformations.
Analysis
The encryption process:
- Reverse the flag: FLAG[::-1]
- Rearrange in triplets: Every sequence of characters ABC is changed to BCA
- Position 0 → Position 2
- Position 1 → Position 0
- Position 2 → Position 1
Encrypted output: !?}De!e3d_5n_nipaOw_3eTR3bt4{_THB
Solution
Decryption Algorithm
To reverse the process:
enc_flag = r'!?}De!e3d_5n_nipaOw_3eTR3bt4{_THB'
# Step 1: Reverse the triplet rearrangement# BCA pattern means: position 0←1, position 1←2, position 2←0# To reverse: position 0→2, position 1→0, position 2→1new_flag = ''
for i in range(0, len(enc_flag), 3): # BCA → ABC means: take second, take third, take first new_flag += enc_flag[i+2] # Position 2 of BCA → Position 0 of ABC new_flag += enc_flag[i] # Position 0 of BCA → Position 1 of ABC new_flag += enc_flag[i+1] # Position 1 of BCA → Position 2 of ABC
# Step 2: Reverse the stringflag = new_flag[::-1]
print(flag)# HTB{4_w0nd3rfully_d33p_3ncrypt10n_for_d3tection!}Walkthrough
- Encrypted:
!?}De!e3d_5n_nipaOw_3eTR3bt4{_THB - After reversing triplets: Groups rearranged from BCA back to ABC
- After reversing string: Full flag revealed
Key Takeaways
- Simple string manipulations are easily reversible
- Multiple transformations (reverse + rearrange) still provide no cryptographic security
- The transformation is deterministic and lacks any key material
- Security through obfuscation fails when the algorithm is known