No Code Attached Yet
avatar PhilETaylor
PhilETaylor
8 Jan 2021

Steps to reproduce the issue

Joomla 4 Mail Templates allows for SMTP Credentials to be stored in plain text in the database

Furthermore there can be different credentials for each email - meaning, potentially, there could be 25 different sets (or 25 of the same) credentials stored in the database.

This makes them fair game for hackers to access using SQL injection or on a database compromise, whereas all other credentials in the database are hashed, and the credentials for SMTP are stored in /configuation.php which cannot be accessed (easily) by SQL injection or complete database compromise.

Expected result

Credentials should never be stored in the database unless encrypted or hashed.

Actual result

Plain text credentials are stored in the params field of the #__mail_templates table

{"alternative_mailconfig":true,"mailfrom":"","fromname":"","replyto":"","replytoname":"","mailer":"smtp","sendmail":"/usr/sbin/sendmail","smtphost":"localhost","smtpport":25,"smtpsecure":"tls","smtpauth":true,"smtpuser":"THIS_SMTP_USER","smtppass":"THIS_PASSWORD_IN MAIL TEMPLATES","copyto":""}

Hint: There is a good reason @nikosdion encrypts credentials provided to Akeeba before storing them in the db ;-)

avatar PhilETaylor PhilETaylor - open - 8 Jan 2021
avatar joomla-cms-bot joomla-cms-bot - change - 8 Jan 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Jan 2021
avatar PhilETaylor PhilETaylor - change - 8 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 8 Jan 2021
avatar PhilETaylor PhilETaylor - change - 8 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 8 Jan 2021
avatar HLeithner
HLeithner - comment - 8 Jan 2021

@Hackwar can you have a lock at this please? Is it needed to save the e-mail server settings in the db?!

avatar nikosdion
nikosdion - comment - 9 Jan 2021

This is fairly trivial to address and I have implemented it in a generic way in FOF3. It's no longer just Akeeba Backup. The idea is that the encryption key is stored in the filesystem while the encrypted data is stored in the database. Just a SQL injection won't be enough to divulge the secrets. If someone has full read control over the filesystem it's game over anyway; they have database access and filesystem access, your site is compromised. This is the same idea we used back in late 2012 with the two factor authentication data being encrypted in the database.

If you have or are about to implement the split secrets Tobias and David were talking about several months ago you can of course use the secret meant for encryption to encrypt this information in the database. If you have not implemented this yet you can use the current secret since the way it will be implemented — at least according to the discussion we had last summer — is that the current secret will be used for encryption and a new one will be used for hashing session data and other publicly visible information.

I would have normally offered to help but I've been dissuaded from contributing so many times it's no longer funny. I'd like to preserve my sanity and my time. I've told you how to do it, any developer worth being a core contributor can implement it.

I am unsubscribing from this thread since it's not productive for me to participate in a discussion when I know that I won't be allowed to contribute code for it anyway. Not to mention that Hannes definitely doesn't like working with me, especially when I am right.

avatar chmst
chmst - comment - 9 Jan 2021

Thank you for unsubscribing.

avatar Fedik
Fedik - comment - 10 Jan 2021

Would be cool if we use 1 global email config.
Spreading them around can make the site migration much harder, also this make harder to use Dev/Live installation for people who have separate environments for Dev/Live

avatar HLeithner
HLeithner - comment - 10 Jan 2021

Looking at the code the email settings are alternative settings for single mails I would suspect it's part of the 'alternative_mailconfig' and is unset if not used.

This feature is not really useful for core but for 3rd party extensions. Encrypting the sensitive data would make sense and should be done. On the other side if a hacker can make a sql injection he/she has already won the war.

avatar PhilETaylor
PhilETaylor - comment - 18 May 2021

This issue was reported to the @joomla/security JSST team on 8th January 2021...

To date, I have not received a reply. It's now May.

avatar brianteeman
brianteeman - comment - 25 Feb 2022

and now its almost march 2022

avatar PhilETaylor
PhilETaylor - comment - 25 Feb 2022

Are you surprised? I still have serious security issues open with the JSST for YEARS!

avatar PhilETaylor PhilETaylor - change - 2 Mar 2022
Title
[4b6] Joomla 4 Mail Templates allows SMTP Credentials to be stored in plain text in the database
[SECURITY ISSUE IGNORED FOR OVER A YEAR!!!] [4b6] Joomla 4 Mail Templates allows SMTP Credentials to be stored in plain text in the database
avatar PhilETaylor PhilETaylor - edited - 2 Mar 2022
avatar PhilETaylor PhilETaylor - change - 7 Mar 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-03-07 18:38:43
Closed_By PhilETaylor
Labels Added: No Code Attached Yet
Removed: ?
avatar PhilETaylor PhilETaylor - close - 7 Mar 2022

Add a Comment

Login with GitHub to post a comment