7

画像ファイル内のファイル数を非表示にする方法を示すリンクに出くわしました: http://lifehacker.com/282119/hide-files-inside-of-jpeg-imagesここで検出に関する詳細な議論: http://ask .metafilter.com/119943/How-to-detect-RARsEXEs-hidden-in-JPGs

画像ファイルに他のファイルが隠されているかどうかをプログラムで検出する良い方法を見つけようとしていますか? ファイルを解凍して、他のファイルが出てくるかどうかを確認する必要がありますか?

私はプログラムに縛られていませんが、JVM でうまく動作するものは素晴らしいでしょう。

アップデート

1 つのアプローチ:

この作品のようなものはありますか(メタフィルターの誰かによって提案されています)

$ cat orig.jpg test.zip > stacked.jpg
$ file stacked.jpg 
stacked.jpg: JPEG image data, JFIF standard 1.01
$ convert stacked.jpg stripped.jpg  # this is an ImageMagick command
$ ls -l
 11483 orig.jpg
322399 stacked.jpg
 11484 stripped.jpg
310916 test.zip

このアプローチには JMagick を使用できます。

4

3 に答える 3

2

Great question!

If all you want to check for is a RAR or ZIP file appended to the end of an image file, then running it through the unrar or unzip command is the easiest way to do it.

If you want a faster but less exact check, you can check for some of the special file format signatures that indicate certain types of files. The usual UNIX tool to identify file format is file. It uses a database of binary file signatures, whose format is defined in the magic(5) man page. It won’t find a RAR file for you at the end of a JPEG, because it only looks at the start of files to try to identify them quickly, but you might be able to modify its source code to do what you want. You could also reuse its database of file signatures. If you look at the archive file part of its database in the Rar files section, it shows this:

# RAR archiver (Greg Roelofs, newt@uchicago.edu)
0   string      Rar!        RAR archive data,

which indicates that if your JPEG file contains the four bytes Rar! that would be suspicious. But you would have to examine the Rar file format spec in detail to check whether more of the Rar file structure is present to avoid false positives—this web page also contains the four bytes Rar! but there are no hidden files attached to it :P

But if someone knows the details of your automated checks, they could easily work around them. The simplest workaround would be to reverse all the bytes of the files before appending them to the JPEG. Then none of your signatures would catch the reversed version of the file.


If someone really wants to hide a file inside an image, there are all sorts of ways to do that that you won’t be able to detect easily. The general term for this is “steganography.” The Wikipedia page, for example, shows a picture of trees that has a picture of a cat hidden inside it. For simpler steganographic methods, there are statistical tests that can indicate something funny has been done to a picture, but if someone spends a lot of time to come up with their own method to hide other files inside images, you won’t be able to detect it.

于 2013-01-22T04:11:31.090 に答える
0

You could search for the file signature. http://en.wikipedia.org/wiki/List_of_file_signatures e.g. for 7z file the sigature is 37 7A BC AF 27 1C for rar files it's 52 61 72 21 1A 07 00 and for zip it's 50 4B 03 04 Take a look at a compressed file in a hex editor e.g. HxD

于 2013-01-22T04:14:17.307 に答える
0

ファイルにメタデータやその他の情報が追加されているかどうかを確認するには、画像をデコードして再エンコードし、サイズが劇的に減少するかどうかを確認します。JPEG ファイルの場合、元の DCT データを保持する可逆回転のような処理を行う必要があります。そうしないと、エンコードの違いだけでファイル サイズが変わる可能性があります。

より小さな結果は、隠されたデータの証拠にはなりませんが、詳しく調べる必要があることを示しています。

質問をする動機をあなたが共有したことはありませんが、公開サイトに画像をダウンロードするためだと思います。その場合、送信された画像に余分なデータが含まれているかどうかを本当に気にする必要はありません。関係なく、入力をクレンジングする必要があります。これには、デコード/再エンコードのプロセスが最適です。

于 2013-01-22T03:56:21.423 に答える