Home > Apache > ZmEu attacks: Some basic forensic

ZmEu attacks: Some basic forensic

One day you may find a bunch of requests in a short period of time with unusual and suspicious user agent in your Apache web server’s logs. Something like Made by ZmEu @ WhiteHat Team – http://www.whitehat.ro or ZmEu and the requests may be made from Russia or China. Search and you’ll find that ZmEu is a bot that tries to find vulnerabilities in phpMyAdmin (usually looks for phpmyadmin/scripts/setup.php file) and other web applications. This is how logs looked like.

This one failed to find phpMyAdmin as it got an 404 HTTP error code: [...] "GET //phpMyAdmin/ HTTP/1.1" 404 285 "-" "Made by ZmEu @ WhiteHat Team - www.whitehat.ro"

This one succeeded, 200 HTTP code was returned when accessing http://domain.com/myadmin: [...] "GET //myadmin/ HTTP/1.1" 200 8644 "-" "Made by ZmEu @ WhiteHat Team - www.whitehat.ro"

The last one is a bit strange, as they are looking for /w00tw00t.at.blackhats.romanian.anti-sec:): [...] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 315 "-" "ZmEu"

This are just 3 examples. If your server has suffer this attack, you’ll see a lot of similar rows coming from the same IP address in a very short period of time. If none of the GET requests returned a 200 code, probably you are safe. Else, your system may have been compromised, so you’d better look for suspicious things in any of the files/folders they found.

Even if you don’t have phpMyAdmin installed or if all the requests returned a 404 error you should block this kind of attacks not only for security reasons, but for system stability and good performance. You can start by doing this 3 things:

  1. Block all the suspicious IPs. This will not block the attacks, as attackers use different IPs each time. But I think it’s a good practice to block requests coming from zombies in case more malicious attacks, and maybe more dangerous than ZmEu, are coming from there in the future. You can use iptables to block these addresses:
    iptables -I INPUT -s -j DROP
  2. Install ModSecurity. It is an open source web application firewall that will help you securing your Apache web server. With this Apache module you’ll be able to block almost any attack, although you will have to learn how to configure new rules if the default ones are not enough for you.
  3. Every attack of this kind creates a performance leak, as a 404 error page must be generated and served. You can create an antibot.phpfile with these lines:
    header("HTTP/1.1 403 Forbidden");

    Then add these lines to your .htaccess file in the web root directory. If you don’t have one, just create it. Remember you must have mod_rewrite installed and loaded.

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^antibot.php
    RewriteCond %{HTTP_USER_AGENT} (.*)ZmEu(.*)
    RewriteRule .* http://www.yourdomain.com/antibot.php [R=301,L]

    This will reply with a 403 error to all the requests that contain the string ZmEu in the user agent. So if you only use this method, your server will be blocking only ZmEu attacks. If you also want to block other user agents just add another RewriteCond %{HTTP_USER_AGENT} botname_regexp line. When adding another condition, don’t forget to add [OR] at the end of the previous RewriteCond.

    Update: nyhm proposed these other rewrite rules in the comments. They’re more straightforward and they probably work better than the ones above.

    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} ^ZmEu [OR]
    RewriteCond %{HTTP_USER_AGENT} (.*)AnotherAgent(.*)
    RewriteRule .* – [F]

    Replace AnotherAgent by the user agent you want to bloc or remove the line and the previous [OR].

You may want to block these IPs in your server, as they’re known to be doing this kind of attacks:

