Server Compromises – Understanding Apache Module iFrame Injections and Secure Shell Backdoor

There are many ways to inject a malicious payload onto a website. The attacker can modify any of the web files (index.php for example), the .htaccess file or php.ini (if the site is using PHP). There are other ways, but those are the most common methods, specially on shared hosts.

However, for the last year, we started to see a new way to inject malware on compromised servers via a malicious Apache module. We posted about it before and it has been covered on many other mediums. After a few months of tracking them, and working on multiple servers that had this issue, we want to share a bit of what we have learned.

Identifying the injection

First, a good way to identify if an infection is coming via the Apache module compromise is by looking at how the iframe is being inserted. They seem to always follow this pattern:

<style<.t1nhuhjv { position:absolute; left:-1619px; top:-1270px} </style> <div class=”t1nhuhjv”><iframe
src="httx://qotive." width=”534″ height=”556″> </iframe></div>


<style>.q6umct6stl { position:absolute; left:-1284px; top:-1774px} </style> <div class="q6umct6stl”><iframe
src="httx://nujifa." width="367" height="411"></iframe></div>

The domain name changes very often (IP is often, as does the div class name and the iframe sizes. These are some of the domains we have tracked:

or ( ( ( ( ( ( ( ( ( ( ( (

Early on they were using .net’s and .info’s domains and recently switched to using domains from Change IP (, and others). Another interesting point is that since was disabled, we have started seeing many attacks using Change IP:

Apache Module

The attackers are modifying the httpd.conf file (or any configuration file inside /etc/httpd/conf.d) and insert a line to inject their own modules:

LoadModule pool_mem_module /lib64/


LoadModule bench_proxy_module /lib64/


LoadModule string_log_module /usr/lib/

The module names and location are pretty random and their md5 checksums also seems to change often:


However, once loaded, they inject an iframe at the top of the site once per day per IP address and only to certain user agents. That makes discovering and tracking the malware much more difficult.

Dennis (from Unmaskparasites) was able to find the source code for these modules, and posted on his blog: Malicious Apache Module Injects Iframes, so we won’t go into more unnecessary details here as he covered it very well.

A good way to identify if you have any non standard module is by running the rpm command and checking the integrity of the files:

# rpm -qf /lib64/*
# rpm -qf /usr/lib/*
# rpm -qf /etc/httpd/modules/*

If you find any module that is not part of any package (not owned by anyone), it is a good red flag that this module was added by the attackers.

SSHD binary

Another part of the compromise that we haven’t seen mentioned anywhere else is how the attackers keep access to the owned servers. We have noticed that they are modifying all SSH binaries and inserted a version that gives them full access back to the server. The modifications not only allow them to remote into the server bypassing existing authentication controls, but also allow them to steal all SSH authentications and push it to their remote servers.

A good way to identify this is to run the rpm -Va command to see all file changes. If SSHD has been modified, you would see this error:

S.5…… /usr/bin/scp
S.5…… /usr/bin/sftp
S.5…… /usr/bin/ssh
S.5…… /usr/bin/sshd
S.5…… /usr/bin/ssh-add
S.5…… /usr/bin/ssh-keyscan
S.5…… /usr/bin/ssh-keygen

We ran the sshd binary through virus total and 0 (none) out of 46 anti virus engines flagged it:

We were not able to fully inspect the modified SSH binaries yet, but it seems to do 2 things:

  • Every time some one logins to the server, it sends the host/user/pass to or
  • Every time someone uses the ssh binary, it also sends the host/user/pass to

Allowing them to maintain their access and spread to other servers that are accessed from the compromised box.


We are still tracking and monitoring this type of infection, so expect more updates soon. If you have any details to share, please let us know.

  1. Nice article … but this is only for RedHat/Centos/Fedora Servers … how can you check this in a debian based server ? thank you.

  2. It’s very important that when these scenarios happens, you must immediately identify the cause, the source and a possible solution for the infection. We must always be cautious and vigilant because hackers/viruses are just around the corner waiting to strike.

Comments are closed.

You May Also Like