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.
Credentials should never be stored in the database unless encrypted or hashed.
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 ;-)
Labels |
Added:
?
|
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.
Thank you for unsubscribing.
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
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.
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.
and now its almost march 2022
Are you surprised? I still have serious security issues open with the JSST for YEARS!
Title |
|
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: ? |
@Hackwar can you have a lock at this please? Is it needed to save the e-mail server settings in the db?!