Categories
Security WordPress

What To Do If WordPress Gets Hacked

WordPress is an extremely popular web platform, and because of its popularity, it is often the target of hackers looking to “take over” pieces of your site for their own benefit. Hackers like to maximize the effectiveness of their work, so they’ll often target widely installed plugins or themes with known security vulnerabilities. In most cases, your site was not targeted specifically but was hacked because of some vulnerability in a plugin or theme installed on your site.

If your site is hacked, read the following resources to help you get up and running again. Even if your site has not been hacked, many of these articles cover security topics that are helpful for anyone in charge of a WordPress website.

Categories
Security Tips & Tricks

Tips for our VPS Clients with cPanel

Please note that these tips are suggestions only and cPanel takes no responsibility for modifications to individual servers, or the security practices of individual servers. Server security is a collection of compromises, as any server that allows connections could be insecure. These tips are to be followed at your own risk.

1) Use secure passwords!
Insecure passwords are the most common security vulnerability for most servers. If an account password is insecure and is compromised, client sites can be defaced, infected, or used to spread viruses. Having secure passwords is paramount to having a secure server.

You can edit /etc/login.defs to configure many password options on your system. It is well documented.

Generally, a password utilizing at least 8 characters including alphanumeric and grammatical symbols is sufficient. Never use passwords based upon dictionary words or significant dates. If you are uncertain about the security of a password, then you can test it using JTR cracker. If a password can be broken in a few hours, then it is probably too insecure and should not be used. You can also install tools like pam_passwdqc to check the strength of passwords.

2) Secure SSH
Enable public key authentication for SSH and disable password authentication read more >>

Move SSH access to a different port. People are looking for port 22 as a possible way to access your servers. Moving SSH to a different port will add a simple way to deter those without specific knowledge of your server from easily discovering your SSH port.

You can modify the port that SSH runs on within /etc/ssh/sshd_config. Change the line that says #Port 22 to a different port such as: Port 1653. Make sure to keep your current SSH session open when testing the new port so you can change back to port 22 if the new port doesn’t work.

You should always use SSHv2 only as SSHv1 is not secure. Make sure to change the line in /etc/ssh/sshd_config that says #Protocol 2,1 to Protocol 2.

You may also wish to set Shell Resource Limits for you users to prevent applications and scripts from using all up your resources and taking down your server. You can configure shell resource limits in /etc/security/limits.conf on most Linux systems.

3) Secure Apache
The most readily available way to access a web server, is of course, the web server application. It is important to take steps to secure your Apache installation.

One of the best tools for preventing malicious Apache use is mod_security. This can be installed in Addon Modules in the cPanel section of WebHost Manager. You can find information about mod_security at http://www.modsecurity.org/.

When compiling Apache, you should include suexec to ensure that CGI applications and scripts run as the user that owns / executes them. This will help identify where malicious scripts are and who is running them. It will also enforce permission and environment controls.

We also recommend compiling Apache + PHP with PHPsuexec. PHPsuexec forces all PHP scripts to run as the user who owns the script. This means that you will be able to identify the owner of all PHP scripts running on your server. If one is malicious, you will be able to find it’s owner quickly and resolve the issue. To compile Apache + PHP with PHPsuexec, select the PHPSuexec option in the Apache Upgrade interface in WHM or when running /scripts/easyapache from the command line.

You should enable PHP’s open_basedir protection. This protection will prevent users from open files outside of their home directory with PHP. This can be enabled in Tweak Security within WebHost Manager.

You may also wish to include safe_mode for PHP 5.x and below. Safe_mode ensures that the owner of a PHP script matches the owner of any files to be operated on. You can enable safe_mode by changing the safe_mode = line in php.ini to safe_mode = On.

4) Secure your /tmp partition
We recommend that you use a separate partition for /tmp that is mounted with nosetuid. Nosetuid will force a process to run with the privileges of it’s executor. You may also wish to mount /tmp with noexec after installing cPanel. Check the mount man page for more information.

Also, Running /scripts/securetmp will mount your /tmp partition to a temporary file for extra security.

5) Upgrade your mail to maildir format
Maildir format adds extra security and speed to your mail system. Newer installs use maildir by default. If you’re running an older copy of cPanel, you’ll probably want to upgrade using /scripts/convert2maildir. Make sure to back up your current mail before converting to maildir, this can be done within /scripts/convert2maildir. If you see maildir is enabled when running /scripts/convert2maildir, you are already using maildir, and will not need to convert.

