473,408 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

virus sent vie webmail running on Apache

Joe
Hello,

I currently use a simple php webmail form with php's mail() function
doing the work to send messages to the site owner.

However, viruses are being sent via the form.

I tried adding a basic colaboration of amavis-new, ClamAV and
spamassasin, but that filter does not seem to catch them. I assume they
are injected into the Postfix process too late.

Any idea how I can eliminate this?

thanks
Joe
May 8 '07 #1
5 1651
Joe wrote:
Hello,

I currently use a simple php webmail form with php's mail() function
doing the work to send messages to the site owner.

However, viruses are being sent via the form.

I tried adding a basic colaboration of amavis-new, ClamAV and
spamassasin, but that filter does not seem to catch them. I assume they
are injected into the Postfix process too late.

Any idea how I can eliminate this?
The data you get to the mail() from the "FROM" input box has to be stripped
from injected headers.

A really simple check for injection is to

$newfrom=erege_replace("[\r\n]","",$from);
if($newfrom==$from) {
mail(...);
} else {
//header had injected data, don't send it
}

--

//Aho
May 8 '07 #2
On May 8, 12:21 am, "J.O. Aho" <u...@example.netwrote:
Joe wrote:
Hello,
I currently use a simple php webmail form with php's mail() function
doing the work to send messages to the site owner.
However, viruses are being sent via the form.
I tried adding a basic colaboration of amavis-new, ClamAV and
spamassasin, but that filter does not seem to catch them. I assume they
are injected into the Postfix process too late.
Any idea how I can eliminate this?

The data you get to the mail() from the "FROM" input box has to be stripped
from injected headers.

A really simple check for injection is to

$newfrom=erege_replace("[\r\n]","",$from);
if($newfrom==$from) {
mail(...);} else {

//header had injected data, don't send it

}

--

//Aho
Of course str_replace works just as well and is probably faster:

$newfrom = str_replace(array("\r", "\n"), '', $from);

May 8 '07 #3
On May 7, 7:57 pm, Joe <j_ev...@upfronttechnology.comwrote:
Hello,

I currently use a simple php webmail form with php's mail() function
doing the work to send messages to the site owner.

However, viruses are being sent via the form.

I tried adding a basic colaboration of amavis-new, ClamAV and
spamassasin, but that filter does not seem to catch them. I assume they
are injected into the Postfix process too late.

Any idea how I can eliminate this?

thanks
Joe
PHP uses either the system's sendmail wrapper or SMTP depending on
your php environment, server OS, and php.ini settings. The SMTP
version of mail() is only available on Windows systems. In your case,
using mail() is the same as sending the mail message via sendmail from
a shell. This means that the mail is injected into the postfix queue
after the after-queue content filter. Your best bet for a workaround
is to use the PHPMailer or PEAR Mail packages to send your messages
via SMTP to localhost.

Good luck!

Joshua

May 9 '07 #4
C.
On 8 May, 00:57, Joe <j_ev...@upfronttechnology.comwrote:
Hello,

I currently use a simple php webmail form with php's mail() function
doing the work to send messages to the site owner.

However, viruses are being sent via the form.

I tried adding a basic colaboration of amavis-new, ClamAV and
spamassasin, but that filter does not seem to catch them. I assume they
are injected into the Postfix process too late.

Any idea how I can eliminate this?
Holy moley, you're letting users upload files into emails on your
website then sending them using mail() !!!!

....and you wonder why you've got problems?

Really, the question you're asking has nothing at all to do with PHP -
unless you want to use PHP to launch clamscan on uploaded files before
attaching them to emails (but bear in mind that anyone out to be
malicious could always incorporate uuencded data inline).

Clam + postfix worked a trick for me using clamsmtp. Its been a while
since I looked at amavis - but even then it wasn't as bad as a lot of
commercial AV tools.

I'd try asking on a more apposite (i.e. amavis or postfix) newsgroup.

C.
May 15 '07 #5
On May 15, 5:34 pm, "C." <colin.mckin...@gmail.comwrote:
On 8 May, 00:57, Joe <j_ev...@upfronttechnology.comwrote:
Hello,
I currently use a simple php webmail form with php's mail() function
doing the work to send messages to the site owner.
However, viruses are being sent via the form.
I tried adding a basic colaboration of amavis-new, ClamAV and
spamassasin, but that filter does not seem to catch them. I assume they
are injected into the Postfix process too late.
Any idea how I can eliminate this?

Holy moley, you're letting users upload files into emails on your
website then sending them using mail() !!!!

...and you wonder why you've got problems?

Really, the question you're asking has nothing at all to do with PHP -
unless you want to use PHP to launch clamscan on uploaded files before
attaching them to emails (but bear in mind that anyone out to be
malicious could always incorporate uuencded data inline).

Clam + postfix worked a trick for me using clamsmtp. Its been a while
since I looked at amavis - but even then it wasn't as bad as a lot of
commercial AV tools.

I'd try asking on a more apposite (i.e. amavis or postfix) newsgroup.

C.
If you send your php mail via SMTP to your mail server instead of
using mail() it will travel the same path that inbound mail takes.
So . . . . if you have postfix set to use a before/after queue content
filter, your php mail will be filtered as well.

May 16 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James Butler | last post by:
Setup: Red Hat Linux 8.0 Apache 1.3.27 PHP 4.3.2 Sendmail 8.11.6 Other Info: root:root /var/spool/mail root:root /var/spool/mqueue Apache running as nobody:nobody
6
by: Douglas F. | last post by:
My host doesn't use buffering so I placed the form validation (php) ahead of the html like this: <?php if(isset($_POST)) { <do the validation processing> if(file_exists($fn)) {...
0
by: Jagdeesh | last post by:
Hai Colleagues, I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've transferred a set of folders(containing jsp files) into tomcat's webapps directory(to /webapps/bob ,...
1
by: Rolfe | last post by:
Hi, I struggled, and got mod_python running on Apache/Win2k. Follow these instructions verbatim and you shouldn't have any trouble. These instructions are based on...
1
by: Jason | last post by:
I am trying to send mail via SMTP, using VB.NET on XP. I keep getting this error: "Could not access 'CDO.Message' object." (I can send mail fine via VB6, using CDONTS.) I have added a reference...
0
by: Karel Vekro | last post by:
Hi all, I am running MailBee webmail Wap (trial Key) under Win2003 and runs very well, however the price is too high ($120,-) so I am going to uninstall it. Is there an alternative for Mailbee...
9
by: John C. Frickson | last post by:
My company produces reports for our customers in PDF format. I have a php script that verifies login status and access rights, and sends the pdf to the client using readfile(). This has worked...
5
by: r.g. | last post by:
Hello, Recently, my PHP (5, as installed by the XAMPP package) stopped working, and won't let me run locally-served PHP files in my web browsers. I think (but I'm not sure) that the Apache...
1
by: walterbyrd | last post by:
I understand that Python has them, but PHP doesn't. I think that is because mod_php is built into apache, but mod_python is not usually in apache. If mod_python was built into apache, would...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.