I'm pretty sure the MySQL client libraries that are used by PHP do not support passing an encrypted password to MySQL - they must be sent in plain text.
If anyone gets access to read your config.php, you've got much bigger problems on your hands.
I have my config.php file owned by root with a group belonging to my web server. It is then chmod 640 so root can read/write while the web server can only read.
To be able to read the contents, someone would either need to A) be able to log in as root, and if they can - they can do anything on your sever anyway, or B) get control over the web server and run arbitrary scripts including those which can read the contents of arbitrary files on the server. Again, once they can do that, you've got bigger issues on your hands.
The important thing is that the config file is not world readable to ensure that if someone was to gain access to your web server using a user other than root or your web server, then they wouldn't be able to read the config.
Ideally, XenForo devs should move to using environment variables to store environment-specific configuration -
https://github.com/vlucas/phpdotenv or
https://symfony.com/components/Dotenv have become the standard for other frameworks.
That being said, it makes less sense to do so in XenForo given the structure of the application. You'd really need to have a separate public directory as the web root which involves a major change to the XenForo directory structure.
The main point of .env files is to have a simple standard location for environment-specific configuration so that you don't need to check that information into source control when doing automated deployments. Given people don't generally do automated deployments of XenForo, the benefit is minimal.
In the meantime, here is what you should do:
- ensure that your operating system is secure and patched regularly
- ensure that your web server stack is patched regularly and correctly configured
- ensure that you are running the latest version of XenForo
- secure your config.php file as tightly as you can (ie read only to the web server, not readable to anyone else)
- watch out for 3rd party addons - there may be vulnerabilities introduced, only run addons from sources you trust