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.

Join the CSO newsletter!

Error: Please check your email address.

Tags securitySucuri

More about CMSCSOIPS

Show Comments

Featured Whitepapers

Editor's Recommendations

Solution Centres

Stories by Steve Ragan

Latest Videos

  • 150x50

    CSO Webinar: Will your data protection strategy be enough when disaster strikes?

    Speakers: - Paul O’Connor, Engagement leader - Performance Audit Group, Victorian Auditor-General’s Office (VAGO) - Nigel Phair, Managing Director, Centre for Internet Safety - Joshua Stenhouse, Technical Evangelist, Zerto - Anthony Caruana, CSO MC & Moderator

    Play Video

  • 150x50

    CSO Webinar: The Human Factor - Your people are your biggest security weakness

    ​Speakers: David Lacey, Researcher and former CISO Royal Mail David Turner - Global Risk Management Expert Mark Guntrip - Group Manager, Email Protection, Proofpoint

    Play Video

  • 150x50

    CSO Webinar: Current ransomware defences are failing – but machine learning can drive a more proactive solution

    Speakers • Ty Miller, Director, Threat Intelligence • Mark Gregory, Leader, Network Engineering Research Group, RMIT • Jeff Lanza, Retired FBI Agent (USA) • Andy Solterbeck, VP Asia Pacific, Cylance • David Braue, CSO MC/Moderator What to expect: ​Hear from industry experts on the local and global ransomware threat landscape. Explore a new approach to dealing with ransomware using machine-learning techniques and by thinking about the problem in a fundamentally different way. Apply techniques for gathering insight into ransomware behaviour and find out what elements must go into a truly effective ransomware defence. Get a first-hand look at how ransomware actually works in practice, and how machine-learning techniques can pick up on its activities long before your employees do.

    Play Video

  • 150x50

    CSO Webinar: Get real about metadata to avoid a false sense of security

    Speakers: • Anthony Caruana – CSO MC and moderator • Ian Farquhar, Worldwide Virtual Security Team Lead, Gigamon • John Lindsay, Former CTO, iiNet • Skeeve Stevens, Futurist, Future Sumo • David Vaile - Vice chair of APF, Co-Convenor of the Cyberspace Law And Policy Community, UNSW Law Faculty This webinar covers: - A 101 on metadata - what it is and how to use it - Insight into a typical attack, what happens and what we would find when looking into the metadata - How to collect metadata, use this to detect attacks and get greater insight into how you can use this to protect your organisation - Learn how much raw data and metadata to retain and how long for - Get a reality check on how you're using your metadata and if this is enough to secure your organisation

    Play Video

  • 150x50

    CSO Webinar: How banking trojans work and how you can stop them

    CSO Webinar: How banking trojans work and how you can stop them Featuring: • John Baird, Director of Global Technology Production, Deutsche Bank • Samantha Macleod, GM Cyber Security, ME Bank • Sherrod DeGrippo, Director of Emerging Threats, Proofpoint (USA)

    Play Video

More videos

Blog Posts

Market Place