Challenge Description

HNF26 13

The challenge provided an encoded text block along with a short hint:

Description

i do a rotate and some 2

Ciphertext:

Iz0jq2DlHKyIJTkJI0q4JSyHEaqIEycmJxMBJSWfoQAKn2Z1IwSXp2WRGyuuZx0kIwOnLJEUIxIEoHMGIwWbrIMgrSMyEyy5ITgJHzWTJyuMn2uQIIMnqTASMScJZQR1IGW0I1MKFxuuEmyIIz1bESMJJzSxE1MUI214H2WUqmSJIRbjIwSnJSAenSMvn0cLJIETLJSTIKuKoHMdIzgnZSIgrUqJZQSJL0IjI2WHEKqMIRcUIwSBqIEfnTyFZzubI1MFF2VkFxqKoTELLyInpIMgpmSyEycLMHuxI01REyqMZSM3IwWXIIWLMScyn3OVJKcTG2EJIaAKoJkbGHuPJyLkJyAFZJkLHzgxI1qUnSyMoSMuL1MfpyqgEzkJoxWUIwW4G1MKFxqwEycKLyuFryMdFxgJIxMMLHMxnTRmDxyKJUOUIQWFI1MhGyuvI3uHISpko1qTJaEAIRWKGJkTAIMKrTguoRc0LHuBIzSeFzuMZIcmL21TEyEfGzyFoxWnI2kJLIDkJyuGoScdHyqFLIEIJzSyoSy3I21TH2WSAKcMIIceLHqSrTAVoSqJEHcbIxEXG2ETFaWnEzucIwAbIIMTL3uvZyWmI25FGyqUHyMHI3EmGyMJqTEUqTuJnmIUIwW4H1qgFxqKoJunGIMjnScSMSAGIaOVMHqfH2WLL3uJn1cuIGSSrSqfnSEvEaOkIJkxo1yJHyMKoHMfLxMjrSHlqTSvEycmH2kjJyMJpUWMIJETMHqBFJWTMSqFIKOiIzgFF1DlHxqGoxcbHwWbISyeIaqJIyc0MHp5Hx1KHyuJZJuiJIMXE1AfMSIJoSc6ISETH2ZlExMCI2ucHyuPAyqHDzSwZJE0H2gbnSWfFzSHIyc3MJkerJIUqTgJoxWUITknG2SJFaECIR5KLGSjnSydFxMyEzEmLHMFnR1fFaqJI3EuHmSMrSIfnR9JrzkCISMnq2ITIaEAIJEIGJgjE1xjJaqKE0I4L0uXJyMKHxqnI3uUL21XE1cTMSAJJRW2IzcTLJRkIKuKJTuILzknIyyeJxgwEyMkHzg0I1MfpRuJI3EYLGNkEIWfGyMFoRLmIHMSBIOECG0=

The title “13” and the phrase “i do a rotate and some 2^6” pointed directly to the operations needed:

  • “rotate” paired with the title suggested ROT13.
  • , pointing to Base64 encoding.
  • Extending the theme of 13, the payload looked like it had been wrapped in Base64 13 times.

I tested this in CyberChef. An initial ROT13 operation followed by 13 chained From Base64 operations decoded the string completely.

HNF26 13 2

Repeated Base64 layers

Encoding text repeatedly with Base64 makes it about a third larger each time, so the blob shrinks by the same factor as each layer is removed. That is why the final result is only a few bytes long. After ROT13, the text starts with Vm0w, which is the well-known look of text that has been Base64-encoded many times over, so it was a quick sign that more layers were hiding underneath.

The same process can be automated with a short Python script. It reads the ciphertext from cipher.txt:

Python
import base64
import codecs
from pathlib import Path
 
data = Path("cipher.txt").read_text().strip()
 
# Apply ROT13 once
data = codecs.decode(data, "rot_13")
 
# Decode Base64 13 times
for _ in range(13):
    data = base64.b64decode(data).decode("utf-8")
 
print(data)

Running it printed the flag:

Bash
┌──(nepz㉿nepz)-[~]
└─$ python3 solve.py
HNF26{base64_to_the_max}

Flag

HNF26{base64_to_the_max}

Similar

  • 13: the picoCTF challenge of the same name, which is a single ROT13
  • Mod 26: ROT13 on a provided ciphertext string
  • credstuff: ROT13 used to decode a retrieved password