Hack The Box solution: xorxorxor

We have the code to encrypt the flag:

The code will generate a random key with the length of 4. Then XOR each byte of the flag with each byte of the key.

We know the flag starts with ‘HTB{‘, and the output is:

134af6e1297bc4a96f6a87fe046684e8047084ee046d84c5282dd7ef292dc9

From the code, we can see that each character will be XOR with each character of the key and the length of the key is 4 characters.

For example: The first charater (H) XOR the first character of the key –> 13

The second charater (T) XOR the second character of the key –> 4a

The third charater (B) XOR the third character of the key –> f6

The fourth charater ({) XOR the fourth character of the key –> e1

We can use CyberChef for XOR Brute Force.

HTB{ (text) --> 4854427b (hex)
48 XOR 5b --> 13
54 XOR 1e --> 4a
42 XOR b4 --> f6
7b XOR 9a --> e1

Then we can easily find the key is: 5b1eb49a

Decrypt the output, we can find the flag.

Flag: HTB{rep34t3d_x0r_n0t_s0_s3cur3}

Design a site like this with WordPress.com
Get started