HackVent 2023 - [HV23.H3] Santa's Secret

Posted on Jan 1, 2024

Difficulty: Hard

Category: Fun

Not once, not twice, but three times Santa has hidden something in one of his gifts now!? Unbelievable…

The flag is hidden in the [HV23.20] challenge. There is a productName and productType enum for the keys. If we manage to generate a key of name CandyCaneMachine2000 and type Premium, we get the hidden flag on activation instead.

I’ve added a check to the original solution script to continue generating until such a key is found:

public static void Main() {
    while (true) {
        // generate random key
        String productKey = RandomProductKey();
        // decode product key
        CandyCaneLicense candyCane = CandyCaneLicense.Create(productKey);
        if (candyCane != null) {
            Console.WriteLine(productKey);
            Console.WriteLine("Product key is valid");
            Console.WriteLine("Expiration date: " + candyCane.ExpirationDate.ToString());
            if (candyCane.ProductName == ProductLicense.ProductNames.CandyCaneMachine2000 &&
                candyCane.ProductType == ProductLicense.ProductTypes.Premium) {
                Console.WriteLine("Found super secret key :O");
                break;
            }
        }
    }

}

The flag is: HV23{sup3r-h1dd3n-k3yg3n-fl4g}