PHPMailer vulnerability in no-reply address

PHPMailer vulnerability in no-reply address

by mimi nom -
Number of replies: 4

Hello,

I have a question regarding a security announcement, see here the security announcement

They say that this problem only affects sites that leave "$CFG-> smtphosts" empty.

I would like to know if the sites that did not specify this parameter neither in "config.php" nor in the configuration page of the email are also affected by this problem



Thank you in advance for your answers

Average of ratings: -
In reply to mimi nom

Re: PHPMailer vulnerability in no-reply address

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

yes - but only site-admins with the ability to modify the noreply address are able to exploit this. 

Average of ratings: Useful (1)
In reply to mimi nom

Re: PHPMailer vulnerability in no-reply address

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Yes, if you provide hosting for Moodle sites and you don't trust Moodle admin users, you must upgrade Moodle ASAP or, as a workaround, you can specify in config.php either SMTP host or noreply/support email.

If you have self-hosted site and admin of the site is already an admin on the server, such admins do not need to exploit this vulnerability as they can execute any code on the server anyway. This includes situations when Moodle admin is the same person who can ssh/ftp to the server.

I also would like to point out that if plugin installation is enabled on the Moodle site (by both config and writable directories permissions), Moodle admins are already trusted to execute anything they want on the server. Also when we say that code will be executed on the server keep in mind that the user executing it will be the web user and hopefully the server is set up properly and this user can not do too much harm to the server.

I actually wanted to mark this security issue as "Minor" but some my colleagues convinced me that it could be serious in some situations. Some institutions have multiple admins, for example, and not all of them can ssh/ftp directly. But again, if these admins are not trusted they can already do lots of harm to the Moodle site, the only difference in this case is that they can also do some harm to the server. MoodleCloud would be the good example of the serious vulnerability case - admins are just random people who can set up an empty Moodle site and try to attack the server. However https://moodlecloud.com was not affected as it uses SMTP and not phpmailer.

Vulnerability inside phpmailer itself is very serious but Moodle already properly validates/escapes/quotes all user-specified emails and names and the only affected area was the admin setting of noreply/support email.
Average of ratings: Useful (3)
In reply to Marina Glancy

Re: PHPMailer vulnerability in no-reply address

by James McLean -

I'd just like to expand on something Marina said: "Also when we say that code will be executed on the server keep in mind that the user executing it will be the web user and hopefully the server is set up properly and this user can not do too much harm to the server."

This is playing down the risk a little in my opinion.

If an attacker can execute code as the web server user, the first code they usually execute will create a reverse shell to another machine the attacker controls. As the name suggests this creates a connection initiated from the web server to an address of the attackers choosing, and gives an interactive shell. The fact that the apache/httpd user cannot usually login via the shell has no impact on this. The connection is initiated from the server it will often bypass firewalls and other protections unless they're specifically setup with this in mind (and even then they can often be bypassed by using allowed ports).

Using this shell the attacker can freely enumerate the contents of the server itself to find privilege escalation vulnerabilities, upload/download to any location the web server user can write to (including /tmp and moodledata) and then exploit local vulnerabilities - usually for the purpose of privilege escalation to the root account.

In reply to James McLean

Re: PHPMailer vulnerability in no-reply address

by mimi nom -

Thank you all for these answers it is now clearer for me