Being the world leader in the CMS space, more than 40% of all the websites available on the Internet runs on WordPress. Companies ranging from small to large use WordPress CMS due to its flexibility and easy deployment option. It also offers a variety of plugins and themes that helps website owners with a simple user interface with no manual coding required, reduced deployment costs and deployment time. Besides its popularity among business owners, in recent years, WordPress has become a lucrative target for cybercriminals to hack into the sites and cause data breaches and malware & backdoor implants by exploiting open vulnerabilities in the installed plugins and themes, or in WordPress core.
Statistics show that more than 70 million sites are running on vulnerable WP plugins & themes and 64% of WordPress users are still using outdated versions of WordPress. Shockingly, most website owners are unaware of this fact that their sites are running on vulnerable plugins and themes which makes them an easy target for hackers.
Plugin vulnerabilities are considered as the number one reason for attacks on any CMS platform. Exploiting vulnerabilities in an outdated or unsecured third-party plugin could allow attackers to indirectly target thousands of websites in a single blow. WordPress suffers almost more than 55% of attacks on its sites cased due to vulnerable plugin exploits (see the chart below).
Clearly, we can establish a connection between plugin vulnerabilities and the chances of an attack.
Sadly, most plugin developers treat their users as customers, so they try to focus more on the user experience side of the plugin and the security aspect if it is often neglected in the process.
Not just WordPress, faulty plugins, add-ons extensions, and modules have been a nagging problem and embarrassment for every CMS. Further, for every high-end cyberattack, the plugin’s developers come under brutal scrutiny and face massive criticism online. They also have to work against the clock to patch it asap to control the damage and much of the uproar.
For this reason, developing a plugin is not an easy task. There are certain security practices plugin and theme developers must follow. One such vital security measure is to test your plugin for vulnerabilities while developing it. For this purpose, one can conduct a Plugin security audit, aka Plugin security assessment.
Get the ultimate WordPress security checklist with 300+ test parameters
What is Plugin Security audit or Plugin VAPT?
Simply put, a plugin security audit is a process where experienced developers or security professionals use different sets of automated and manual tools to identify security loopholes, misconfiguration issues, exploitable vulnerabilities, and potential entry points in the plugin.
During the security audit, security professionals act as a hacker and try to hack/harm the plugin by leveraging the security weaknesses present in it. This is to stop the hackers from compromising or infecting a plugin with malicious intent in a real life scenario.
In the tech community, plugin security audit is often known by the name of plugin Vulnerability Assessment and Penetration Testing (VAPT).
Vulnerability Assessment and Penetration Test are types of vulnerability tests. VAPT is a combination of the two that gives optimal results.
A vulnerability assessment, as the name suggests, can identify the various vulnerabilities in the plugin. On the other hand, a penetration test is done to find out if these vulnerabilities can be exploited and how. It also shows the magnitude of the damage that a potential attack can cause. Together, a VAPT can provide data about existing vulnerabilities in your plugin, how potential hackers can exploit them, and the damage that can result from the hack.
That said, after going through this guide you will have enough knowledge and resources to carry out a successful WordPress plugin security audit on your own. More on that later.
First, let’s understand why it is important.
Why is WordPress Plugin Security Audit Important?
More than 52% of WordPress vulnerabilities relate to WordPress plugins and the hackers are actively exploiting them to steal sensitive customer data or even to take over the total admin control of compromised sites. Hence, WordPress plugin security audit becomes a critical element to prevent hacked situations for WP sites by finding and patching exploitable vulnerabilities before hackers do. Otherwise, If hackers find vulnerabilities in plugin before you then they can:
- Encrypt all the website data and ask for ransom.
- Steal the data of your website or users and sell it on the dark web.
- Inject malicious code into a WordPress site that can lead to website blacklist, spam redirection, SEO spam or hosting account suspension.
- Steal the credit card info of WordPress site users which may land lawsuits and hefty fines against website owners.
- Trick website visitors into phishing
- Use a hacked website to infect systems of site visitors and much worse things
There are few other reasons for why you should do a security audit for your WP plugin –
- It can give you a holistic view of misconfigured integrations implemented within your code and offer you a chance to do a secure code review.
- It also helps in preparing your plugin dev/security team to cope up with active vulnerability exploitation.
In addition, If a WP plugin has vulnerabilities and hackers are actively exploiting it then WordPress can temporarily disable that plugin and make it unavailable to the users until the vulnerability is patched in a given time. Here’s an example message shown on the unpatched plugin download page:
What are the common vulnerabilities in WordPress Plugins?
While there are many different techniques hackers use to discover vulnerable WP plugins, there are some commonly seen security vulnerabilities in WP plugins hackers often exploit and break into the site.
Here are some common vulnerabilities in WordPress plugins:
- SQL Injection (SQLi)
- Cross-Site Scripting (XSS)
- Cross-Site Request Forgery (CSRF)
- Code Execution
- Privilege Escalation
- Arbitrary File Upload
You can follow the prevention guidelines mentioned here if your plugin is still under development: link
How to Do WordPress plugin security audit (developers perspective)
A plugin security audit comprises three steps: Information Gathering (i.e. Reconnaissance), Exploitation, and Remediation.
The purpose of a plugin security audit varies with different plugins and developers’ needs. Having said that, almost all plugin security audits tend to encompass the following things:
- Testing all input areas on the plugin
- Checking requests made by the plugin
- Checking the source code
- Checking permissions and data storage on the plugin
- Checking data validation and sanitization
- Checking data escaping / secure output
- Analysis of code to check security issues in early SDLC (Using SAST)
- Checking plugin security in run-time by doing Dynamic Application Security Testing (DAST)
Here is more detailed information on steps to perform while testing your Plugin for security:
Step 1: Setting up the testing environment
- Configure a WP instance on your machine or setup a local environment using this tool
- Install the plugin you want to test
- Activate/configure the plugin
- Configure your browser to route all traffic through Burp tool and enable live scanning
- Add all the widgets/elements on a page
- Navigate through the front-end page where all these elements are there
Step 2: Use code scanners to look through vulnerabilities
- You can use this open source tool to do that: link
Step 3: Run plugin security test cases
- You can use this open source checklist to do that: link
Step 4: Run a coding standard test to find security gaps
- You can follow the steps mentioned in this open-source guide to do that: link
(Note: The WordPress Coding Standards require PHP 5.4 or higher and PHP_CodeSniffer version 3.3.1 or higher)
How to Pentest your WordPress plugin?
1) Gathering Information
The first step in a plugin penetration testing is to gather information about your plugin. This information shall help you in prioritizing security areas you need to test first on your plugin.
Common security areas that are tested in a plugin pentesting are — user data input and related checks (validation, sanitization, escaping), files & directories permissions, configurations, data storage, encryption, web servers, database, and more.
- Nikto: Nikto is a Kali Linux pentest tool. It is extensively used to find out information such as — server, hostname, port, IP, security headers, etc. of an application.
To use this tool on Kali Linux, run the following command:
# nikto –h [examplewebserverurl]
Where [examplewebserverurl] is your web server’s IP or FQDN.
- Nmap: Nmap, short for Network Mapper, is a pen-testing tool used for network inventory, managing service upgrade schedules, and monitoring host or service uptime. In other words, Nmap is a tool that tells you all about the hosting service of that application; from the name of the hosting service, version, operating system to what firewalls or security systems they have, Nmap tells you about all.
To run Nmap on Kali-Linux, run the following command:
nmap -sV -Pn [examplewebserverurl]
By now, you have an idea of all vulnerabilities that are present in your plugin. Next, you need to exploit them. This will help you learn how easily each vulnerability can be exploited and the level of damage it can cause.
- SQLmap: SQLmap is a tool to exploit database vulnerabilities. This tool is basically used to crack open the database by executing malicious queries into the plugin’s input fields.
To use this tool, run the following command in your SQL database:
sqlmap -u “example.com?scan=test” –dbs
- Burp Suite: Burp Suite comprises a range of pen-testing tools. The Burp Suite tools can be used in any stage of a plugin security audit. It caters to both — security assessment and vulnerability exploitation. Tools included in Burp Suite are: HTTP Proxy, Scanner, Intruder, Spider, Repeater, Decoder, Comparer, Extender & Sequencer.
Now that you’re equipped with adequate information about vulnerabilities, you can easily resolve them individually. However, it really does seem like a lot of work.
Get Professional Support
The above process (as simply as I have tried to put it) can be tiring for many. Moreover, if you aren’t a security-savvy person, you cannot be completely sure you executed the plugin VAPT flawlessly. Therefore, we recommend that you get a professional VAPT or security audit for your WordPress plugin to get better results.
Astra’s security experts will thoroughly go through the plugin’s source code, configurations, permissions, and run over 1250 tests to spot vulnerabilities in the plugin or any software and help you resolve them.
VAPT by Astra comes for a very reasonable price and various other features.
Further, Astra’s VAPT process can be broken down to these five pointers:
All it takes is one vulnerable plugin to ruin a website. Plugin exploits affect thousands of websites and businesses daily. Several of which never recover from the aftereffects of a cyberattack and eventually shut down. Cyberattacks taint your business’s reputation and affect customers’ trust. Hence, to save yourself and your plugin from this adversity, it is necessary that you conduct a detailed plugin security audit or plugin security assessment. A plugin VAPT (Vulnerability Assessment and Penetration Testing) helps you to identify and resolve security flaws in your plugin. It is better to get a professional like Astra to conduct security audits that suit your needs.