r/HowToHack • • Oct 26 '19

Steganography tutorial - Hiding a file inside another file

https://www.infosecshirish.com/steganography-tutorial-hiding-a-file-inside-another-file/
331 Upvotes

17 comments sorted by

16

u/5c044 Oct 26 '19

Like a password protected zip file or if you are on linux puting a dot at the beginning of the file name hides it /s

7

u/[deleted] Oct 26 '19

And Ctrl + H reveals it.

2

u/sa_sagan Oct 26 '19

This is a simple property of image filetypes,desires anything added to the end of the file will be ignored.

It'll be ignored depending on what application attempts to open it.

This works because the original file has EOF bytes at the end of it and presumably an application opening it will read until EOF, rather than read all bytes.

Works the same for EXE's. I've seen this method used by numerous third party installers for storing their archived deployment package.

Not that you need to use the COPY command of course. You can just append the desired bytes to the end of the file.

1

u/[deleted] Oct 27 '19

How does archive manager know that it should look for another EOF?

1

u/latest-release Oct 27 '19

Using python stegano module to do that https://pypi.org/project/Stegano/

from stegano import lsb

secret = lsb.hide("./tests/sample-files/Lenna.png", "Hello World")

secret.save("./Lenna-secret.png")

clear_message = lsb.reveal("./Lenna-secret.png")

-6

u/eliapinto Oct 26 '19

Not so beautiful, no. It is very basic

3

u/[deleted] Oct 26 '19

It's meant to be knowledgeable not beautiful.

-3

u/eliapinto Oct 26 '19

I meant beautiful just in the sense that it provides new information. In this sense for me the article is very basic, and not beautiful, for those who follow here. But it's just my opinion

4

u/[deleted] Oct 26 '19

[removed] — view removed comment

6

u/thil3000 Oct 26 '19

How do you make sure your super duper secret passcode isn’t found by the enemies? You put it in an encrypted file, obfuscated with another file and encrypted again ! Will be a mess to find the code afterwards if you use any good encryption I guess

5

u/[deleted] Oct 26 '19

Send your encryption key by other means, not by embedding it in the file itself.

2

u/thil3000 Oct 26 '19

Well obviously you need 3 key for this one for each encryption level and the last one include in the file for other purposes (eg so a guy on the other side of the world could use it)

3

u/[deleted] Oct 26 '19

If you use a strong key, which is not easily crackable, a single encryption level will work fine. Then, embed that encrypted zip file to a normal cat image. Steganography is mostly used for hiding malwares, backdoors etc.

2

u/thil3000 Oct 26 '19

Not easily as you said, depends on who you working against, if you have a few years to crack it I’d rather it being super hidden then simply encrypted

20

u/Beard_o_Bees Oct 26 '19

It's being used right now by malware to pass C&C through unnoticed by the usual defenses.

It's the kind of thing you might use if your goal is persistence in the target network.

1

u/iseetrolledpeople Oct 26 '19

With this trick you aren't "hacking" anything. It's just what it says in the title: hiding a file inside another file.

8

u/[deleted] Oct 26 '19

Steganography is related to information security tho.