Security Researcher Hides ZIP, MP3 Files Inside PNG Files on Twitter

stepanography APT

The newly discovered steganography method could be exploited by threat actors to obscure nefarious activity inside photos hosted on the social-media platform.

A security researcher has discovered a novel steganography technique for hiding data inside a Portable Network Graphics (.PNG) image file posted on Twitter, a tactic that could be exploited by threat actors to hide malicious activity.

Researcher David Buchanan heralded his discovery on Twitter earlier this week, accompanied by a photo declaring: “Save this image and change the extension to .zip!”

He made the source code for his method available in a ZIP/PNG file attached to the image as well as on a post on GitHub that explains his methodology.
Specifically, Buchanan demonstrated how he could hide both MP3 audio files and ZIP archives within the PNG images hosted on Twitter. The reason he was successful is because while Twitter strips unnecessary data from PNG uploads, they don’t remove trailing data from the DEFLATE stream inside the IDAT chunk if the overall image file meets the requirements to avoid being re-encoded, he explained.

Buchanan’s finding is important because threat actors have found digital steganography, or the art of hiding information inside media, a useful method especially for obscuring malicious files or other activity, including communication between command and control servers. If his method is successful, it can give attackers another way to hide in hosted images on a widely used social media platform.

The finding also comes on the heels of a discovery by researchers at website security firm Sucuri that Magecart attackers began hiding sensitive data they’ve skimmed from credit cards online inside .JPG files on a website they’ve injected with malicious code.

Certain Conditions

There are some requirements for both the images used to obscure files and the files being hidden inside them for his method to work, Buchanan explained.

“The cover image must compress well, such that the compressed filesize is less than (width * height) – size_of_embedded_file,” he wrote in his post. “If the cover image does not have a palette, then it must have at least 257 unique colors (otherwise Twitter will optimise it to use a palette).”

Resolution on images can be up to 4096 x 4096, although Twitter will serve a downscaled version by default for images greater than 680 x 680 depending on certain factors, Buchanan wrote. The image also should not have any unnecessary “metadata chunks,” he added.

For embedded files, the total output file size must be less than potentially 5MB, but kept under 3MB to be on the safe side, otherwise Twitter will convert the PNG to a JPEG file, Buchanan explained.

Moreover, if the embedded file is a ZIP, then the offsets are automatically adjusted so that the overall file is still a valid ZIP, he said.

“For any other file formats, you’re on your own,” Buchanan added, noting that many will work without special parameters, including PDF and MP3 files.

Proof of Concept

While Threatpost did not download and follow Buchanan’s instructions for demonstrating the files, BleepingComputer did and reported the results.

The original 6KB image Buchanan tweeted with the declaration of his finding–once opened and its file format changed to ZIP–contained an entire ZIP archive with his source code that anyone can use to pack miscellaneous contents into a PNG image, according to the report.

Buchanan also posted another photo to Twitter that he asked people to download, renamed to .mp3 and open in the program VLC “for a surprise,” according to BleepingComputer.

Once opened, the image file, once turned into an MP3 file using Buchanan’s method, would start playing the song “Never Gonna Give You Up” by Rick Astley, according to the report.

Buchanan posted yet another file to prove his point, an image of the Bard, William Shakespeare, which he said is a valid ZIP archive containing a multipart RAR archive with the complete works of Shakespeare embedded within.

The researcher said tried to report the issue to Twitter’s bug bounty program, but was told that it’s not actually a bug. “Fair enough, but that just means we can have some fun with it,” Buchanan tweeted.

Register for this LIVE Event: 0-Day Disclosures: Good, Bad & Ugly: On Mar. 24 at 2 p.m. ET, Threatpost tackles how vulnerability disclosures can pose a risk to companies. To be discussed, Microsoft 0-days found in Exchange Servers. Join 0-day hunters from Intel Corp. and veteran bug bounty researchers who will untangle the 0-day economy and unpack what’s on the line for all businesses when it comes to the disclosure process. Register NOW for this LIVE webinar on Wed., Mar. 24.

Suggested articles

Discussion

Leave A Comment

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our newsletter, Threatpost Today!

Get the latest breaking news delivered daily to your inbox.