6) Lock down your system’s compilers
Most users do not require the use of C and C++ compilers. You can use the Compilers Tweak within Tweak Security in WebHost Manager to turn off use of the compilers for all unprivileged users, or to disable them for specific users only. Many pre-packaged exploits require working compilers. Disabling compilers will help protect against many exploits.

7) Turn off unused services and daemons
Any service or daemon that allows a connection to be established to your server is away for hackers to gain access. To reduce security risks, you should disable all services and daemons that are not being used.

For Daemons on Linux:
Check /etc/xinetd.conf for services you are not using. For example, cupsd (printing daemon) and nfs/statd (network file system daemons) are not used on many systems.

For Services:
Go to the Service Manager in the Service Configuration section of WHM and disable any services that you are not using.

Monitor your system
It is important to be up to date on what is going on with your system. Make sure that you know when accounts are being created, what software is being installed, when software needs updates, etc.

Check your system frequently to ensure it is functioning in the way you expect. Make sure to check things like:

netstat -anp : Look for programs attached to ports that you did not install / authorize

find / ( -perm -a+w ) ! -type l >> world_writable.txt : Look at world_writable.txt to see all world writable files and directories. This will reveal locations where an attacker can store files on your system. NOTE: Fixing permissions on some PHP/CGI scripts that are not properly coded will break them.

find / -nouser -o -nogroup >> no_owner.txt : Look at no_owner for all files that do not have a user or group associated with them. All files should be owned by a specific user or group to restrict access to them.

ls /var/log/: There are many different logs on your system which can be valuable resources. Check your system logs, apache logs, mail logs, and other logs frequently to make sure your system is functioning as expected.

There are many readily available utilities to monitor your system and to detect rootkits, backdoors, etc. Here are some commonly available utilities:

  • Tripwire – Monitors checksums of files and reports changes.
    http://tripwire.com or http://sourceforge.net/projects/tripwire
  • Chrookit – Scans for common rootkits, backdoors, etc.http://www.chkrootkit.org
  • Rkhunter – Scans for common rootkits, backdoors, etc.http://www.rootkit.nl/projects/rootkit_hunter.html
  • Logwatch – Monitors and reports on daily system activity.http://logwatch.org

9) Enable a Firewall
Installing a firewall to limit access to your server is useful. Removing all unused software on your system is more useful. Before you have the chance to remove all unused services and daemons, or the chance to figure out which services / daemons are unused, you can enable a firewall to prevent unwanted access.

The following will show the ports cPanel and WHM need open to function properly and what the port is used for:

http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AllFAQ/WHMsFAQ#I_use_the_APF_firewall_rules_on

Please note that these ports are for all services that can be used by cPanel and WHM, you may or may not be using all of these services or other services and should adjust your rules accordingly.

Remember to set a cron job to disable your firewall every 5 minutes when testing your rules, or you may be locked out of your server.

10) Stay up to date
It is important to make sure that you are running the latest stable versions of the software on your system to ensure that it has been patched of any security issues that past versions may be susceptible to. Make sure to keep on top of updates for:

  • Kernel
  • cPanel and WHM*
  • User Applications (bulletin boards, CMS, blog engines, etc)**
  • System Software*

*These can be set to automatically update in WebHost Manager under Update Config in the Server Configuration section.

**You can upgrade all Addon installations through Manage Addons in the cPanel section of WebHost Manager.

Categories
Business Technology

Hong Kong the New Tech Hub?

By: Paul Denlinger

More than 10 years ago, before the Internet bubble popped in 2000, Silicon Valley venture capitalists and technology professionals all looked to China as the goal of any leading Internet company. So big was the attraction of China that all of the leading companies to go public went out of their way to associate themselves with the China market. In 1999, the first China-play company to go public on NASDAQ, Chinadotcom (now CDC) went so far as to obtain the ticker symbol CHINA.

Companies based in Hong Kong went out of their way to associate themselves with Beijing and Shanghai, the two leading cities in China. Microsoft, Yahoo and later Google all sought to recruit engineering graduates from Tsinghua University in Beijing, China’s leading university for aspiring scientists (and political leaders), offering the best candidates competitive signing packages. Shanghai became home to China’s leading online gaming firms, lead by Shanda Online Entertainment, which went public in 2004 on NASDAQ and which now has a market cap of US$3 billion.

