UnixDroid

Reversing · Hard

Rolling Key Vault

250 points · 0 solves so far

Hard Reversing 250 pts

A "secure" vault program verifies the flag using a repeating XOR key plus a position shift. Reverse the maths to recover the flag.

import sys

DATA = [0, 1, 37, 42, 120, 57, 63, 124, 62, 59, 37, 43, 113, 67, 21, 77, 135, 50, 56, 46, 50, 22, 41, 60]
KEY = b"UDX"

def verify(flag):
    if len(flag) != len(DATA):
        return False
    for i, ch in enumerate(flag):
        x = ord(ch) ^ KEY[i % len(KEY)]
        if (x + i) % 256 != DATA[i]:
            return False
    return True

print("Access granted" if verify(sys.argv[1]) else "Access denied")
Need a hint?

Undo the steps in reverse order: first subtract i (mod 256), then XOR with KEY[i % 3].

Log in or create a free account to submit the flag.
← All challenges & leaderboard