worst-pw-manager
Description
Files
- worst-pw-manager.zip
- worst-pw-manager/worst-pw-manager.py
- worst-pw-manager/passwords/
worst-pw-manager.py workings
Only import functionality is implemented, which is broken in the sense that the encrypted password is stored in the file whose name is just a cipher of the password XD
The complicating looking masked_file_name is nothing just a shift cipher by shift i at ith index.
if the character at index i is a digit, i is added to it modulo 10
else if the character is a alphabet, it is shifted by i modulo 26
Lets just get all the password, and encrypted password pairs
Now the real challenge is to recover the key from plaintext/ciphertext pairs.
The key is cycle(flag_characters) which means 8 characters of the flag are taken at a time, looping again to start once the flag ends.
This got me into rabbit holes searching for known plaintext key recovery attacks on rc4. After googling a bit, I tried bruteforce on the key since the key is only 8 bytes and the key used to encrypt first block would contain the prefix flag{, which makes it only 3 bytes to bruteforce. One could extend this stratergy to get key bytes over and over once since somewhere the next 5 characters would be prefix to some 8 byte key block.
Later did I notice that the key generation was buggy
[KeyByteHolder(0)] * just simply creates an instance KeyByteHolder(0) and generates 8 references to it. The correct way would have been [KeyByteHolder(0) for _ in range(8)].
Given this fact, all the key bytes are actually the last byte repeated 8 times (because of the last assignment)
And we get a list somehwhat
Which is the list over eighth characters modulo the flag length, which is yet unknown.
All we need to do is loop over the possible flag lengths and check if it contains flag
flag{crypto_is_stupid_and_python_is_stupid}
Yet another fun challenge! Good job redpwn guys!