Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Testing Outbound SMTP Connections

Posted on 2006-07-15
6
Medium Priority
?
553 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 1000 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 1000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

610 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