Cryptex is quite straightforward to use, with only four supported commands.
Files are encrypted using a user-supplied password, and the program supports
deleting files from the archive and extracting files from it. It is also possible to
add multiple files with one command using wildcards such as *.doc.
There are several reasons that could justify deciphering the file format of a
program such as Cryptex. First of all, it is the only way to evaluate the level of
security offered by the product. Let’s say that an organization wants to use such
a product for archiving and transmitting critical information. Should they rely
on the author’s guarantees regarding the product’s security level? Perhaps the
author has installed some kind of a back door that would allow him or her to
easily decrypt any file created by the program? Perhaps the program is poorly
written and employs some kind of a home-made, trivial encryption algorithm.
Perhaps (and this is more common than you would think) the program incor-
rectly uses a strong, industry-standard encryption algorithm in a way that com-
promises the security of the encrypted files.
File formats are also frequently reversed for compatibility and interoperabil-
ity purposes. For instance, consider the (very likely) possibility that Cryptex
became popular to the point where other software vendors would be interested
in adding Cryptex-compatibility to their programs. Unless the .crx Cryptex file
format was published, the only way to accomplish this would be by reversing
the file format. Finally, it is important to keep in mind that the data reverse-engi-
neering journey we’re about to embark on is not specifically tied to file formats;
the process could be easily applied to networking protocols.
Reversing Cryptex
How does one begin to reverse a file format? In most cases, the answer is to
create simple, tiny files that contain known, easy-to-spot values. In the case of
Cryptex, this boils down to creating one or more small archives that contain a
single file with easily recognizable contents.
This approach is very helpful, but it is not always going to be feasible. For
example, with some file formats you might only have access to code that reads
from the file, but not to the code that generates files using that format. This
would greatly increase the complexity of the reversing process, because it
would limit our options. In such cases, you would usually need to spend sig-
nificant amounts of time studying the code that reads your file format. In most
cases, a thorough analysis of such code would provide most of the answers.
Luckily, in this particular case Cryptex lets you create as many archives as
you please, so you can freely experiment. The best idea at this point would be
to take a simple text file containing something like a long sequence of a single
character such as “*****************************” and to encode it
202 Chapter 6