Solved

Testing Outbound SMTP Connections

Posted on 2006-07-15
6
547 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 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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