Hi @mindas22, thanks for your question.
There can be multiple attack vectors when a site is targeted that range from outdated plugins with an unpatched vulnerability to an insecure account on WordPress or within your hosting environment (database, cPanel, FTP etc.) It has even been known for another infected site on a shared hosting server to infect other sites hosted there: https://www.wordfence.com/blog/2021/06/service-vulnerabilities-shared-hosting-symlink-security-issue-still-widely-exploited-on-unpatched-servers/
Besides all the routine WordPress admin, FTP, SSH, cPanel user passwords:
- Changing your MySQL password is critical. Make sure remote MySQL access from all connections is not enabled.
- Most critical may be changing wp-config.php to 600 permissions. This is preventative against the symlink vulnerability mentioned above that exposes that file to be read in default permissions, which allows direct access to the db from other infected sites on the server.
- Your default cPanel password should also be changed if you haven’t already. There’s a common account third-party billing panel out there called “WHMCS”, where the cPanel password is controlled from the account billing panel. Your host may be able to help with finding this if it’s not apparent whether it’s changed from within cPanel or that kind of external billing dashboard provided by your host.
You can find site cleaning details here:
https://www.wordfence.com/docs/how-to-clean-a-hacked-wordpress-site-using-wordfence
https://wordfence.com/learn/
If you still have a copy of the affected file, you can always send it to samples @ wordfence . com for us to analyze. Please note that when attaching a file, ensure that you remove any database access credentials or keys/salts before sending.
Thanks,
Peter.