Haider of Sweden wrote:Would this mean a risk to inject infected PHP files somehow?
It is not possible to upload PHP files from the X3 panel, but I would not claim there is NO risk. Depending on how well your server is configured, it
might be possible to
exploit server with a JPG file upload, especially if they have access to edit the
.htaccess file. Even if they can't upload PHP, they can seriously mess up your X3 website of course. Preventing hackers from logging in to panel in the first place
should be #1 priority.
Keep in mind, if your website DOES get hacked, you might not even notice at first. Unless your website is political, hackers don't really care about "making a mess" or writing "you were hacked [credit line goes here]" any longer. It is more usual to exploit the website as a "link-farm" and/or for SEO/Spam purposes, with hidden links/pages, which will eventually damage your website reputation and credibility.
Tips:
1. Rename your X3 /panel directory
The most effective line of defense is to simply rename your
/panel, for example to /
myxyzpanel. The X3 updater will even work nicely as long as the directory name ends with "*panel".
Most hacks are achieved by hackers (robots and humans) hammering on "known" login links (for example wordpress uses "wp-login.php"). Robot hackers are constantly checking URL's on your website for "known" backdoor login URL's. If found, they will start hammering on the door until they break it open by "brute force attacks". What if they can't find the door? Realistically speaking, this is incredibly effective.
2. Cloudflare
I'm a fan of
Cloudflare myself as a level of "outer" security. Cloudflare uses a "reputation" system to identify threats from IP's, and will recognize bad bots based on their activity, preventing them from reaching your server in the first place. It will also blocks almost all "known" exploits, although this may require the paid version with "WAF - web application firewall". You can even set a max security level for login url
[screenshot].
3. Allow panel access by specific IP or device
There is an example file already in
/panel/disable.htaccess (rename to .htaccess), which shows how you can allow only a specific IP or IP range to login to panel. Highly effective, but if your IP changes (as it mostly does), you will have to keep updating this file by FTP to match your IP. You could also use an
IP range, for example to allow login only from a singe ISP provider or country. You could also use this method to ONLY allow login for a specific browser/version, something I have done earlier. Very effective protection, but sometimes impractical to manage.
4. Use a strong password
Haider of Sweden wrote:Let us assume I have a very weak password and someone manages to get inside the panel.
Unless you are using any of the suggestions above, there simply isn't any excuse these days to use weak passwords for logins that need to be secure. You can find loads of apps/extensions that will create strong passwords for you and save (also across devices).
I wrote a long reply because I want to eventually turn this into a post in our new
X3 docs section.