Friday, July 27, 2007

Inverse Steganography

This story says that things on your computer that make it look like you are hiding stuff is itself incriminating. For example, if you have an encrypted file on your disk, it is evidence that you have something to hide, and therefore means you must be guilty of something.

As somebody who loves freedom, this really bugs me. I do a lot of strange things, and I don't like the idea that they might come back to frame me for crimes because no normal person would do them.

For example, I like foreign movies (here is the latest movie in French that I bought). I was in a Blockbuster video rental store. Since foreign movies are not popular, they had them back behind a corner. While I was back there looking at the movies, a kid comes wandering by and asks "What's back here?". After answering "Foreign films", the kid looks up at me like I'm a perrvert, runs back to his mother, and starts babbling something while pointing to me. I don't know what the kid said, but I felt guilty and embarrassed nonetheless.

On a more serious note, I like to shoot guns, but don't want to get arrested for a local convenience store robbery because shooting guns isn't "normal".

Encryption is one of these perversions. More and more laws are being passed to restrict encryption. Many years ago, the United Kingdom passed a law requiring people to give up their encryption keys to law enforcement. Having encrypted files that law enforcement cannot decrypt is a crime. While being interviewed on this (I think for The Register) I suggested that what virus writers should do is, among other things, drop encrypted files on people's systems. This creates a sort of "inverse steganography", where the existence of encrypted data does not itself prove that the user is trying to encrypt anything.

Even if virus writers don't include this sort of code in their viruses, you can certainly add such files to your system. I've included code below that can create pseudo-encrypted files on Windows (and of course you can use /dev/urand on other systems). This software works because, in theory, "random" data is indistinguishable with "encrypted" data.

Even though virus writers haven't littered our systems with random files, you can still take advantage of inverse steganography. First, create a DVD image of some files that you want to encrypt. Then run a raw AES encryption with a strong key over that DVD image. This gives you a 4-gig file that outsiders know is either (1) random data or (2) encrypted data, but they can't be sure which. Next, create another disk image full of porn. Now XOR (in One-Time-Pad fashion) the two disk images together. Now write two DVD's to disk, one containing the AES encrypted data, and the other containing the XORed porn. When law enforcement finds you with both disks, you claim that the AES disk is actually just a One-Time-Pad, that it contains random data and NOT encrypted data. Thus, law enforcement can't prove that you the One-Time-Pad is actually encrypted data or not.

As an activist, you should do this even if you don't want to hide any data of your own. If you are like me and believe that humans should have the Right to Encrypt their private data, then you should have such random files on your computer and randomized disks among your backups. The more individuals do this, the less power law enforcement will have to prosecute those who encrypt data. It's not a loud protest, but it's still an important silent protest.

The code below is for Windows using Microsoft's Crytographic services. I'm using RC4 here in a naïve manner, so there is a chance that a determined adversary can prove the resulting file is, or is not, produced by this program, but I doubt your local cops would have the resources to do so.

#include <stdio.h>
#include <windows.h>
#include <wincrypt.h>
void main(int argc, char *argv[])
{
HCRYPTPROV hCryptProv;
unsigned size;
FILE *fp;
if (argc < 3) {
printf("usage:\n polyrand <size> <file>\n");
return;
}
size = strtoul(argv[1],0,0);
fp = fopen(argv[2],"wb");
CryptAcquireContext(&hCryptProv,NULL,NULL,PROV_RSA_FULL,0);
while (size) {
char buf[1024];
unsigned len = sizeof(buf);
if (len > size) len = size;
CryptGenRandom(hCryptProv,len,buf);
if (fwrite(buf,1,len,fp) != len)
printf("write err\n");
size -= len;
}
}

5 comments:

Andy, ITGuy said...

Robert, I've got several comments so I may make them separately.
First, stuff like this really irritates me also. Encryption is needed, especially in this day in age, to protect PII, financial data, etc. What we need to do is encourage people to use encryption for legitimate needs such as these. It will take time but if we can do this then encryption will become something that "normal" people do. Not exactly sure how to do this, but I think I will blog about it myself. Maybe even toss it around in the Security Catalyst Community and see what thoughts they have.

Andy, ITGuy said...

Changed my mind on the rest of the comments. They weren't worth making. You and David should plan on attending HotSec in August.

mokum von Amsterdam said...

The Bushies & his "enablers" are insulated from responsibility and even knowledge of his manifold tragic blunders and crimes by Washington loyalists. This is just the logical next step in their "who is not with us is against us" mind set.
You must be guilty just by 'hiding' as you will be by being different.
The land of the free :P

Didier Stevens said...

Keep also a set of rainbow tables to add to the confusion. And generate your own rainbow tables, so that your files are unique and cannot be matched with a list of known file hashes.

You can even hide data in rainbow tables: http://didierstevens.wordpress.com/2007/05/21/hiding-inside-a-rainbow-part-2

Unknown said...

Hey Robert,

FWIW, I thought District 13 was brilliant as well. Stumbled upon it rather randomly on the web, rented it the same evening. Amongst the best action flicks I've seen in a while. :-)

Also, in furtherance of your point, I recommend to friends and colleagues that they use Tor whenever possible, including (especially) those times when they DON'T have anything to hide, as doing so prevents usage patterns from indicating WHEN a person has something to hide.

Cheers,
Taylor Banks