HackVent 2023 - [HV23.H2] Grinch's Secret

Posted on Jan 1, 2024

Difficulty: Medium

Category: Fun

Santa usually only gifts one present per kid, but one of his elves accidentally put two presents in the bag for a single kid! Somewhere in the medium challenges, you can find the second gift.

The flag is hidden in the [HV23.11] challenge. The alternations of “Never gonna give you up.” and “Never gonna let you down.” represent a 0 or 1 respectively.

We can update the solve script to include the hidden flag:

#!/usr/bin/python3
from PIL import Image

input = Image.open('pi.png')
output = ""

for row in range(input.size[0]):
    for col in range(input.size[1]):
        pixel = input.getpixel((row, col))
        output += chr(pixel[2] ^ pixel[0])

#print(output)

bit_0 = "Never gonna give you up"
bit_1 = "Never gonna let you down"
bin_msg = ""
words = output.split(".")
for w in words:
    if bit_0 in w:
        bin_msg += "0"
    elif bit_1 in w:
        bin_msg += "1"

chunks = [bin_msg[i:i+8] for i in range(0, len(bin_msg), 8)]
ascii_string = ''.join([chr(int(chunk, 2)) for chunk in chunks if len(chunk) == 8])
print(ascii_string)

The flag is: HV23{h1dden_r1ckr011}