Mailbox (Smart Home, 200p)

Once your brother managed to submit his homework, you get a notification that a package has been delivered to your smart mailbox.
You look outside the window and see your mother already opening the mailbox.
Out of the corner of your eye you notice a guy shoulder surfing while your mother is entering the PIN.
You decide to change the pin, but for this you need the admin pin code which you encrypted in a safe container when you initially got the mailbox.
Problem is that you don't remember the cipher you used for encryption.
You only remember the following details:
Tool: openssl
Password: Kh39.3e12kleZs-po7
Encrypted file

solution

This task requires brute-forcing openssl cipher's and it's parameters. Create a list of ciphers.

# openssl enc -ciphers | grep '^-' | tr ' ' '\n' | grep .  > ciphers.txt

Trying to brute-force ciphers in their default configurations, didn't lead to anything.

# for i in `cat ciphers.txt`; do openssl enc $i -d -in pin.enc -k 'Kh39.3e12kleZs-po7' -out pin.out; test -n "$(strings -ws '' pin.out)" && echo "------ $i" && strings pin.out; done 2>/dev/null
------ -aes-128-cfb8
jPti
------ -aes-192-cbc
U_C:!
------ -aes192
U_C:!
------ -aria-192-cfb
o\;fY
------ -aria-256-cbc
Lm0aAz
------ -aria-256-cfb
------ -aria-256-ctr
------ -aria-256-ofb
------ -aria256
Lm0aAz
------ -bf-ecb
>@D}
E1-
------ -camellia-128-cfb1
f/s`
JhXuH7
------ -camellia-192-cfb1
k% W
`J;jV
------ -camellia-192-ecb
(vd7D
------ -camellia-256-cfb
B@G2
------ -camellia-256-cfb1
"g6.!
np]+
------ -camellia-256-cfb8
2#k5
------ -camellia-256-ctr
B@G2
------ -camellia-256-ofb
B@G2
------ -chacha20
"+'G$X-W
------ -des
Im1HR<
------ -des-cbc
Im1HR<
------ -des-cfb1
o\s!
------ -des-ede3
W5})^
------ -des-ede3-cbc
R#nt
------ -des-ede3-ecb
W5})^
------ -des3
R#nt
------ -rc2-ofb
*_kb
------ -seed-cfb
------ -sm4-cfb
Z,Fc
------ -sm4-ctr
Z,Fc
------ -sm4-ofb
Z,Fc 

Trying decryption with -pbkfd2 and trying -iter with various default values, like 100, 1000, 5000, (..) yielded results with 10000.

# for i in `cat ciphers.txt`; do openssl enc $i -d -in pin.enc -k 'Kh39.3e12kleZs-po7' -pbkdf2 -iter 10000 -out pin.out; test -n "$(strings -ws '' pin.out)" && echo "------ $i" && strings pin.out; done 2>/dev/null
------ -aes-128-cbc
jw"<.B!Q7
------ -aes-192-ofb
------ -aes-256-cbc
PMrG
------ -aes128
jw"<.B!Q7
------ -aes256
PMrG
------ -aria-256-cfb
r?uWq@
------ -bf
        ~xz
------ -bf-cbc
        ~xz
------ -bf-cfb
------ -bf-ofb
------ -blowfish
        ~xz
------ -camellia-128-cfb1
&%G6
------ -camellia-128-cfb8
H3`6/-
------ -camellia-128-ctr
cq"Y
------ -camellia-192-cfb
ud5,
------ -camellia-256-cbc
]5s,
------ -camellia-256-cfb
M,H?
arsX
------ -camellia-256-cfb1
8TR'=!Sv
Y4ku
------ -camellia-256-cfb8
My mailbox PIN code:
1837
------ -camellia-256-ctr
M,H?
arsX
------ -camellia-256-ofb
M,H?
arsX
------ -camellia256
]5s,
------ -cast5-cfb
Z4gt
zWb[
------ -cast5-ofb
Z4gt
VQIuFG
------ -chacha20
vZTP3_
------ -des-ecb
7!6r
~x#7x
------ -des-ede3-ofb
q#ci@
------ -desx
9a8R/
------ -desx-cbc
9a8R/
------ -rc2
~n_n#
------ -rc2-128
~n_n#
------ -rc2-cbc
~n_n#
------ -rc2-ecb
------ -seed
CEfhTs[-
------ -seed-cbc
CEfhTs[-
------ -seed-ecb
`z3o:
------ -sm4-cfb
~C8H
------ -sm4-ctr
~C8H
------ -sm4-ofb
~C8H

Flag is 1837.


Buy Me A Coffee