External links:
Categories: Apache Tags: ,
  1. 2011/05/24 at 15:28

    Thanks you for the information. I have blocked the following hosts on my iptables that are mostly ZmEu related and some are for webstats/ which I have a question for you at end.

    DROP all —
    DROP all —
    DROP all —
    DROP all —
    DROP all —
    DROP all —
    DROP all —
    DROP all —
    DROP all —
    DROP all —

    I do have a related question for you. Have you ever seen or know about lot of GET/POST requests to /webstats directory (the default webalizer stats) as shown below?. If you do a google search on these hosts, there are tons of results on them doing the same thing to other webservers but no other details.

    hsi-kbw-109-192-245-251.hsi6.kabel-badenwuerttemberg.de – – [23/May/2011:00:24:10 +0000] “POST /webstats/ HTTP/1.1” 200 11770 “http://bestpennystockprophet.com” “Mozilla 4/0”

    hsi-kbw-109-192-245-251.hsi6.kabel-badenwuerttemberg.de – – [23/May/2011:00:24:11 +0000] “GET /webstats/ HTTP/1.1” 200 11770 “http://bestpennystockprophet.com” “Mozilla 4/0”

    cache.aragon.es – – [23/May/2011:19:36:47 +0000] “GET /webstats/ HTTP/1.1” 200 11770 “-” “Mozilla 4/0”

    cache.aragon.es – – [23/May/2011:19:36:49 +0000] “POST /webstats/ HTTP/1.1” 200 11770 “http://board.azboxworld.com/member.php?u=30045” “Mozilla 4/0”


    • blizarazu
      2011/06/13 at 21:03

      Thanks for your comment.

      No, I’ve never seen those kind of requests. Obviously they are trying to find something about your Webstats application, vulnerabilies, the statistics of your site… who knows. Maybe you should protect your webstats folder. More info in this forum.

      Hope it help

  2. oie
    2011/06/13 at 20:17

    One more

  3. 2011/08/29 at 18:44

    Your rules do not work for me exactly as described. Here are some tweaks that fixed it. Notice the / before the first condition filename as well as the [OR] to add more conditions (otherwise they must all match). Thanks for the great guide.

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/antibot.php
    RewriteCond %{HTTP_USER_AGENT} (.*)ZmEu(.*) [OR]
    RewriteCond %{HTTP_USER_AGENT} (.*)AnotherAgent(.*)
    RewriteRule .* /antibot.php [R=301,L]

    One question, though… Why redirect with 301 Moved Permanently only to give a 403. Why not write the rule to use [R=403,L]?

  4. 2011/08/31 at 20:03

    Here’s my simplified approach. Can anyone tell me whether this is valid?

    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} ^ZmEu [OR]
    RewriteCond %{HTTP_USER_AGENT} (.*)AnotherAgent(.*)
    RewriteRule .* – [F]

    Notice that the ZmEu agent tends to start with the name. Does this need to be ^ZmEu(.*) to catch the rest, or is that implied? The AnotherAgent is given as an example.

    Instead of redirecting (301), this uses the [F] rule, which immediately throws a 403 Forbidden to the client.

    • blizarazu
      2012/01/12 at 0:37

      Good tip, thanks! I’ve tested it and it works like a charm.

      You can write just (.*)ZmEu(.*) as this way it will catch every user agent that contains the ZmEu string in it, even if the agent starts with that name.

      There is a good add-on for Firefox that lets you switch your user agent. It helps a lot for testing such things. Here’s the link:

  5. mijaelg
    2011/10/03 at 16:07

    Here are more IP addresses ZmEu uses

  6. 2011/10/24 at 13:43

    [Wed Oct 19 04:00:51 2011] [client] /var/www/user
    [Wed Oct 19 09:21:42 2011] [client] /var/www/w00tw00t.at.blackhats.romanian.anti-sec

    some fucking russians had tried to hack my server:
    I found that http://www.foods.org.ua/ (I think they are who attacked me but cant prove it actually.)

    AND, not less important, some scripts wrote in perl like this:
    — ll.pl

    In that code you can find rules of the attack, may it helps!

  7. 2012/02/22 at 1:26

    redirect 301 /phpmanager/ http://www.urbandictionary.com/define.php?term=fuck+you
    redirect 301 /webadmin/ http://www.urbandictionary.com/define.php?term=fuck+you

    This is what we do to the hackers.

  8. psilofski
    2012/04/02 at 11:44

    Take a look at this:

    It would be better to include the .htaccess script (nyhm solution) in your httpd.conf file and completely dump the .htaccess , in order to allow for “AllowOverride None ” in your server configuration, both for reasons of security and speed.

    That is of course if you have root access to the server…

  9. Tony
    2012/07/18 at 15:08

    You may also want do add to your list.

  10. nyles
    2012/07/25 at 4:29

    Thanks for this blog post. We just saw zemu activity on one of our servers, nearly exactly as described up above, coming from IP .

  11. Some1
    2013/02/18 at 4:36

    And don’t forget

    Otherwise attack will continue because your script misses exit; after header()

  12. gnoptiy
    2014/01/31 at 4:07

    Here’s my list of blocked IP:

  13. 2014/02/10 at 8:50

    my block list

  14. Christian
    2017/03/12 at 21:48

    If anyone is interested — that’s the snippet I came up with for lighttpd, it just returns 403 for any request from any user agent matching ZmEu or Morfeus

    $HTTP[“useragent”] =~ “(ZmEu|Morfeus)” {
    url.access-deny = (“”)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: