Solved

Testing Outbound SMTP Connections

Posted on 2006-07-15
6
549 Views
Last Modified: 2008-03-17
Hello All,

We have a server with about 300 domains on it that handles web and mail services using Linux, APACHE, PHP and QMAIL with the PLESK Control Panel. Recently we have found out that one of the domains has a form on it that is being injected and used to send out SPAM. We don't know which on yet and while we are trying to figure that out we have turned off SMTP outbound connections via IPTABLES.

So the question is two fold:

One: Is there a way to make sure or check that all outbound PORT 25 connections are indeed NOT happening. I really want to make sure nothing is leaving the box.

Two: Is there a quick way to determine which domain on our system the spammer is using, or which form was used to inject the email into?


Any help in this matter would be greatly appreciated.
0
Comment
Question by:safepointmedia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 250 total points
ID: 17116763
1. iptables -I OUTPUT -p tcp --dport 25 -j REJECT
2. No. Hence there are two approcaches known to me
 - substitute/wrap php's mail() function so it adds server_name and script name to mail headers
 - patch php so it does by itself
0
 
LVL 40

Assisted Solution

by:noci
noci earned 250 total points
ID: 17118153
Ad 1:
You can watch the outgoing line with:
a) snort
b) tcpdump -ni ethX dst port 25
    if this show output, it's stuff leaving the system (but iptables do work..., so it should show nothing.)
If you also forward traffic from another box also insert a forward rule: 'iptables -I FORWARD -p tcp --dport 25 -j REJECT'

Ad 2:
Have you thought about mod_security  http://www.modsecurity.org/,
http://www.securityfocus.com/infocus/1739

it even has an example about Formmail...
http://forums.rochen.com/showthread.php?t=7041

From the default setup:
    # Stop spamming through FormMail
    # note the exclamation mark at the beginning
    # of the filter - only requests that match this regex will
    # be allowed
    <Location /cgi-bin/FormMail>
        SecFilterSelective "ARG_recipient" "!@webkreator.com$"
    </Location>

0
 

Author Comment

by:safepointmedia
ID: 17118431
Noci,

I do accept inbound traffic to port 25 so tcpdump will show inbound right?

So it should read something like:

15:11:30.399900 IP thereserver.1916 > myserver.smtp: . ack 45 win 64196

Am I reading that right??

Thanks
0
 
LVL 40

Expert Comment

by:noci
ID: 17120134
Yes, that would be shown too...,

tcpdump -ni ethX dst port 25 and not dst host myserver

would be better.. to exclude that.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question