Challenge

On login the server hands back a token that is the user’s record XOR’d with a secret key. The record includes the UID, and UID 0 is the account that can read the flag.

Solution

XOR is positional. Flipping a bit in the ciphertext flips the same bit in the underlying plaintext, with no need to know the key. The UID sits in the second-to-last byte, and you start as UID 1. Flipping the low bit of that ciphertext byte turns the decrypted UID from 1 into 0.

A known-plaintext attack to recover the whole key would also work, but a single bit flip is enough to become UID 0 and get the flag.