Go Back   Defender Hosting Forums > PowerVPS Virtual Private Servers > Linux VPS - Security and Tuning

Linux VPS - Security and Tuning Security and Tuning Discussion for Linux Virtual Private Servers based on Virtuozzo by SWsoft

Reply
 
Thread Tools Display Modes

  #1  
Old 01-04-2006, 02:36 PM
Robert's Avatar
Robert Robert is offline
Staff
 
Join Date: Mar 2005
Posts: 974
Robert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud of
Default PHP Mail Script Exploits

Hey folks...

We've been seeing an increased number of abuse reports and customer complaints regarding various issues that have been determined to have a root problem in one of the php scripts on their server being compromised and sending spam.

Many times these scripts have been found to have injection capabilities to make a submit form for example not only send mail to the one person specified, but also many others.

You can read more about this vulnerability at:
http://securephp.damonkohler.com/ind...mail_Injection

The above URL has the issue pretty well documented and covers a potential solution. I'm going to summerize below and try to keep it in "english", so forgive me if it seems I'm being very basic with the explaination.

Essentially it would add a mod_security rule to filter out the ability to pass "bcc", "cc", and "to" phrases through the URL bar. It would keep someone from taking a mailer.php form and adding "extra" recipients to it.

The downside to this is if you have a script that posts information via URLs (such as http://mydomain.com/script/php?id=tommy or username=ccnnaa), this would be blocked.

mod_security by default would apply this to ALL domains. However, if you wanted one domain to not be protected by mod_security, you could add a directive to the domain's httpd.conf record:

<IfModule mod_security.c>
SecFilterEngine Off
</IfModule>

That would disable ALL mod_security protection for the domain, so be careful using that.

If anyone is interested in trying this out on their server, please feel free to open a support ticket and a tech would be happy to apply this for you. And of course you're welcome to give it a shot adding it yourself. Just open your mod_security.conf file (the location varies depending on your panel), add the extra line, save it, and restart Apache.

If you do try this, please post here with your expierences. I'm interested in knowing how well this would work possibly in a larger deployment, etc.
__________________
Rob Yates
Senior Systems Administrator
PowerVPS / Defender Hosting
Defender Technologies Group, LLC.
Reply With Quote

  #2  
Old 01-04-2006, 04:27 PM
ndndixie
Guest
 
Posts: n/a
Default

Would it block things such as the login on CMS's?
Reply With Quote

  #3  
Old 01-04-2006, 04:36 PM
Fred Fred is offline
Senior Member
 
Join Date: Jun 2005
Posts: 601
Fred is on a distinguished road
Default

Hi,

good warning, it can happen to anyone
Small site, big site...
Here is a thread a made a long time ago here:
http://forums.deftechgroup.com/showthread.php?t=702

It's exactly what you are talking about. I stopped the attack just in time. The bot or spammer found that the script was vulnerable by doing a lot of tests, one of them worked. A mail was sent to a mail address, i believe it was the spammer email address. He needs to know if it worked
Later, the same week, the contact script was bombed with requests... Happy that It wasn't vulnerable anymore ...

There's a lot of thread about that problem on cpanel forums... But most of them are full of "how can, what if" ... so it's a bit hard to read and find good infos... It seems to have two way to work with it. Exim rules... or mod_sec rules... Imo, i believe mod_sec rules is better.

For the part about mod_sec rules... I think it's better to only block bcc ( and cc if really needed ).
Blocking "to" is a bit too much... i think that would block so many scripts...
And from what i've read on cpanel forums and wht forums, most of these exploits use bcc...

Also, as far as i know, mod_sec rules isn't case-sensitive...
Code:
SecFilterSelective ARGS_VALUES ".*([Cc][Cc]|[Bb][Cc][Cc]|[Tt][Oo])[[:space:]]*\:.*\@"
__________________
Reply With Quote

  #4  
Old 01-04-2006, 05:39 PM
Izzy
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Fred
... Also, as far as i know, mod_sec rules isn't case-sensitive...
Code:
SecFilterSelective ARGS_VALUES ".*([Cc][Cc]|[Bb][Cc][Cc]|[Tt][Oo])[[:space:]]*\:.*\@"
Is not case sensitive means you don't need to filter for case sensitive rules. So bcc and cc will block all cases as in Roberts post. In fact just bcc in the rule will cover them all also.
SecFilter "bcc:"

I agree with your 'to' rule being somewhat over the top . It would pose too many issues in a hosting situation which often is not taken into consideration when security sites issue recomendations unless they specifically mention hosting boxes.


Last edited by Izzy; 01-04-2006 at 06:11 PM.. Reason: Added more info.
Reply With Quote

  #5  
Old 01-05-2006, 09:38 AM
Robert's Avatar
Robert Robert is offline
Staff
 
Join Date: Mar 2005
Posts: 974
Robert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud ofRobert has much to be proud of
Default

It should not block logins to CMS or anything else generally. The only reason it might is if the script passes the information in a crappy way (IE via the URL bar) instead of through the headers.

Most scripts don't use the URL for passing authenticating data, because it can be recorded by the server you last visited (as the exit agent), because the data could be bookmarked and login passed around with never really entering a password via the website (say for example, someone looks in my history and sees http://www.domain.com/script.php?login=robert&pass=supersecure&date=toda y").

If someone would like to try adding a BCC block to the mod_security rules, let us know how testing goes. If you want us to set this up for you, just contact support and reference this thread.
__________________
Rob Yates
Senior Systems Administrator
PowerVPS / Defender Hosting
Defender Technologies Group, LLC.
Reply With Quote

  #6  
Old 01-05-2006, 10:10 AM
ndndixie
Guest
 
Posts: n/a
Default

writing support now......you have way too much free time on your hands. :P
Reply With Quote

  #7  
Old 01-05-2006, 10:14 AM
charles charles is offline
Senior Member
 
Join Date: May 2004
Location: Virginia
Posts: 1,327
charles has much to be proud ofcharles has much to be proud ofcharles has much to be proud ofcharles has much to be proud ofcharles has much to be proud ofcharles has much to be proud ofcharles has much to be proud ofcharles has much to be proud of
Default

Quote:
Originally Posted by ndndixie
writing support now......you have way too much free time on your hands. :P
Mmmh. I can fix that.
Reply With Quote

  #8  
Old 01-05-2006, 10:30 AM
sdjl's Avatar
sdjl sdjl is offline
Senior Member
 
Join Date: Dec 2005
Location: London, UK.
Posts: 349
sdjl is on a distinguished road
Send a message via AIM to sdjl
Default

I set up bcc and cc filtering before i transferred over any of my accounts
I have lots of attempts to send emails via forms on several of my accounts, which is why i have it setup.

Whilst i can control the scripts that i write to not allow any injection attemps, some of my other users might not know how to do this.

Interesting thing to note about this, WHM doesn't show the logs for some reason. However, looking in the /var/log/httpd/audit_log file shows all of the attempts made.
Most of the attempts at the moment are trying to use wget or _vti_bin.

I can post some logs if anyone wants to have a look

David
Reply With Quote

  #9  
Old 01-05-2006, 11:29 AM
Fred Fred is offline
Senior Member
 
Join Date: Jun 2005
Posts: 601
Fred is on a distinguished road
Default

BUt... i'm thinking about it now... and guys, we should block BCC in POST too... not only in the url parameters... For example, my experience with this bot/spammer was with a contact.php that use POST... it doesn't make any difference for the bot... it will use POST instead of GET...
__________________
Reply With Quote

  #10  
Old 01-05-2006, 02:51 PM
jasonyu jasonyu is offline
Junior Member
 
Join Date: Oct 2005
Location: NY, NY
Posts: 11
jasonyu is on a distinguished road
Default

Spent some time last week looking for a secure contact form script. DodosMail claims security against header injection -- good if you just want something that works and don't want to mess with any kind of server configs.

http://www.regretless.com/scripts/scripts.php#dodosmail
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP!! VPS Processes atnetsolutions Linux VPS - General 7 11-08-2006 09:07 AM
crontab - running php script PaulH Linux VPS - General 1 11-01-2006 05:27 PM
The Black Zone doctoradel Linux VPS - General 8 07-19-2006 10:51 AM
PHP mail problem rfontaine Linux VPS - HOWTOs and FAQs 3 05-07-2006 08:27 PM
PHP Blogging Apps (and more) Vulnerable to XML-RPC Exploits charles Linux VPS - Security and Tuning 5 07-07-2005 08:45 PM



All times are GMT -4. The time now is 03:52 AM.


vBulletin skin developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright Defender Technologies Group, LLC 2006