HTB CHALLENGE DETERMINISTIC

Vishal ML
iQube
Published in
4 min readMay 1, 2023

CATEGORY : MISC

INTIAL ANALYSIS

After downloading and unzipping the file we can see that there is only one file, deterministic.txt

The states are correct but just for security reasons, 
each character of the password is XORed with a very super secret key.
100 H 110
110 T 111
111 B 112
112 { 113
113 l 114
114 0 115
115 l 116
116 _ 117
117 n 118
118 0 119
119 p 120
120 e 121
121 } 122
9 18 69
3 61 5
69 93 22
1 36 10
9 18 69
3 61 5
69 93 22
1 36 10
17 27 20
22 28 18
12 89 1
22 28 18
12 89 1
10 93 13
4 93 1
13 29 2
0 33 3
2 93 6
6 54 4
10 93 13
4 93 17
13 29 2
0 33 3
2 93 6
6 54 4
18 29 12
404 28 505
22 28 18
12 89 1
10 93 13
4 93 17
13 29 2
0 33 3
2 93 6
6 54 4
11 54 122
5 43 9
122 47 404
68 39 52
20 90 11
80 39 82
505 60 15
15 28 68
.........
........
........
39 72 46
9 18 69
3 61 5

Yo, listen up peeps! The file we got here is dropping some major hints — it’s got the states of a finite state machine. But hold on to your hats, because for security reasons, every single character of the password is being XORed with a super top-secret key. And what’s this key, you ask? It’s only the ASCII value of the character itself! So we gotta crack the code and figure out the ASCII value of each character, then XOR it with the key. Easy peasy, right? Let’s whip up a script in Python to make this happen. Time to put on our hacker hats and get cracking!

I Wrote a Bash script

#!/bin/bash

first_state=69420
last_state=999

declare -A dic

# Read deterministic.txt and populate the dic associative array
while read line
do
values=($line) # split the line in [state, value, next_state]
dic[${values[0]}]=${values[1]},${values[2]}
done < "deterministic.txt"

result=()

next=$first_state
while [ $next != $last_state ]
do
temp=(${dic[$next]//,/ }) # split the value of dic[next] in [value, next_state]
result+=(${temp[0]})
next=${temp[1]}
done

echo ${result[*]}

Output

48 6 28 73 4 8 7 8 14 12 13 73 29 6 73 25 8 26 26 73 29 1 27 6 28 14 1 73 8 5 5 73 29 1 12 73 10 6 27 27 12 10 29 73 26 29 8 29 12 26 73 6 15 73 29 1 12 73 8 28 29 6 4 8 29 8 73 8 7 13 73 27 12 8 10 1 73 29 1 12 73 15 0 7 8 5 73 26 29 8 29 12 71 73 36 8 7 16 73 25 12 6 25 5 12 73 29 27 0 12 13 73 29 6 73 13 6 73 29 1 0 26 73 11 16 73 1 8 7 13 73 8 7 13 73 15 8 0 5 12 13 71 71 73 38 7 5 16 73 29 1 12 73 27 12 8 5 73 6 7 12 26 73 4 8 7 8 14 12 13 73 29 6 73 27 12 8 10 1 73 29 1 12 73 15 0 7 8 5 73 26 29 8 29 12 71 73 48 6 28 73 8 5 26 6 73 15 6 28 7 13 73 29 1 12 73 26 12 10 27 12 29 73 2 12 16 73 29 6 73 13 12 10 27 16 25 29 73 29 1 12 73 4 12 26 26 8 14 12 71 73 48 6 28 73 8 27 12 73 29 27 28 5 16 73 30 6 27 29 1 16 72 72 73 48 6 28 73 26 1 6 28 5 13 73 11 12 73 27 12 30 8 27 13 12 13 73 30 0 29 1 73 29 1 0 26 73 14 0 15 29 72 73 61 1 12 73 25 8 26 26 25 1 27 8 26 12 73 29 6 73 28 7 5 6 10 2 73 29 1 12 73 13 6 6 27 73 0 26 83 73 33 61 43 18 93 28 29 89 36 93 29 93 54 93 27 90 54 47 28 60 28 39 54 93 7 45 54 39 89 29 54 45 88 15 47 88 10 60 5 29 72 72 20

IT IS CYBERCHEF TIME

RECIPE USED :

I used XOR Bruteforce to find Key Length..!!!

SEE THE RECIPE..!!

It is found ..!! That is 69..!!😂

GOT IT..!!

You managed to pass through all the correct states of the automata and reach the final state. Many people tried to do this by hand and failed.. Only the real ones managed to reach the final state. You also found the secret key to decrypt the message. You are truly worthy!! You should be rewarded with this gift! The passphrase to unlock the door is: HTB{4ut0M4t4_4r3_FuUuN_4nD_N0t_D1fF1cUlt!!}

FINAL FLAG : HTB{4ut0M4t4_4r3_FuUuN_4nD_N0t_D1fF1cUlt!!}

If you have any queries or need to get in touch, you can reach me at the following links:

LinkedIn: https://www.linkedin.com/in/mr-g0d-hacktivist/

Email: mlvishal.2002@gmail.com

Feel free to contact me through either of these channels. Looking forward to hearing from you!

--

--

Vishal ML
iQube
Writer for

Just a man who learns things that interest him!