View Single Post
  #2  
Old 24th May 2013, 20:01
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 392
Thanks: 29
Thanked 58 Times in 50 Posts
Default

Just looking for some help here, folks.

Apparently, someone has managed to exploit Postfix on this server and the mail queue keeps filling-up with entries like this:

Code:
856BD22A97B9* 1202 Fri May 24 10:19:53 lgvuwak@example.com
person1@hotmail.com
person2@hotmail.com
where lgvuwak@example.com is a "fake" email address (the lgvuwak appears to be randomly-generated with each mail sent, and example.com is an actual, legitimate domain whose mail services are hosted on this server).

How is Postfix being exploited and how is this happening?

All the reading I've done indicates that this mail is coming from 127.0.0.1, which is why Postfix allows the mail to be sent (instead of refusing with "relay access denied").

This fact seems consistent with the headers in the queued messages. Here are the contents of one such message:

http://pastebin.com/7aTrsdxL

While this is occurring, I see a lot of activity from external IP addresses when this queue flooding is happening. These IP addresses appear to be Hotmail's. Here's an excerpt:

Code:
May 24 10:35:18 serverds postfix/qmgr[885]: 9E7A822A68B5: from=<o4zj@example.com>, size=1586, nrcpt=2 (queue active)
May 24 10:35:18 serverds postfix/error[23964]: 9ED8322A52CB: to=<julio.cvs@hotmail.com>, relay=none, delay=4652, delays=4652/0.02/0/0.01, dsn=4.4.2, status=deferred (delivery temporarily suspended: lost connection with mx1.hotmail.com[65.55.92.168] while sending RCPT TO)
The only way I've been able to stop this is to add drop rules for Hotmail's IP addresses to iptables.

I need to uncover the root source of this exploitation.

The most likely source of mail being sent from 127.0.0.1 seems to be a compromised Web application or site. We host a couple of WordPress sites on this server, and they seem to be the most likely culprit.

Where should I start looking? top/htop doesn't give any clues. All I see his heavy amavis activity. All of the sites on this server run PHP in Fast-CGI mode, with SuExec enabled, so, CPU activity attributable to PHP appears as a unique process in top. But, I don't see particularly heavy CPU activity for any particular website.

Thanks in advance for any help!

P.S. I realize that implementing what I describe in my initial post won't stop this exploitation, if it is in fact coming from a compromised website, but I would still like to know how it's done.
Reply With Quote