Slashdot Mirror


Program Hides Secret Messages in Executables

DmuZ writes "My friend Rakan has created a new steganographic tool named Hydan which can embed messages into an executable without altering its size. He recently presented this tool to the public for the first time at codecon. This new technique was intriguing enough to get coverage on SecurityFocus.com. The code is available here."

26 of 243 comments (clear)

  1. stenography by JohnFluxx · · Score: 4, Insightful

    > El-Khalil concedes that the method is imperfect -- an application that's been impressed with a secret message has considerably more "negative subtractions" than an unadulterated program, making it easy to pick out through a statistical analysis.

    Note that as far as I remember, stenography by definition is supposed to make it imposible to prove that there is data hidden there - one step further than normal encryption. It's not so much as about hiding the data as being able to deny its existance.
    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.

    1. Re:stenography by JohnFluxx · · Score: 4, Informative

      er...

      Steganography requires that it is impossible to prove that data is being hidden there. (Without reference to other material, etc etc).

      From The Free On-line Dictionary of Computing (09 FEB 02):

      steganography

      Hiding a secret message within a larger one in such a way that others can not discern the presence or contents of the hidden message. For example, a message might be hidden within an image by changing the least significant bits to be the message bits.

    2. Re:stenography by Bunji+X · · Score: 5, Insightful

      "exactly why did you send Mohammed bin Mohammed a picture of your kitten a day before al-Queda hijacked that airliner?"

      None of your freaking business. Mohammed bin Mohammed is an old friend of mine, he wanted to see a picture of my new kitten.

      Freedom of expression, freedom of speech. No?

      Maybe a professor's testamony of "high probability" is enough to get you in deep shit over there, fortunately we still have something that reminds of citizen rights, this side of the pond.

      --
      ---
      The combined human population is enough to feed every living tiger for app. 28000 years.
    3. Re:stenography by sql*kitten · · Score: 4, Interesting

      None of your freaking business. Mohammed bin Mohammed is an old friend of mine, he wanted to see a picture of my new kitten.

      You have a point. On November 12th, 2001, a 58-year old Australian woman resident in Helsinki, placed an obituary notice for Mohammed Atta in Finland's daily newspaper, Helsingin Sanomat. She was questioned by police. If I remember correctly, she had met him many years earlier, had no idea he was a hijacker, but had heard that he had recently died. But, when thousands of lives are at risk, suspicious events have to be followed up, even if it's only to eliminate them from enquiries.

      Maybe a professor's testamony of "high probability" is enough to get you in deep shit over there, fortunately we still have something that reminds of citizen rights, this side of the pond.

      Since you mention Freedom of Speech, a Constitutional right, I'll assume you're on the West side of "the pond". I suggest you look up Jose Padilla's story.

    4. Re:stenography by WzDD · · Score: 5, Funny

      RPG values?

      "Bring me my +5 Sword of Information Hiding!"

  2. Redundancy? by Phroggy · · Score: 4, Interesting

    It exploits redundancy in the i386 instruction set by defining sets of functionally equivalent instructions.

    Can someone explain to me exactly what this means? Will all i386 executable binaries have unnecessary redundancy? Could the size of the binary be harmlessly reduced by removing it? If so, then why isn't this done?

    If a message is embedded in a binary with this method, can another message be embedded in the resulting binary the same way, or has the required redundancy already been eliminated?

    --
    $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
    $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    1. Re:Redundancy? by brejc8 · · Score: 4, Informative

      Some instructions have dont care bits in them.
      You could remove these bits in order to compress the file but they occur so rarely its not worth it.
      And yes the redundency would have been used up.

    2. Re:Redundancy? by sql*kitten · · Score: 4, Informative

      Can someone explain to me exactly what this means? Will all i386 executable binaries have unnecessary redundancy? Could the size of the binary be harmlessly reduced by removing it? If so, then why isn't this done?

      It means that if you want to add 50 to a number, you can choose to do (+50) or (-(-50)). They both take up the same amount of space and do the same thing. But if you first process a program to ensure that all additions and subtractions are actually additions, then you can encode data into the list of additions by making some of them into subtractions.

    3. Re:Redundancy? by BenV666 · · Score: 5, Informative
      Can someone explain to me exactly what this means?
      It means exactly what it says, there is more than 1 road that leads to Rome.... combining instructions in different ways leads to the same results.
      Will all i386 executable binaries have unnecessary redundancy?
      Almost everything can be done in several ways. Consider these 2 pieces of asm:
      XOR DX,DX
      MOV AX,3
      MOV BX,4
      MUL BX
      verses
      MOV BX,4
      MOV AX,3
      XOR DX,DX
      MUL BX
      Same results, same size, different order :)
      Could the size of the binary be harmlessly reduced by removing it? If so, then why isn't this done?
      Often the binary can't get much smaller without having effect on efficiency of the code, as far as I trust compilers that is :) (ASM rules!!! :)) I.e.
      MOV AX,A000
      MOV ES,AX
      verses
      PUSH A000
      POP ES
      Same effect while the latter saves 1 byte in code.
    4. Re:Redundancy? by etcpasswd · · Score: 5, Informative
      From my understanding, it appears that he chooses a complentary pair of instructions: addition-subtraction. Then you designate "1" to addition instruction, and "0" to subtraction. So, if you look at only these instructions, your executable can contain a binary string (addition and subtraction instructions).

      Now what the author does is, alter the original binary string to that bit-string data of our interest (of the same length). This process requires flipping of instructions. For example, if some instruction is addition (1), but your data requires it to be (0) bit, you change the instruction to subtraction, and change the operand to a negative of the original value. Same applies to flipping a '0' to '1'.

      Addition-subtraction works because there are no overflow issues (atleast with signed ints). Since this is also a very common operation, your executable is likely to be large enough to "hold" sizeable data.

  3. But detection should be easy... by rediguana · · Score: 4, Insightful

    if you are using a relatively common binary. Then you just have to compare the MD5 checksums against a known-good (known-bad in MSFT's case ;P ) to identify a binary that could possibly contain encrypted data. Would it then be too much harder to go back through and disassemble the two and pick out the differences and hence identify the bits?

    Novel idea though!

  4. How long... by ymgve · · Score: 4, Funny

    ...until somebody embeds "seineeW erA sreenignE epacsteN"?

  5. For those who encounter compilation problems... by Anonymous Coward · · Score: 4, Informative

    Add -ldl to the LDFLAGS in the Makefile.

  6. First used in a86.com by Ninja+Programmer · · Score: 4, Informative

    This is a well known technique that was used in the mid-80s by Eric Isaacson in his product "a86". See here: http://eji.com/a86/

    Eric Isaacson used the technique to mark executables, so that he could determine if they were created with an unregistered copy of a86.

  7. new compression standard: rm -rf by more+fool+you · · Score: 4, Funny

    so how do i add my 6MB ogg to the 526K ls?

  8. Re:You might have gotten hoaxed. by Michael+Dorfman · · Score: 5, Funny

    > Second, and most importantly, the size of the file is dependent on the size of the bytes
    > within the file.

    I don't know about you, but where I come from all bytes are pretty much 8 bits in size.

    >Because the bytes in the file have differing values depending on the instructions they
    >encode, altering the data will alter the size unless you're borrowing from one byte to inflate
    >another -- and in this case, again, you run afoul of the first problem.

    Altering the value of a byte changes its size?
    Man, I need to get me some of them new magic size-changing bytes! Down with the tyranny of 8-bit bytes!

  9. Re:Virus by KDan · · Score: 5, Informative

    Never. The information, though contained in an executable file, is not itself executable (unless you went and took that information out and then executed it separately. The whole point is it does not affect the execution of the program that you hide the information into. So you can put whatever information you want in there (even the code for a virus) and it will still not be a virus, because that information will never get executed unless you actively go in there, extract it, paste it as an executable file somewhere else (eg in memory) and then execute it - so you'd need another virus to do this, basically.

    Daniel

    --
    Carpe Diem
  10. Hiding messages within messages by Bender+Unit+22 · · Score: 4, Informative

    Hiding messages within messages are used often in many contexts, like the radio broadcasts in WW2 sending "birthday greetings" among other things

  11. Re:You might have gotten hoaxed. by ZigMonty · · Score: 4, Informative
    This is technically impossible, for two reasons.

    Did you read the article?

    First, executables are called executables because the computer interprets them. They are made of instructions, and unlike a document you cannot simply tamper with things because it will confuse the computer when it tries to run the executable.

    Of course you can tamper with executables! As long as your modified version does the same thing, there is no harm done. If you change the addition of a positive number to the subtraction of a negative number, you get the same result if you run it. You run through the binary and if the current bit of data to be hidden is a 0, you don't modify that particular addition instruction and if the data bit is 1 then you *do* modify it. If you compare the modified binary to an original, you can see all the changes and extract the hidden data.

    Second, and most importantly, the size of the file is dependent on the size of the bytes within the file. Because the bytes in the file have differing values depending on the instructions they encode, altering the data will alter the size unless you're borrowing from one byte to inflate another -- and in this case, again, you run afoul of the first problem.

    This makes no sense to me. The replacement instruction is the same size as the original.

    I'm surprised the editors didn't review this before approving it for posting. This is really pretty elementary to anyone who understands object code.

    I don't doubt that you understand object code but you don't seem to understand this technique.

  12. Re:You might have gotten hoaxed. by Ninja+Programmer · · Score: 4, Insightful

    I spoke too soon! Actually now that I've read the article myself and dug deeper in the story I realize there is a bigger issue here. The technique used in "Hydan" actually is broken! The ADD and SUB instruction will set the carry flag in opposite directions meaning simple code sequences like:

    A -= 3;
    if (A 0) ...

    Which might be encoded as:

    SUB EAX, 3
    JC ...

    will cease to function correctly!! The technique I cite (which has been proven and used in the a86 assembler) *DOES* work, since you don't change any of the instruction semantics, but just the instruction encodings.

    So in fact, this *IS* yet another bogus story posted by timothy ...

  13. Re:You might have gotten hoaxed. by grahamlee · · Score: 4, Insightful
    I don't know about you, but where I come from all bytes are pretty much 8 bits in size.

    You work with pretty old computers like the IA32 then, and ancient character sets to boot :-P
    Where I come from (which is C), the byte is defined as the smallest addressable unit of store (memory, IOW) that can hold one character from the execution character set (i.e. the number of bits in a char). If I'm using ASCII, then the character set is seven bits wide and the smallest addressable unit of store on an i686 is 8 bits, so the byte would be 8 bits. If I'm using EBCDIC on a computer that can address eight-bit-wide units of store, then the byte is still 8 bits.

    But now consider a computer that can address eight-bit-wide areas of store, but my OS uses 16-bit Unicode. The byte is now 16 bits, as that's the smallest chunk of memory that can hold a single char. Or a computer that deals in 32-bit-wide chunks only, but I'm (for some Godforsaken reason) using Baudot coding as my execution character set. Now my character set only takes up five bits, but as the minimum addressable unit of store is 32 bits wide, the byte has to be 32 bits.

    Man, I need to get me some of them new magic size-changing bytes! Down with the tyranny of 8-bit bytes!

    A common misconception is to think that the byte and the octet are interchangable concepts. They aren't. The octet is eight bits, the byte is defined as above (see the ISO C99 standard, for example). It's probable that every system you've used has an 8-bit byte; but don't start thinking that's a universal concept.

  14. Yes, it can be done... by CoderByBirth · · Score: 4, Funny

    ...but why?
    Why would I want to hide messages in my executable files?
    Because I'm a secret little squirrel who just in general likes to hide stuff, like INSIDE other stuff?

  15. Re:Difficult part, code, data, format by Oswald · · Score: 4, Interesting
    I would recon you would need to be able to disassemble the whole thing before being able to make modifications.

    Yes, it does that.

  16. Wrong product by Mostly+a+lurker · · Score: 5, Funny
    ...the Declaration of Independence in a single copy of Microsoft Word

    Surely, a declaration of independence should be stored in a non Microsoft product.

  17. Re:The problem is if you have two copies by Reziac · · Score: 4, Funny

    "Of course just like in the film 'A Beutiful Mind', you could just end up seeing encrypted data left right and center, whether or not it is really there."

    On second thought, I have another idea: make a huge file that is nothing but stenographic data. Hide an executable in it. ;)

    Actually, for stuff like DeCSS, that may not be so farfetched. :/

    --
    ~REZ~ #43301. Who'd fake being me anyway?
  18. I do this already! by zulux · · Score: 4, Funny


    I hide all sorts of stuff in my C comments.
    Nobody can detect them in my executables.
    HA! I'm so sneaky!

    --

    Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.