Vulnerability Overview
The InfiniteWP Client plugin, versions 1.9.4.4 or earlier, is vulnerable to a critical authentication bypass vulnerability (CVE-2020-8772). This plugin allows WordPress site owners to manage multiple sites from a central server. The vulnerability enables attackers to authenticate to the WordPress installation without proper credentials, potentially leading to unauthorized access and control over the site.
Exploiting this vulnerability does not require the attacker to have the InfiniteWP server installed. By crafting a request to the InfiniteWP Client plugin, attackers can trick the authentication logic into granting administrative access, bypassing the need for valid credentials. This could allow them to perform malicious actions such as modifying site content, installing malware, or taking control of the entire site.
- Plugin Name: InfiniteWP Client
- Affected Versions: Up to and including version 1.9.4.4
- CVE ID: CVE-2023-2916
- CVSS Score: 9.8 (Critical)
Technical Details
The InfiniteWP Client plugin for WordPress, which enables centralized management of multiple WordPress sites, suffers from a critical authentication bypass vulnerability. This vulnerability, identified as CVE-2020-8772, allows attackers to log in as administrators, without proper authentication.
The issue arises due to improper validation of authentication requests within the InfiniteWP Client plugin. Specifically, the vulnerability resides in the iwp_mmb_set_request function located in the init.php file. This function fails to adequately verify the authenticity of certain requests, allowing unauthorized access under specific conditions.
Vulnerable Function: iwp_mmb_set_request
Here is the part of the iwp_mmb_set_request function that contains a vulnerability leading to authentication bypass. Let's dissect why this vulnerability exists and how it can be exploited.
Key Issues Leading to Authentication Bypass
Insufficient Validation of Input Parameters: The code checks if the username parameter is set and if the user is not logged in. However, it does not validate the source or authenticity of the request. Any request with a username parameter will be processed.
Lack of Authentication Verification: The code does not verify that the incoming request is from a legitimate, authenticated source. There are no nonce or token checks to ensure that the request is authorized.
Direct User Impersonation: The function wp_set_current_user($user->ID) sets the current user to the user ID obtained from the username parameter without verifying that the requestor has the right to impersonate this user.
Setting Authentication Cookies: After setting the current user, the code sets authentication cookies (wp_set_auth_cookie($user->ID)) for the specified user ID. This action effectively logs in the user without requiring valid credentials.
If an attacker supplies "admin" as the user and "admin" is the admin user in WordPress, here's a detailed step-by-step breakdown of how the code executes and results in authentication bypass:
1. The code checks if the username parameter is present and the user is not already logged in. Since the attacker is not logged in and has provided the username parameter, this condition is true.
2. The next part of the code retrieves the user object for the provided username ("admin"). Assuming "admin" exists, $user will now hold the user object for the admin user.
3. After that, it checks if the user object and user ID are valid.
4. Since "admin" is a valid user, this condition is true and then it sets the current user to the retrieved user (admin).
5. The above code effectively sets the global user context to the admin user. Then it updates the user's last login time for compatibility with the All In One Security plugin.
6. The next part of the code checks if the connection is over HTTPS.
7. Assuming the site is not using HTTPS, $isHTTPS will be false. So the following code sets the authentication cookies for the admin user. Since it's not HTTPS, it sets both secure and non-secure cookies.
This sets the cookies necessary to authenticate as the admin user. With the admin user set and authentication cookies in place, the attacker can now access the site with admin privileges.
Exploitation:
To exploit the CVE-2020-8772 vulnerability in the InfiniteWP Client plugin, follow these steps:
1. Inspect the web application:
- Scan the wordpress website to see if the InfiniteWP client plugin is installed and also
check if the version is <=1.9.4.4 .
2. Intercept the request of home page :
- Use Burp Suite to intercept the request to the target website
3. Change the method:
- Use the right-click menu to select "Change request method" in order to change the request's format from GET to POST.
4. Create JSON payload:
- Create the JSON payload with base64 encoding for the authentication bypass:
5. Craft the Exploit:
- Append the base64-encoded payload with the String mentioned in the exploit URL:
6. Append the exploit:
- Add this above payload on the body of the intercepted request. The request should look like this:
7. Forward the Modified Request:
- Click on Forward in Burp Suite to send the modified request to the server. Now check the browser, you’ll get something like this
Once you have completed these steps, then navigate to the homepage of the target website. The attack should be successful, and the attacker will have access to the admin dashboard.
By following these steps, an attacker can exploit the CVE-2020-8772 vulnerability in the InfiniteWP Client plugin to bypass authentication and gain unauthorized access to the WordPress site.
Recommendations:
1. Update the Plugin:
- Ensure that you are using the latest version of the InfiniteWP Client plugin (version 1.9.4.5 or higher). Developers often release security patches in newer versions.
- Regularly check for plugin updates and apply them promptly.
2. Restrict Access to the Plugin:
- Limit access to the InfiniteWP Client plugin to trusted IP addresses or specific user roles.
- Avoid exposing the plugin’s functionality to unauthenticated users.
References:
https://wpscan.com/vulnerability/fac62d36-0fa1-4b43-8f5c-bddbd0cff140/
https://0day.work/infinitewp-client-1-9-4-5-authentication-bypass/
https://www.cvedetails.com/cve/CVE-2023-2916/