Hydan: Steganography in Executables 235
An anonymous reader says "Ever wanted to hide a message into an executable? Now you can with Hydan. Presented recently by Rakan El-Khalil at Defcon and Blackhat, this tool lets you embed data into an application without changing its functionality or filesize! Check it out. Use includes steganography as well as embedding a program's signature into itself to verify it's not been tampered with."
What ... (Score:4, Funny)
"Oh, hydan out."
Re:What ... (Score:2)
Re:DUPE (Score:2, Insightful)
First Post and On Topic (Score:2, Interesting)
Re:First Post and On Topic (Score:5, Insightful)
If I transmit files out to my friends that include encrypted data using steganography, then the extra data should be indistinguishable, effectively hiding within the noise of random crap on the web/usenet/email. Thus, without the key, an intercepted message is difficult to detect, and even if detected, I have sufficient plausible deniability to say "nothing there".
In order to detect an message encrypted and included inside another file, you either need to know its there and be looking for it, compare it to an existing file which should be identical, or statistically detect some aspect of the file. If you know it should be there, you just need to grab any file that looks like the file you're seeking, grab the relevant bits, and attempt decryption. If you have a file that should be identical, (say, an image that looks the same that was posted to usenet a couple days earlier), you can take the bits that are different and try and make some sense of them. If you are just doing statistical analysis, you might be able to find files which have a set of bits whose randomness is just shy of where it should be, and maybe those bits mean something.
In short, unencrypted steganography isn't particularly useful, but encrypted, you can really hide things.
Re:First Post and On Topic (Score:2)
----
The Procrastinating Monkey [blogspot.com]
Re:First Post and On Topic (Score:4, Informative)
The answer there is "you can't". You need a compiled executable large enough to have multiple instances of "alterable sequences". The way I understand it, they fiddle with reversable/interchangeable opcodes to create "bits". Say a program has 500 mixed instances of: (this is all made-up assembly)
and As you can see, a sequence of a JNZ followed by a JMP can easily be re-written as a JZ followed by a JMP. The program only needs to go through and change each instance to match bitwise value of the "message", treating JNZ-JMP as a bitwise 0 and JZ-JMP as a 1. There are probably more instances of "two ways to do it" one can exploit in a given executable to yield even bigger "message spaces".Re:First Post and On Topic (Score:2)
So long as none of the jumps is itself the target of a jump. I suspect detecting this in the general case of handwritten code is impossible. Presumably the assumption is that you never have a case like that. I'll have to read the paper.
Of course
Re:First Post and On Topic (Score:3, Informative)
Haven't RTFA but... (Score:2)
If you know what compiler it was compiled under you could look for opcodes that aren't generated by that compiler. But what if you don't know what compiler generated the executable?
And what if the information isn't hidden in the opcodes at all, but merely in the ordering of rearrangeable instructions?
Take the following two instructions for example:
mov ax, 5
mov bx, 6
What if your stenography program would set them in alphabetical order by register for
Re:Haven't RTFA but... (Score:2)
Re:Haven't RTFA but... (Score:2)
I did this once .... (Score:4, Interesting)
Now every virus program will say... (Score:3, Funny)
Re:Now every virus program will say... (Score:2)
With this technique, couldn't it instead read:
1 am l337.
without changing its functionality or filesize! (Score:3, Insightful)
executable packing or actually increasing the filesize? either one has to happen.
Re:without changing its functionality or filesize! (Score:5, Interesting)
Re:without changing its functionality or filesize! (Score:5, Informative)
Hydan steganographically conceals a message into an application. It exploits redundancy in the i386 instruction set by defining sets of functionally equivalent instructions. It then encodes information in machine code by using the appropriate instructions from each set.
Re:without changing its functionality or filesize! (Score:3, Insightful)
Don't most compilers just use pick one of the redundant instructions and use that throughout? If so you just have to look for an executable that alternates betweent redundant instructions, and then you know that data is in there. At that point you're no better off than if you used plain encryption (and encryption uses less bandwidth...).
Re:without changing its functionality or filesize! (Score:3, Interesting)
Mass detection of the presence of steg with unknown techniques usually relies on on statistics over the "normal" types of files. When the LSB
Re:without changing its functionality or filesize! (Score:3, Interesting)
Mass detection of the presence of steg with unknown techniques usually relies on on statistics over the "normal" types of files. When the LSB of
Re:without changing its functionality or filesize! (Score:5, Informative)
Re:without changing its functionality or filesize! (Score:2)
Re:without changing its functionality or filesize! (Score:2)
There is a definite limit on the amount of data you can embed without increasing the file size, because a finite file can only have a finite amount of redundancy.
Perhaps the author thought this was too obvious to mention. I c
Re:without changing its functionality or filesize! (Score:2)
the author probabl never made it sound like that, but the guy that submitted this to slashdot did and the editors didn't provide explanation or better wording either.
Right now (Score:4, Funny)
So, for when the first patent lawsuit? (Score:1)
So, for when the first lawsuit against this?
Signed binaries... nice idea (Score:5, Insightful)
Re: (Score:3, Interesting)
embedding signiature?? (Score:4, Insightful)
If these folks have figured out a way of circumventing this innate paradox, I'm impressed and am dying to hear more about the technology/mathematics behind it! Can you say Nobel Prize nomination?
Re:embedding signiature?? (Score:2)
Re:embedding signiature?? (Score:5, Interesting)
Say you have an executable:
1337PROGRAM
Your signature checking routine then does this:
1_3_3_7_P_R_O_G_R_A_M
and computes the hash
deadbabeca
And then sends:
1d3e3a7dPbRaObGeRcAaM
To reverse, we extract the hash (deadbabeca) and the "original" executable.
Then we compute the hash (of 1_3_3_7...) and check if it matches...
In summary, we embedded a checksum, but we removed it before we checked it. Simple, really.
Re:embedding signiature?? (Score:2)
Re:embedding signiature?? (Score:2)
Re:embedding signiature?? (Score:3, Insightful)
even if the hash were part of the hash (come to think of it), having a method for generating such executables would still make tampering possible. at best, it'd make it a slow process (assuming it's not something you can generate in O(1) time.)
Re:embedding signiature?? (Score:5, Interesting)
To decode.
I would still recommend publishing a separate public key, however, and include an encrypted signature in the program. As you say, it can always be changed and re-encoded.
On the other hand, this might be useful on a server, by encoding a public key and checker on a CD-R and checking all your programs periodically against the CD-R key. You could encode signatures in each program and be able to upgrade programs from a central encoding server without having to write a new cd each time.
Re:embedding signiature?? (Score:3, Interesting)
It is typically assumed for these kinds of things that the signature itself is not part of the data being signed. However if the file can be modified, so can it's signiature.
You could easily solve that by using X.509 certificates, issues by a trusted CA, similar to the Microsoft "signcode.exe" program for signing CAB files and EXEs. However, that would only prove the integrity of the binary. It's st
Nobel prize? (Score:2, Interesting)
The only thing they have to solve is f(X+S) = S, where f is the algorithm for calculating the signature, X is the exe code, and S is the signature. Depending on f, it can either be completely trivial to calculate S or impossible.
Re:embedding signiature?? (Score:5, Informative)
[...] am dying to hear more about the technology/mathematics behind it! Can you say Nobel Prize nomination?
There is no Noble Prize for mathematics.
Re:embedding signiature?? (Score:2)
Information wants to be private... (Score:3, Insightful)
At least not without a top down Orwellian soceity where all hardware and software is controlled.
Re:Information wants to be private... (Score:2)
That is a very poor encryption algorithm, but I used keys that were ~150 kbytes. Unbreakable.
We would carry a floppy with ~10 keys on it and every time we would send a file we'll choose a different key and just send the filename of the key along the mail.
Of course, with that kind of poor kryptography you need a strong key, so my algorithm to generate a key was initiating two different random se
Re:Information wants to be private... (Score:2)
One seed was used to randomly choose files in the filesystem.
The other seed was used to generate numbers between 0 and 255 to XOR them with the actual files chosen by the first algorithm.
When the generated stream length was 150kbytes long, we got a key.
Of course, both me and my friend needed to have a FDD with 10 keys on it to read the files sent...
BTW, h
Re:Information wants to be private... (Score:3, Insightful)
At least not without a top down Orwellian soceity where all hardware and software is controlled.
Isn't this basically what DRM aims to do?
The question, answered. (Score:5, Funny)
Not really :)
But I'd like to make that dog downstairs stop barking.
bologna (Score:2, Funny)
sometimes you don't even have to rtfa to rip on a topic...
Nuttles
Christian and proud of it
Re:bologna (Score:3, Informative)
According to the article that you didn't read it seems that the amount of text that you can imbed without affecting the filesize is determined by the original file's contents.
You wouldn't be able to fit War and Peace into most files but you could fit about 1.44KB of text into a 500k file or so (according to their examples).
Re:bologna (Score:2)
Have you seen the size of executable the latest Microsoft compilers produce for something as simple as "Hello World"? You almost could.
Re:bologna (Score:4, Funny)
Now the full text of "War and Peace" might be a different story... (Literally! Chuckle/snort
Re:bologna (Score:2)
Well, if your Hello world application was written in the style of Master Programmer [ariel.com.au] from the old joke... you can easily fit the whole collected works by Fedor Dostoevsky.
A new low... (Score:5, Funny)
Wow [slashdot.org].
Re:A new low... (Score:5, Funny)
A bunch of folks who got pissed off that their stories never got approved on /. got together on alt.syntax.tactical and devised a plan. What they're doing is finding OLD slashdot stories and resubmitting them.
So far, it's been moderatly successful with 4-5 dupes getting through each week. This story was particularly amusing because the article has a link to their /. mention! Good work to the folks at a.s.t!
I suggest you start playing along too! It's fun to show how worthless the /. editors are.
Re:A new low... (Score:2)
Plus now we have solid proof that even the editors don't read the story before posting!
Hydan... (Score:5, Funny)
Soon to be published PDF text. (Score:4, Informative)
Rakan El-Khalil and Angelos D. Keromytis
Department of Computer Science, Columbia University in the City of New York
{rfe3,angelos}@cs.columbia.edu
Abstract. We present a scheme to steganographically embed information in x86
program binaries. We define sets of functionally-equivalent instructions, and use
a key-derived selection process to encode information in machine code by using
the appropriate instructions from each set. Such a scheme can be used to watermark
(or fingerprint) code, sign executables, or simply create a covert communication
channel. We experimentally measure the capacity of the covert channel by
determining the distribution of equivalent instructions in several popular operating
system distributions. Our analysis shows that we can embed only a limited
amount of information in each executable (approximately 1
110 bit encoding rate),
although this amount is sufficient for some of the potential applications mentioned.
We conclude by discussing potential improvements to the capacity of the
channel and other future work.
1 Introduction
Traditional information-hiding techniques encode ancillary information inside data such
as still images, video, or audio. They typically do so in a way that an observer does not
notice them, by using redundant bits in the medium. The definition of "redundancy"
depends on the medium under consideration (cover medium). Because of their invasive
nature, information-hiding systems are often easy to detect, although considerable work
has gone into hiding any patterns [1]. In modern steganography, a secret key is used to
both encrypt the information-to-be-encoded and select a subset of the redundant bits
to be used for the encoding process. The goal is to make it difficult for an attacker to
detect the presence of secret information. This is practical only if the cover medium has
a large enough capacity that, even ignoring a significant number of redundant bits, we
can still encode enough useful information.
Aside from its use in secret communications, an information-hiding process [2] can
be used for watermarking and fingerprinting, whereby information describing properties
of the data (e.g., its source, the user that purchased it, access control information,
etc.) is encoded in the data itself. The "secret" information is encoded in such a manner
that removing it is intended to damage the data and render it unusable (e.g., introduce
noise to an audio track), with various degrees of success.
In this paper, we describe the application of information-hiding techniques to arbitrary
program binaries. Using our system, named Hydan, we can embed information
using functionally-equivalent instructions (i.e., i386 machine code instructions). To determine
the available capacity, we analyze the binaries of several operating system distributions
(OpenBSD 3.4, FreeBSD 4.4, NetBSD 1.6.1, Red Hat Linux 9, andWindows
XP Professional). Our tests show that the available capacity, given the sets of equivalent
instructions we currently use, is approximately 1
110 bits (i.e., we can encode 1 bit
of information for every 110 bits of program code). Note that we make a distinction
between the overall program size and the code size. The overall program size includes
various data, relocation, and BSS sections, in addition to the code sections. Experimentally,
we have found that the code sections take up 75% of the total size of executables,
on average. For example, a 210KB statically linked executable contains about 158KB
of code, in which we can embed 1.44KB (11, 766 bits) of data.
In comparison, other tools such as Outguess [1] are able to achieve a 1
17 bit encoding
rate in images, and are thus better suited for covert communications, where data-rate
is an important consideration. The 1
110 encoding rate achieved by the currently implemented
version of Hydan is obtained when we only use instruction
slashdotted allready... (Score:4, Informative)
Re:slashdotted allready... (Score:2, Insightful)
The main purpose is to send secret data, hidden in something that doesn't seem to contain such data.
If there's no "original" file to compare with, it'd be hard to detect the presence of the extra data. One could write a small application which seems innocent, but which only real purpose is to be used as a container for covert messages.
Re:slashdotted allready... (Score:3, Insightful)
Coupled with messages in images, this will make it quite easy to move data around without anyone else knowing. There are too many places it
What they should have done (Score:3, Funny)
Signal/Noise (Score:2)
How it's done.. (Score:5, Informative)
So much for theory. Here's an example; let's say we have a couple of synonyms, like so
car, automobile; Robert, Bob; crashed, trashed; beer, whisky.
Let's say we have a little story like so;
"Bob got in his car. He crashed it, because he had been drinking too much beer. His car is now a total loss."
Let's say we want to send a secret binary message "0110". Cunningly, we substitute the first of each pair of synonyms if we want to encode a zero, and the second for a one. So the story is now
"Robert got in his automobile. He trashed it, because he had been drinking too much whisky. His car is now a total loss." (notice how not all key words changed).
This is a bit harder with natural language, as many words aren't quite right to use in place of the other ("got in his automobile" just doesn't sound right), so it's actually easier to do for machine code.
Hashing problem: (Score:2, Insightful)
Problem.
Re:Hashing problem: (Score:2)
Re:Hashing problem: (Score:2)
Nope, when you calculate the checksum, you take the checksum field as 0.
I believe the same or similar is done here.
Um (Score:2)
No...
Rather use images (Score:2)
In order to make sure people can't determine any changes to a file, so preferably there is no reference material to compare the file with. Reference material like other unchanged executables.
So this doesn't work unless you write a program for each message you want to hide.... Not? Ok. I'd think so too.
So I'd rather take my digital camera, take a picture of a whatever and use that as an original.
But I have to admit it's way c
A shareware assembler used this trick. (Score:2)
Re:A shareware assembler used this trick. (Score:3, Informative)
It used the same method hydan uses. It used equivelant instructions that were "different" from the way the code was written. I'd used it a bit for myself, and noticed that was what it did when I opened the files later with debug.
The documentation never really said how, it just said it "fingerprinted" the code.
How it can be done (Score:2, Interesting)
Some 8086 opcodes contain a bit that reverses the operation. For examble, with the bit set in the instruction "mov bx,cx", bx would be copied to cx instead of cx to bx. By switching the registers AND setting the bit, you effectively reverse the operation twice, creating different machine code that does exactly the same thing.
The A86 assembler used this bit to create a fingerprint that would make it easier to detect non-paying users.
Executables in my mail (Score:2)
"Astroturfing" (Score:2)
Re:"Astroturfing" (Score:2)
What sort of idiot would have a program check itse (Score:3, Insightful)
I'm going to stick with a separate md5sum, thanks.
How it works (Score:3, Informative)
- How it works
--------------
Overview: Hydan finds sets of equivalent instructions in the binary,
and uses that redundancy to embed data. The larger the set of
equivalent instructions, the more bits can be embedded. For example,
if instructions {a, b, c, d} are all equivalent, then we can embed two
bits of information when any of those instructions are encountered.
Embedding: Hydan goes through the application sequentially, and
whenever it finds an instruction that it has equivalents to, it
substitutes in the instruction that represents the bit(s) of data
hydan is currently embedding. A simple example: "add %eax, 50" is
equivalent to "sub %eax, -50". So this set is {"add %reg, $imm", "sub
%reg, $imm"}. Whenever an instruction of the form "add %reg, $imm" is
encountered, hydan can embed one bit of the message. If the bit is 0,
it leaves it as an add instruction. Else it substitutes it to "sub
%reg, -$imm". (and vice versa)
Decoding: When it is time to extract the embedded message, every
"add %reg, $imm" is taken to mean bit 0, and every sub instruction
encodes the bit 1, and the embedded message is reconstructed that way.
Encryption: Hydan first prompts the user for a passphrase before
embedding or decoding the contents of the application. In the case of
embedding, hydan prepends the length of the message to the message,
encrypts that with blowfish in cbc mode, and embeds the result into
the application. When decoding, hydan extracts all the possible bits
from the application (since it does not know how long the message is
a-priori; that information is encrypted). Hydan then decrypts the
message properly since it is in CBC mode and need not know the total
length first. The lenght is then used to truncate the message to
size.
Instructions: For a complete list of the sets of equivalent
instructions, please refer to hdn_insns.c.
- Attacks
---------
There are three classes of attacks that are applicable to hydan:
overwriting, detection, and extraction. The overwriting attack refers
to the ability to overwrite the message embedded in the application,
whether its presence was detected or not. An attacker should also not
be able to detect the presence of a message in the application, nor
decrypt it.
The overwriting attack: hydan currently has no means to protect
against this type of attack. Since hydan embeds the message
sequentially, starting from the top of the application, an attacker
could re-run hydan with a bogus text and embed that on top of the
original message. The intended recipient of the application would
thus be unable to retrieve the original message. One way this could
be solved is to add an error correcting code to the encoding of the
message, and distribute the message throughout the application in a
passphrase specific manner. This way only parts of the original
message would be overwritten, and the original may still be
reconstructed. Of course, there is nothing that can be done if the
attacker insists on overwriting with a message size that is the
maximum embeddable in the given application. However, the computation
required to overwrite each application on a large scale might be
prohibitive enough to discourage this as a routine behaviour, at an
ISP for example.
Detection: Binaries produced by hydan should not exhibit obvious
patterns. At the most superficial level, this is accomplished by not
embedding any marker or other easily recognizable token. At best, the
embedded data looks random (which is why it is bf encrypted). At the
assembly level however, the current version of hydan makes no attempt
at mimicing the original distribution of instructions in the
application, and is thus vulnerable to statistical analysis. Indeed,
although all the instructions are equivalent, some may appear more
frequent
Embed in Viruses? (Score:4, Interesting)
But then I started thinking about how effectively viruses are distributed by non-techies who do click on the attachments in their EMAILs. Perhaps viruses or spyware could be used to "broadcast" a message this way to different cells in a covert organization (terrorists, organized crime, chess club members, whatever). All you'd need is an unprotected PC to act as a tethered goat and catch all those infections for later reading.
For that matter, a sender could "neuter" a virus by disabling its reproductive code and then embed a message in it and send it through some anonymizer (either a formal anonymizer or using a shell account). When the recipient stores it in a quarantine directory, it would look just like an infected EMAIL that had been cleaned up by your antivirus program, not a covert message. Some variation of this using spyware infection would be even more effective as they tend (in my limited experience) to have even more variants than viruses - the obfuscated message would be more readilly confused with normal variation. Instead of posting your tampered executables to some usenet forum, you would simply have the reciepient visit a site running the spyware. New messages would be sent and old ones sterilized when the spyware reinstalls itself.
Just my 20 mills.
Re:Embed in Viruses? (Score:3, Funny)
I feel no anxiety about EXE files. Maybe it's because I run Linux.
Re:Embed in Viruses? (Score:2)
It was highly entertaining
Been done for ages by A86 (Score:5, Insightful)
Any CPU that has an instruction to exchange two registers will have some redundancy, but for X86 even basic mov (as well as add, sub, cmp and so on) specifies both two operands and a flag that specifies which one is source and which one is destination. The significance is that both operands can be registers, but only one can be a memory reference.
A much more impressive use would be a program that reads its own code as data to save the last few bytes, especially if it has a real purpose, like fitting a game into a fixed-size ROM.
Stenography (Score:2, Interesting)
One reason for this is if you have encrypted data on your disk, then courts can demand the password for it. Stenography allows you to insist there is no hidden data.
Re:Stenography (Score:2)
No, stenography [wikipedia.org] allows the court to keep accurate protocols when they ask you for that hidden data ;-)
Now steganography [wikipedia.org] on the other hand...
In related news... (Score:3, Funny)
M$ Outlook prevents terrorism! (Score:2, Funny)
It's not an annoyance; it's a *feature*!
Performance effects? (Score:3, Insightful)
Modern optimizing compilers spend an awful lot of effort generating efficient combinations of instructions which try to make the most out of CPUs having complicated rules. For example, add eax,eax and shl eax,1 might both produce the same desired effect but yield significantly different runtimes depending on the presence / absence of barrel shifters or the ability of particular instructions to pair in a given CPU.
Naturally the above would only matter if the modified code is in an inner loop, but it could happen.
Decrypted from a Linux kernel binary... (Score:2)
'Copyright SCO' and 'Darl Rules!'
Steganography (Score:5, Informative)
For a method to truly be steganography, it's not enough just to embed some data into another. That's possible any time there's redundancy. The requirement is to make it so clever and/or subtle that there is no way to distinguish a processed file from an unprocessed one.
I doubt that this new method passes the test. Generally, while there are many synonyms possible in code, both in single instructions and in short sequences of instructions, the statistics of how these are distributed in unprocessed files are probably not random. Chances are that one synonym is used more than another. If you embed random data in a straightforward way, you will then have equal usages of both alternatives. This is a highly unusual condition, and to someone in the know, files like these will be easily distinguished.
Only if they have found a kind of synonym which already has purely random statistics, or where they are careful to precisely mimic the statistics of the original file as they add their data, can this truly be considered a form of steganography.
CFLAGS="-Onegative1" (Score:2)
the statistics of how these are distributed in unprocessed files are probably not random.
Sounds to me like my home computer system needs to be compiled with anti-optimization to throw in some more of these synonyms randomly into my executables.
Re:Steganography (Score:2)
Close, but not quite. He should not be able to tell which one contains the message. Important distinction, and what you meant I think.
Re:Steganography (Score:2)
A86 did this... (Score:4, Interesting)
Unnecessarily complicated (Score:2)
KISS
Re:SCO connection (Score:1, Funny)
Re:Information Theory (Score:5, Informative)
add ax, 1
add al, 1
inc eax
add eax, 1
All of these i386 instructions do the same thing, but they've got different binary representations. If you encode your information by which instruction you use, you can hide the message without changing filesize or functionality.
Re:Information Theory (Score:5, Informative)
Suppose eax = 0xFFFFFFFF.
Result of "inc ax": eax = 0xFFFF0000
Result of "inc al": eax = 0xFFFFFF00
Result of "inc eax": eax = 0x00000000
They don't do anything near the same thing. The carry bits get lost.
However, you can substitute "add ax, 1" for "inc ax", and "add al, 1" for "inc al", and "add eax, 1" for "inc eax".
Not even the same size! (Score:2)
Re:Information Theory (Score:2)
Re:Without changing its size??? (Score:3, Funny)
*ducks*
Re:Without changing its size??? (Score:2)
It uses the redundancy in the x86 commands...
Like:
add eax, 1
vs
inc eax
Both do the same. If you state the first is "0" and the second one is a "1", then u can encode data inside the executable.
Re: For the slightly less knowledgable (Score:5, Funny)
> steganography: the hiding of a secret message within an ordinary message and the extraction of it at its destination.
I thought steganography meant pictures of stegasaurs making little stegasarus.
Re:This isn't exactly new... (Score:3, Interesting)
#include "/dev/tty"
A86 did this 18 years ago (Score:2)
In particular, read section 6 in this part [csn.ul.ie] of the original documentation.
Hydan merely takes this technique that wa