hacktricks/stego/stego-tricks.md

247 lines
11 KiB
Markdown
Raw Normal View History

2022-06-06 22:28:05 +00:00
# Stego Tricks
2022-04-28 16:01:33 +00:00
<details>
2024-01-01 17:15:42 +00:00
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-01-01 17:15:42 +00:00
Other ways to support HackTricks:
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
2022-09-30 10:27:15 +00:00
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
2024-01-01 17:15:42 +00:00
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.**
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
<figure><img src="../.gitbook/assets/image (675).png" alt=""><figcaption></figcaption></figure>
2022-06-06 22:28:05 +00:00
2023-09-02 23:48:41 +00:00
Find vulnerabilities that matter most so you can fix them faster. Intruder tracks your attack surface, runs proactive threat scans, finds issues across your whole tech stack, from APIs to web apps and cloud systems. [**Try it for free**](https://www.intruder.io/?utm\_source=referral\&utm\_campaign=hacktricks) today.
2022-05-01 16:32:23 +00:00
2023-09-02 23:48:41 +00:00
{% embed url="https://www.intruder.io/?utm_campaign=hacktricks&utm_source=referral" %}
***
2024-02-08 21:36:35 +00:00
## **Extracting Data from Files**
2024-02-08 21:36:35 +00:00
### **Binwalk**
A tool for searching binary files for embedded hidden files and data. It's installed via `apt` and its source is available on [GitHub](https://github.com/ReFirmLabs/binwalk).
```bash
binwalk file # Displays the embedded data
binwalk -e file # Extracts the data
binwalk --dd ".*" file # Extracts all data
```
2024-02-08 21:36:35 +00:00
### **Foremost**
Recovers files based on their headers and footers, useful for png images. Installed via `apt` with its source on [GitHub](https://github.com/korczis/foremost).
```bash
foremost -i file # Extracts data
```
2024-02-08 21:36:35 +00:00
### **Exiftool**
Helps to view file metadata, available [here](https://www.sno.phy.queensu.ca/~phil/exiftool/).
```bash
exiftool file # Shows the metadata
```
2024-02-08 21:36:35 +00:00
### **Exiv2**
Similar to exiftool, for metadata viewing. Installable via `apt`, source on [GitHub](https://github.com/Exiv2/exiv2), and has an [official website](http://www.exiv2.org/).
```bash
exiv2 file # Shows the metadata
```
2020-12-22 15:21:39 +00:00
2024-02-08 21:36:35 +00:00
### **File**
Identify the type of file you're dealing with.
2020-12-22 15:21:39 +00:00
2024-02-08 21:36:35 +00:00
### **Strings**
Extracts readable strings from files, using various encoding settings to filter the output.
```bash
strings -n 6 file # Extracts strings with a minimum length of 6
strings -n 6 file | head -n 20 # First 20 strings
strings -n 6 file | tail -n 20 # Last 20 strings
strings -e s -n 6 file # 7bit strings
strings -e S -n 6 file # 8bit strings
strings -e l -n 6 file # 16bit strings (little-endian)
strings -e b -n 6 file # 16bit strings (big-endian)
strings -e L -n 6 file # 32bit strings (little-endian)
strings -e B -n 6 file # 32bit strings (big-endian)
2022-06-06 22:28:05 +00:00
```
2024-02-08 21:36:35 +00:00
### **Comparison (cmp)**
Useful for comparing a modified file with its original version found online.
```bash
2020-12-22 15:21:39 +00:00
cmp original.jpg stego.jpg -b -l
```
2024-02-08 21:36:35 +00:00
## **Extracting Hidden Data in Text**
2024-02-08 21:36:35 +00:00
### **Hidden Data in Spaces**
Invisible characters in seemingly empty spaces may hide information. To extract this data, visit [https://www.irongeek.com/i.php?page=security/unicode-steganography-homoglyph-encoder](https://www.irongeek.com/i.php?page=security/unicode-steganography-homoglyph-encoder).
2024-02-08 21:36:35 +00:00
***
<figure><img src="../.gitbook/assets/image (3) (1) (1) (1) (1).png" alt=""><figcaption></figcaption></figure>
2022-06-06 22:28:05 +00:00
2023-01-01 16:19:07 +00:00
\
Use [**Trickest**](https://trickest.com/?utm\_campaign=hacktrics\&utm\_medium=banner\&utm\_source=hacktricks) to easily build and **automate workflows** powered by the world's **most advanced** community tools.\
2023-01-01 16:19:07 +00:00
Get Access Today:
2023-01-01 16:19:07 +00:00
{% embed url="https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks" %}
2022-06-06 22:28:05 +00:00
2024-02-08 21:36:35 +00:00
***
2022-06-06 22:28:05 +00:00
2024-02-08 21:36:35 +00:00
## **Extracting Data from Images**
2024-02-08 21:36:35 +00:00
### **Identifying Image Details with GraphicMagick**
2020-12-21 20:59:47 +00:00
2024-02-08 21:36:35 +00:00
[GraphicMagick](https://imagemagick.org/script/download.php) serves to determine image file types and identify potential corruption. Execute the command below to inspect an image:
```bash
2020-12-21 20:59:47 +00:00
./magick identify -verbose stego.jpg
```
2024-02-08 21:36:35 +00:00
To attempt repair on a damaged image, adding a metadata comment might help:
2020-12-21 20:59:47 +00:00
```bash
./magick mogrify -set comment 'Extraneous bytes removed' stego.jpg
```
2024-02-08 21:36:35 +00:00
### **Steghide for Data Concealment**
2024-02-08 21:36:35 +00:00
Steghide facilitates hiding data within `JPEG, BMP, WAV, and AU` files, capable of embedding and extracting encrypted data. Installation is straightforward using `apt`, and its [source code is available on GitHub](https://github.com/StefanoDeVuono/steghide).
2024-02-08 21:36:35 +00:00
**Commands:**
- `steghide info file` reveals if a file contains hidden data.
- `steghide extract -sf file [--passphrase password]` extracts the hidden data, password optional.
2024-02-08 21:36:35 +00:00
For web-based extraction, visit [this website](https://futureboy.us/stegano/decinput.html).
2024-02-08 21:36:35 +00:00
**Bruteforce Attack with Stegcracker:**
- To attempt password cracking on Steghide, use [stegcracker](https://github.com/Paradoxis/StegCracker.git) as follows:
2024-02-08 21:36:35 +00:00
```bash
stegcracker <file> [<wordlist>]
```
2024-02-08 21:36:35 +00:00
### **zsteg for PNG and BMP Files**
2024-02-08 21:36:35 +00:00
zsteg specializes in uncovering hidden data in PNG and BMP files. Installation is done via `gem install zsteg`, with its [source on GitHub](https://github.com/zed-0xff/zsteg).
2024-02-08 21:36:35 +00:00
**Commands:**
- `zsteg -a file` applies all detection methods on a file.
- `zsteg -E file` specifies a payload for data extraction.
2024-02-08 21:36:35 +00:00
### **StegoVeritas and Stegsolve**
2024-02-08 21:36:35 +00:00
**stegoVeritas** checks metadata, performs image transformations, and applies LSB brute forcing among other features. Use `stegoveritas.py -h` for a full list of options and `stegoveritas.py stego.jpg` to execute all checks.
2024-02-08 21:36:35 +00:00
**Stegsolve** applies various color filters to reveal hidden texts or messages within images. It's available on [GitHub](https://github.com/eugenekolo/sec-tools/tree/master/stego/stegsolve/stegsolve).
2024-02-08 21:36:35 +00:00
### **FFT for Hidden Content Detection**
2024-02-08 21:36:35 +00:00
Fast Fourier Transform (FFT) techniques can unveil concealed content in images. Useful resources include:
2024-02-08 21:36:35 +00:00
- [EPFL Demo](http://bigwww.epfl.ch/demo/ip/demos/FFT/)
- [Ejectamenta](https://www.ejectamenta.com/Fourifier-fullscreen/)
- [FFTStegPic on GitHub](https://github.com/0xcomposure/FFTStegPic)
2024-02-08 21:36:35 +00:00
### **Stegpy for Audio and Image Files**
2024-02-08 21:36:35 +00:00
Stegpy allows embedding information into image and audio files, supporting formats like PNG, BMP, GIF, WebP, and WAV. It's available on [GitHub](https://github.com/dhsdshdhk/stegpy).
2024-02-08 21:36:35 +00:00
### **Pngcheck for PNG File Analysis**
2024-02-08 21:36:35 +00:00
To analyze PNG files or to validate their authenticity, use:
2024-02-08 21:36:35 +00:00
```bash
apt-get install pngcheck
pngcheck stego.png
```
2024-02-08 21:36:35 +00:00
### **Additional Tools for Image Analysis**
2024-02-08 21:36:35 +00:00
For further exploration, consider visiting:
2024-02-08 21:36:35 +00:00
- [Magic Eye Solver](http://magiceye.ecksdee.co.uk/)
- [Image Error Level Analysis](https://29a.ch/sandbox/2012/imageerrorlevelanalysis/)
- [Outguess](https://github.com/resurrecting-open-source-projects/outguess)
- [OpenStego](https://www.openstego.com/)
- [DIIT](https://diit.sourceforge.net/)
2024-02-08 21:36:35 +00:00
## **Extracting Data from Audios**
2024-02-08 21:36:35 +00:00
**Audio steganography** offers a unique method to conceal information within sound files. Different tools are utilized for embedding or retrieving hidden content.
2024-02-08 21:36:35 +00:00
### **Steghide (JPEG, BMP, WAV, AU)**
Steghide is a versatile tool designed for hiding data in JPEG, BMP, WAV, and AU files. Detailed instructions are provided in the [stego tricks documentation](stego-tricks.md#steghide).
2024-02-08 21:36:35 +00:00
### **Stegpy (PNG, BMP, GIF, WebP, WAV)**
This tool is compatible with a variety of formats including PNG, BMP, GIF, WebP, and WAV. For more information, refer to [Stegpy's section](stego-tricks.md#stegpy-png-bmp-gif-webp-wav).
2024-02-08 21:36:35 +00:00
### **ffmpeg**
ffmpeg is crucial for assessing the integrity of audio files, highlighting detailed information and pinpointing any discrepancies.
```bash
ffmpeg -v info -i stego.mp3 -f null -
```
2024-02-08 21:36:35 +00:00
### **WavSteg (WAV)**
WavSteg excels in concealing and extracting data within WAV files using the least significant bit strategy. It is accessible on [GitHub](https://github.com/ragibson/Steganography#WavSteg). Commands include:
```bash
python3 WavSteg.py -r -b 1 -s soundfile -o outputfile
2024-02-08 21:36:35 +00:00
python3 WavSteg.py -r -b 2 -s soundfile -o outputfile
```
2024-02-08 21:36:35 +00:00
### **Deepsound**
Deepsound allows for the encryption and detection of information within sound files using AES-256. It can be downloaded from [the official page](http://jpinsoft.net/deepsound/download.aspx).
2024-02-08 21:36:35 +00:00
### **Sonic Visualizer**
An invaluable tool for visual and analytical inspection of audio files, Sonic Visualizer can unveil hidden elements undetectable by other means. Visit the [official website](https://www.sonicvisualiser.org/) for more.
2024-02-08 21:36:35 +00:00
### **DTMF Tones - Dial Tones**
Detecting DTMF tones in audio files can be achieved through online tools such as [this DTMF detector](https://unframework.github.io/dtmf-detect/) and [DialABC](http://dialabc.com/sound/detect/index.html).
2024-02-08 21:36:35 +00:00
## **Other Techniques**
2024-02-08 21:36:35 +00:00
### **Binary Length SQRT - QR Code**
Binary data that squares to a whole number might represent a QR code. Use this snippet to check:
```python
import math
math.sqrt(2500) #50
```
2024-02-08 21:36:35 +00:00
For binary to image conversion, check [dcode](https://www.dcode.fr/binary-image). To read QR codes, use [this online barcode reader](https://online-barcode-reader.inliteresearch.com/).
### **Braille Translation**
For translating Braille, the [Branah Braille Translator](https://www.branah.com/braille-translator) is an excellent resource.
2022-05-01 16:32:23 +00:00
2022-06-06 22:28:05 +00:00
## **References**
2022-05-01 16:32:23 +00:00
2022-06-06 22:28:05 +00:00
* [**https://0xrick.github.io/lists/stego/**](https://0xrick.github.io/lists/stego/)
* [**https://github.com/DominicBreuker/stego-toolkit**](https://github.com/DominicBreuker/stego-toolkit)
<figure><img src="../.gitbook/assets/image (675).png" alt=""><figcaption></figcaption></figure>
2022-04-28 16:01:33 +00:00
2023-09-02 23:48:41 +00:00
Find vulnerabilities that matter most so you can fix them faster. Intruder tracks your attack surface, runs proactive threat scans, finds issues across your whole tech stack, from APIs to web apps and cloud systems. [**Try it for free**](https://www.intruder.io/?utm\_source=referral\&utm\_campaign=hacktricks) today.
{% embed url="https://www.intruder.io/?utm_campaign=hacktricks&utm_source=referral" %}
2022-06-06 22:28:05 +00:00
2022-04-28 16:01:33 +00:00
<details>
2024-01-01 17:15:42 +00:00
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-01-01 17:15:42 +00:00
Other ways to support HackTricks:
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
2022-09-30 10:27:15 +00:00
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
2024-01-01 17:15:42 +00:00
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.**
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>