Solved

Testing Outbound SMTP Connections

Posted on 2006-07-15
6
545 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
  • 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 39

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 39

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now