Compared to Beijing, Hong Kong did not have a high degree of technology talent. It did not have a Tsinghua University. It did not have the growth of the Shanghai region with its population of 100 million. The leading venture capital funds completely bypassed Hong Kong. Even its own best online technology and marketing talent left for Beijing and Shanghai, secure in the knowledge that they would be able to make more in VC-funded companies in mainland China instead of Hong Kong. Attempting to stem the talent flow, and to make Hong Kong more tech-friendly, the Hong Kong government spent millions to develop Cyberport, an ultra-modern tech campus with state of the art infrastructure and its own start-up incubator program. But for many years, the buildings were half empty.

Now though, the tide has turned. Cyberport is almost completely full, and there is a certain confidence in the air of being called a Hong Kong technology professional. What happened?

Broadly speaking, circumstances changed in the technology, business and political fields:

The hot area in software development is now mobile apps for the iPhone and Android platforms, both of which have very high penetration in Hong Kong. Hong Kongers are, for the most part, early adopters of new mobile technology. And mobile apps don’t need large, expensive development teams; most are developed by small teams of 2-3 persons using free development kits from Apple and Google.

The Web 3.0 emphasis on mobile means that even though wages and costs are higher than in mainland China, they are affordable. Break-even points are much lower than 10 years ago, and many smaller firms don’t even need venture capital financing; they can cover their costs based solely on mobile app sales. A small company can sell its apps to the world through the Apple and Google application stores, and collect payment without restriction. One local success story is Stepcase, maker of the popular Darkroom and Actioncam photo applications for the iPhone.

Hong Kong’s high population density makes universal wireless and broadband a reality, making U.S. broadband seem embarrassingly slow in comparison. 1000 MPS service is now advertised to homes.
Setting up a business in Hong Kong is much simpler and more straightforward than in mainland China. A new company can be registered and bank accounts opened in two days, compared to 30-60 days in China. Except for the Chinese yuan, which is non-convertible, payment can be received in any currency.
Another growth area for Hong Kong developers are Facebook gaming and Facebook apps. Facebook is very popular in Hong Kong. It is blocked in mainland China.

Unlike in mainland China, websites are not censored by the Chinese government’s Golden Shield, referred to by critics as the Great Firewall of China, or #gfw. Twitter and Facebook are freely accessible in Hong Kong, without the need for proxy servers as they are in mainland China.

In mainland China, the only three mobile operators are China Mobile, China Unicom and China Telecom. They all report directly to China’s State Council, China’s cabinet, and win their approval for major business decisions. This applies even to the introduction of new mobile services, making them political, not business decisions. In contrast, Hong Kong mobile operators are unregulated about when they can introduce new services for consumers. While mainland Chinese operators are held back waiting for political decisions, Hong Kong operators just charge ahead in the competition for consumers.
Because there is no Internet censorship, the services which are popular in the west are also popular in Hong Kong, such as Yahoo!, Facebook, Twitter and Google. Out of deference to Beijing, this is not widely publicized, though it is well-known among Hong Kong locals and industry insiders.

Over the past year, the Beijing government has implemented a tough policy of holding web publishers accountable for all content, including advertising and comments. Out of fear of losing their licenses, editors have clamped down hard on content. This has had a dampening effect on Internet development in mainland China.
For western companies in China, doing business is very hard. Most recently, Google shut down its Chinese search engine and redirected all China search traffic to… Hong Kong. Earlier casualties included Yahoo! and eBay. Again, deference to Beijing keeps Hong Kong investment officials from talking too loudly about this issue.
Since Hong Kong is the fourth largest capital market in the world, some of China’s leading Internet giants, including Tencent and Alibaba have chosen to list in Hong Kong instead of in New York.

Does this mean that Hong Kong is completely safe now as a technology center for Asia and for China? No. If for instance, China chose to completely lift content restrictions and chose to treat foreign companies completely the same as Chinese companies, and completely deregulate its mobile industry, Hong Kong would lose its advantage.

But that is not likely to happen soon. So for those smart enough to look harder, they can find very interesting options in Hong Kong, China.

Original post