Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Mail Server
  • Search

VestaCP + Exim + php mail function security issue? Topic is solved

Questions regarding the Mail Server
Dovecot, Exim, RoundCube
Post Reply
  • Print view
Advanced search
11 posts
  • 1
  • 2
  • Next
securetunnel

VestaCP + Exim + php mail function security issue?
  • Quote

Post by securetunnel » Fri Nov 20, 2015 6:37 am

VestaCP seems to install the mail system with an implicit "trust" of localhost. The php mail() function will use localhost (as will roundcube then by default) and this doesn't require authentication of a local user to send mail.

The issue with this, is that if you are hosting a website on the same installation, and that website gets hacked with a php shell or other (happens to wordpress, joomla, drupal all the time) then that exploit can turn your vestaCP installation into a spam generator as your hacked site can make use of the php mail() function and send mail at will without authentication.

We got around this by requiring auth to smtp (exim) through the whole system:

1) Point /usr/sbin/sendmail to /dev/null
2) Configure /etc/roundcubemail/main.inc.php --> SMTP section, to use localhost, port (25 or 587), and the %u/%p values for username and password so that your authenticated user to webmail (roundcube) is actually authenticating to SMTP locally even when using webmail.

We had several instances of hacked websites that were able to make use of the default 'localhost-can-send-without-auth' configuration.

Suggest in future releases of VestaCP that exim/sendmail be COMPLETELY locked down so that even sending from LOCALHOST requires auth.
Top

abad
Posts: 36
Joined: Tue Jul 14, 2015 11:35 am

Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by abad » Fri Nov 20, 2015 5:50 pm

I don't think that any other panels restrict that, since it makes it much less user friendly.
Top

AdamiPL
Posts: 21
Joined: Sat Dec 20, 2014 8:33 am

Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by AdamiPL » Sat Nov 21, 2015 11:02 am

abad wrote:I don't think that any other panels restrict that, since it makes it much less user friendly.
this must be safe, not user friendly
Top

Vladimir Chanaev
Posts: 45
Joined: Sun Mar 13, 2016 2:21 pm
Contact:
Contact Vladimir Chanaev
Website Facebook Skype

Os: Ubuntu 17x
Web: nginx + php-fpm
Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by Vladimir Chanaev » Sat Apr 09, 2016 3:01 am

Confirm.
My Vesta with some Joomla sites were affected by this problem. Huge CPU and bandwidth loads. Spamassassin and clamav deamons falls down after 5-10 minutes.
Thanks for advices.
Top

Vladimir Chanaev
Posts: 45
Joined: Sun Mar 13, 2016 2:21 pm
Contact:
Contact Vladimir Chanaev
Website Facebook Skype

Os: Ubuntu 17x
Web: nginx + php-fpm
Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by Vladimir Chanaev » Sun Apr 10, 2016 4:49 am

Code: Select all

1)  /usr/sbin/sendmail -v -d < /dev/null

Code: Select all

2)  nano /etc/roundcube/main.inc.php

$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';
Correct? Plz confirm. Thanks!
Top

alexare
Posts: 2
Joined: Thu Sep 24, 2015 12:47 pm

Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by alexare » Sun Apr 10, 2016 8:08 pm

Vladimir Chanaev wrote:Confirm.
My Vesta with some Joomla sites were affected by this problem. Huge CPU and bandwidth loads. Spamassassin and clamav deamons falls down after 5-10 minutes.
Thanks for advices.
I was the same issue also - spamassassin fails after 5-10 minutes; and the bug came from a wordpress site installed on my server
Top

alexare
Posts: 2
Joined: Thu Sep 24, 2015 12:47 pm

Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by alexare » Mon Apr 11, 2016 2:29 pm

Vladimir Chanaev wrote:

Code: Select all

1)  /usr/sbin/sendmail -v -d < /dev/null

Code: Select all

2)  nano /etc/roundcube/main.inc.php

$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';
Correct? Plz confirm. Thanks!
This didnt work for me; i am running a Centos 6.7
nano /etc/roundcubemail/main.inc.php worked

but cant point to /dev/null
Top

Vladimir Chanaev
Posts: 45
Joined: Sun Mar 13, 2016 2:21 pm
Contact:
Contact Vladimir Chanaev
Website Facebook Skype

Os: Ubuntu 17x
Web: nginx + php-fpm
Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by Vladimir Chanaev » Fri Apr 15, 2016 4:23 am

alexare wrote:
Vladimir Chanaev wrote: but cant point to /dev/null
Image

Click EDIT on your Mail Account in MAIL section of Vesta CP and edit Catchall email: /dev/null
I think its the same but not sure.
Top

a1war
Posts: 2
Joined: Sat Jul 23, 2016 1:45 pm

Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by a1war » Sat Jul 23, 2016 4:05 pm

I don't have any /etc/roundcube/main.inc.php

Those are the files that I have in /etc/roundcube/ dir:

apache.conf debian-db.php lighttpd.conf
config.inc.php defaults.inc.php mimetypes.php
debian-db-roundcube.php htaccess plugins/

Which one I should update?
Top

auraputih
Posts: 1
Joined: Sat Oct 15, 2016 4:21 am

Re: VestaCP + Exim + php mail function security issue?
  • Quote

Post by auraputih » Sat Oct 15, 2016 4:56 am

Method for PHP5.5 and before
We have to edit sendmail_path in php.ini

Code: Select all

1. nano /etc/php5/apache2/php.ini
2. Edit line sendmail_path = and change into sendmail_path = "/dev/null"
3. Save 
Method for PHP5.6 and after
The newest php version installed on server does not allow global settings (such as execution time, max upload filesize, max post file size, etc.) to be changed.

Folow these steps to resolve the issue:

Code: Select all

1. nano /etc/php5/apache2/conf.d/user.ini
2. Add sendmail_path = "/dev/null" line inside /etc/php5/apache2/conf.d/user.ini 
3. Save
4. Use this ini file for any custom settings. 
Edit Roundcube configuration
After you have changed the setting in php, you have to change the setting in roundcube

Code: Select all

nano /etc/roundcube/main.inc.php

$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';
*Location for Centos php.ini is at /etc/php.ini
Top


Post Reply
  • Print view

11 posts
  • 1
  • 2
  • Next

Return to “Mail Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password