將隱藏的數據嵌入到圖像中 (Embed Hidden Data Into an Image)

Posted in :

看到一則新聞內容寫:

Witchetty還採用了新工具Backdoor.Stegmap,可利用圖像隱碼技術自點陣圖(BMP)影像中汲取酬載,將惡意程式藏匿在看似無害的點陣圖中,就能矇騙受害者,駭客可光明正大地將它們置放於諸如GitHub等各種可靠及免費的服務上,讓被入侵者更不容易被察覺。
駭客於BMP檔中所嵌入的惡意酬載更是一個具備完整功能的後門程式,它能建立/移除目錄,也能複製/移動/刪除檔案,還能啟用/關閉程序,自遠端主機下載與執行檔案,讀取/建立/刪除登錄機碼,或是竊取檔案等。

查了一下,最簡單的是 bmp 檔可以放資料,基本的 DOS 指令就可以完成 24bit 格式的 bmp 檔附加內容:

copy your-file.bmp/b + hidden.txt/a your-file-Modify1.bmp

如果你以為只有bmp 檔可以放置額外的資訊就錯了,因為只要是不失真的檔案,一樣可以把要隱藏的資料放在肉眼無法輕易察覺出來的圖檔的頻道中,例如:

Using Cryptosteganography is very easy. The module can be used as a library inside a Python program or as shell command-line program.

使用密碼隱寫術非常容易。 可以用Python 的第三方套件或Shell指行完成。

You need to have pip installed, the Python Package Installer, which can be done following these instructions. Note that on most modern Linux systems, Python and pip come installed with the OS by default.

安裝pip 之後, Python Package Installer,可以按照下列指令取得Cryptosteganography

After this, run the command below to install Cryptosteganography from the terminal:

$ pip3 install cryptosteganography 

For example, in order to embed data in an image, type the command below.

Save message example
將訊息嵌入原始圖像範例:

$ cryptosteganography save -i 4824157.png -m "My secret message..." -o output.png
Enter the key password:
Output image output.png saved with success

Retrieve message example
從加密圖像還原訊息範例:

$ cryptosteganography retrieve -i output.png
Enter the key password:
My secret message...

Save file example
將檔案嵌入原始圖像範例:

$ cryptosteganography save -i input_image_name.jpg -f duck_logo.pem -o output_file.png
Enter the key password:
Output image output_file.png saved with success

Retrieve file example
從加密圖像還原檔案範例:

$ cryptosteganography retrieve -i output.png -o decrypted_file
Enter the key password:
decrypted_file saved with success

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *