Recently, I needed to recover a DSL password that only persisted in an old router (Draytek Vigor 2500/We). Since the web interface only shows the username, I tried the backup feature that dumps the entire configuration to a file that you can download. Unfortunately, this data comes in an encrypted form… which makes an excellent exercise for a student of computer science.
Dear Draytek developers: I don’t know if you have used a secure encryption algorithm, but it was used in ECB mode with a block length of one byte… which makes it degenerate to a simple substitution cipher that can be easily broken, no matter how secure the underlying encryption function is.
I created a codebook holding all pairs of letters and their encrypted counterparts by simply changing a random setting in the web interface, looking at the diff between this version and the previous one with VBinDiff (Ubuntu package: vbindiff) and writing down the encrypted version of the characters I previously entered. Download the codebook: vigorcrypt (Syntax: character, ASCII-Code (hex), encrypted (hex)).
Afterwards, a small Python script did the job of decrypting a dump file. It changes all characters for which no entry in the dictionary exists to null bytes and decrypts all others.
#!/usr/bin/env python lookup =  * 256 for line in file('vigorcrypt.txt', 'r'): line = line.split('\t') if len(line) == 3: if lookup[int(line, 16)] != 0: print 'Duplicate ciphertext found in line: ', line lookup[int(line, 16)] = int(line, 16) infile = file('config.cfg','rb') data = infile.read() infile.close() outfile = file('config_decrypted.cfg','wb') for i in range(len(data)): outfile.write(chr(lookup[ord(data[i])])) outfile.close()