#DennisCrypt
Encrypt/decrypt old Dennis Publishing browser configurations
##Usage
Compile with your preferred D compiler: dmd dennis.d
or gdc -odennis dennis.d
, and show command line usage with dennis
. Please note that the tools Dennis Publishing used to create the encrypted cdparas.txt encrypted more than it should have, in a Careful with that Buffer situation, so after the configuration (ends in "Q!!\r"
), you'll see random content from memory. In one instance, this has been parts of configurations from other cover CDs; I have yet to see anything interesting. Contact me through Twitter, Reddit or IRC ( irc.ringoflightning.net #RIS ) if you do find something interesting. :P
##Background
Dennis Publishing is a UK magazine publishing business that has existed for.. a long time. Wikipedia says they were founded in 1974, and got into publishing computer magazines in the 1980s. Naturally, in the 1990s, they started publishing cover CDs, and in 1995 or 1996, they started including a Win16 browser (coded in Delphi) on their CDs.
Almost instantly, creators of CDs containing pirated materials ("warez CDs") sold on the black market started abusing Dennis' browser, namely by editing the resources, and because the browser's configuration was at the time stored in a traditional .ini and was very easy to modify. As to how quickly it was done, I have an ISO of a warez CD from 1996 using a resource edited version of Dennis Publishing's browser. And the browser was initially created in 1995. I have no idea if any earlier examples of warez CDs using Dennis Publishing's browser exists, namely because due to their content, they're pretty hard to find nowadays. (You generally have to know someone who had bought them in the past, and maybe sometimes such a person uploads them to torrents or archive.org.)
Anyway, probably to try to prevent the (mis)use of their browser, the last "traditional" version of Dennis Publishing's browser (initially used in mid-2001, and the only Win32 version - it ceased to be used in 2004 or 2005 whereupon a Flash-based browser was introduced), changed their configuration to an encrypted form, using "cdparas.txt" (the actual encrypted configuration) and "cdid.txt" (which is used as part of encryption key generation). To my knowledge, the encryption algorithm had never been reversed. So, I got bored, threw open IDA and OllyDbg, and reversed the encryption algorithm :)
##Algorithm
Basically, xors on top of xors. Also, the code generated the encryption key from a couple of strings, 1-3 bytes at a time. Security through obscurity maybe? Anyway, the key used is the contents of cdid.txt (without the rightmost newline), concatenated with text from the first few lines of the poem Jabberwocky, trimmed to the first 61 bytes. (Maybe one of the coders involved with the browser was a Lewis Carroll fan.) The key is iterated through, and each byte is xored together in a scratch byte-length variable (that is initialised with 0x56 before the loop). The resulting byte is used as the first byte of the xor pad; the rest of the xor pad is generated by iterating through the key again, xoring each byte with the same scratch variable used to store the first byte, and saving off the resulting byte. Following xorpad creation, it is used like you'd expect a xorpad to be used. That is, looping through the byte array and xoring each byte with xorpad[iterator modulo xorpad length].