We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message
80,259 News Articles

Attackers embedding backdoors into image files

Hackers are using a way to maintain access to an already compromised server by hiding backdoors inside headers of legitimate image files

Researchers at Sucuri, a firm focused on website security awareness and attack recovery, have discovered attackers using a known, but a rather uncommon method of maintaining access to an already compromised server: They're hiding backdoors inside the headers of legitimate image files.

Daniel Cid, Sucuri's CTO, told CSO in an interview that the company has discovered more than a dozen sites that have been impacted by this method of attack. However, he didn't mention if there was any evidence to connect all of them to a single source. At present, the company is still investigating while they work with their clients.

[3 questions about Wordpress security]

The images were discovered on a previously compromised webserver. Cid told CSO during a phone conversation that in the cases they've seen so far, including the 'bun.jpg' case that was covered on the Sucuri blog, the website was either running an outdated version of WordPress (a popular CMS platform used by millions of domains), or outdated versions of Joomla, which is an alternate platform similar to WordPress.

The images themselves "still load and work properly," Cid said.

"In fact," he adds in the blog post, "on these compromised sites, the attackers modified a legit, pre-existent image from the site. This is a curious steganographic way to hide the malware."

Once the server is compromised, the attackers will modify the image's EXIF headers and re-upload the image. At this sage, the image renders normally, and most webmasters won't notice anything off. However, should the compromise be discovered and the server's security tightened, the image provides a firm hold that the attackers will later use in order to regain access.

Using the exif_read_data function in PHP to read the image's headers, and the preg_replace function to execute the embedded commands; the attackers can keep control over a webserver long after the vulnerable software and the server's other core files have been patched. This happens because the image's MAKE header has "/.*/e" as a keyword -- this is the 'eval' modifier, which is used to execute the content fed to preg_replace.

Once the header was parsed, Sucuri's researchers discovered base64 encoded lines, that when decoded offered the final part to the backdoor itself, a function that will execute any content delivered to it via POST. Using this, an attacker can issue commands, or call for shell scripts hosted remotely and execute them. Moreover, depending on how the server is configured, the commands issued to the backdoor could be running with elevated privileges.

[Tactics of Wordpress attackers similar to bank assaults]

Cid explained that the backdoors were discovered during memory examinations after a client requested help recovering from a breach. When questioned about detection, he added that unless modified to detect these kinds of patterns within a given file, IDS and IPS systems wouldn't have prevented this type of attack.

"The thing I recommend the most is file integrity monintoring," Cid told CSO. "If you can detect files being modified, then you can discover this type of attack."

He also noted that it is possible to watch log files for command instances, such as file creation and modification. However, the key point is to stay on top of updates, especially for platforms such as WordPress and Joomla, which are popular targets for attackers and constantly updated in order to address security concerns.

IDG UK Sites

Best camera phone of 2015: iPhone 6 Plus vs LG G4 vs Galaxy S6 vs One M9 vs Nexus 6

IDG UK Sites

In defence of BlackBerrys

IDG UK Sites

Why we should reserve judgement on Apple ditching Helvetica in OS X/iOS for the Apple Watch's San...

IDG UK Sites

Retina 3.3GHz iMac 27in preview: Apple cuts £400 of price of Retina iMac with new model