Find The Right Exploit

πŸ›  Vulnerable Plugins & Themes - Find the right exploit

Many WordPress vulnerabilities stem from outdated or misconfigured plugins and themes. Exploiting these can allow an attacker to gain remote code execution (RCE), privilege escalation, or sensitive information disclosure.

Step-by-Step Exploitation:

  1. Check for Known Vulnerabilities

    • Cross-reference discovered plugins/themes with CVE databases:

      • WPScan Vulnerability Database - Plugins & Themes

      • GitHub PoCs - Security researchers and penetration testers often share proof-of-concept (PoC) exploits on GitHub.

      • CVE Details / NVD (National Vulnerability Database)

      • Google "[Plugin name] exploit" --> check if it is the right version.


Revslider Plugin Exploit Example

An example of a WordPress plugin exploit is from a vulnerability discovered 5 years ago. The vulnerable revslider plugin resulted in tens of thousands of compromised WordPress sites. To this day, there are attempts to exploit it in our web server logs, even in 2019. One reason it was such a popular plugin is that it was bundled with many themes.

A number of exploitation opportunities are possible, but this is perhaps the easiest to demonstrate. Exploitation is as difficult as loading this URL in a browser.

The HTTP request would download the wp-config.php file from the vulnerable site if it had the exploitable version of revslider installed. The exploit type is known as a local file include, as the attacker is tricking the application code into including a sensitive file in the output. The wp-config.php is not normally accessible and contains the database credentials for the WordPress database user.

With the database password, an attacker could attempt to login as the WordPress admin using the same password (if passwords were re-used). A more common attack vector would be to login to the phpmyadmin script if installed, as this uses the database credentials. If MySQL is exposed, it may even possible to directly connect to the database using a MySQL database client and the leaked credentials.

Access to the database provides the attacker options to reset the administrator password, attempt to crack the admin hash, modify content in the database, adding malicious js or iframes. There are many possibilities for further exploitation once the credentials in wp-config.php are leaked.

πŸ“₯ How to Install the Dummy Plugin

To demonstrate this behavior, download the Dummy RevSlider Lab plugin from this repository (ZIP file).

  1. Log in to your WordPress Admin Dashboard.

  2. In the left sidebar, click on Plugins β†’ Add New.

  1. At the top, click Upload Plugin.

  1. Select the downloaded .zip file and upload it.

  1. Once uploaded, click Activate Plugin.

βœ… The plugin is now active and ready for lab use.

Exploitation:

Great! Now everything is set. If we browse to this URL, the plugin will automatically trigger a download of the wp-config.php file, exposing the database username and password.

Please note: You can replace ../../../wp-config.php with any file path on the server. If the file does not exist, the downloaded file will have a size of 0 bytes.

For example, if your WordPress installation is located at /var/www/html/wordpress, any file within this directory can be accessed using ../../../[filename].

If you’re unfamiliar with ../, it simply means β€œgo up one directory level.” By using enough ../ sequences, it is possible to traverse directories and potentially access files anywhere on the system.


OptimizePress Theme Example Exploit

The OptimizePress theme exploit you mentioned is a file upload vulnerability in media-upload.php:

  • Vulnerable versions: ≀ 1.45 (released 2013)

  • Vulnerability type: unauthenticated or insufficiently protected file upload

  • Impact: An attacker can upload a malicious PHP file (shell) and execute arbitrary code on the server.

Why it works:

  • media-upload.php handles file uploads, but the theme does not validate the file type properly.

  • Attackers can bypass restrictions and upload .php scripts.

  • Once uploaded, accessing the PHP file in a browser runs it on the server β†’ full remote code execution (RCE).


βš™ Exploiting WordPress Core

Vulnerabilities in WordPress core crop up from time to time. While remote unauthenticated vulnerabilities are relatively rare, any attacker would do well to be familiar with the more exploitable vulnerabilities in WordPress Core.

CVE-2023-2745: Directory Traversal in WordPress Core ≀6.2

Published: May 17, 2023 CVSS v3.1 Base Score: 6.1 (Medium) CWE Classification: CWE-22 – Improper Limitation of a Pathname to a Restricted Directory Affected Versions: WordPress Core ≀ 6.2 Patched Version: WordPress 6.2.1

CVE-2023-2745 is a directory traversal vulnerability in WordPress Core that affects versions up to and including 6.2. The issue arises from improper sanitization of the wp_lang parameter, which is used to load translation files. An unauthenticated attacker can exploit this flaw to access and load arbitrary translation files from the server, potentially leading to unauthorized information disclosure or further exploitation.

Technical Details

  • Vulnerable Parameter: wp_lang

  • Exploit Mechanism: Directory traversal via wp_lang parameter

  • Potential Impact:

    • Unauthorized access to arbitrary translation files

    • Potential information disclosure

    • In scenarios where an attacker can upload a crafted translation file (e.g., through an upload form), this vulnerability could be leveraged to perform Cross-Site Scripting (XSS) attacks.

πŸ“₯ How to Install the Dummy wp-login.php vulnerablity

To demonstrate this behavior, download the Dummy wp-login.php from this repository.

  1. go to /var/www/html/wordpress/ (Just paste it in the terminal cd /var/www/html/wordpress/)

  2. Remove the old Version of /wp-login.php and paste the Version from GitHub.

  1. Refresh your wordpress server by this command:

βœ… The wp-login.php is now active and ready for lab use.

Lab Usage Options

Option 1 – Manual testing via browser

Open your browser and go to:

  • Replace /etc/passwd with any file in your system.

Option 2 – Automated testing with Python

Run your Python script from my Repo cve-2023-2745:

Please note: first argument is the URL to wp-login.php, and the second is the file you want to read.


CVE-2019-8942 & CVE-2019-8943 - WordPress Core ≀ 4.9.8

WordPress has a built-in image editing feature (wp_crop_image() and wp_create_image_subsizes()) which allows users to upload images and crop/scale them. This functionality touches both filesystem paths and PHP execution paths.

These vulnerabilities stem from:

When chained together:

  1. Path Traversal lets you trick WordPress into reading or writing files outside its intended uploads/ directory.

  2. Local File Inclusion (LFI) allows the attacker to load that file as executable PHP code.

The result β†’ Arbitrary PHP code execution.

Why it happened?

  • WordPress’s image crop function does not sanitize file paths correctly.

  • Attackers can manipulate the imgsrc parameter to include ../../../../ sequences (directory traversal).

  • Cropped files can then be saved in unexpected locations.

  • Later, because of improper validation, these files may be included and executed via require() or include() during thumbnail/metadata generation.

This is dangerous because:

  • An attacker with Author+ role (who can upload media) can upload a fake β€œimage” (actually a PHP backdoor disguised as an image).

  • Using traversal, they move it into a location that WordPress executes as PHP.

  • Finally, they trigger LFI to make WordPress execute the payload β†’ full RCE.

Exploitation with Metasploit (wp_crop_rce)

Metasploit has a ready-made module:

Step 1. Module Setup

Step 2. Configure Payload

Step 3. Run Exploit


Unauthenticated Content Injection in WordPress 4.7.0 and 4.7.1

In this vulnerability from 2017 an attacker is able to inject content into a post using the wp-json API.

WordPress 4.7/4.7.1 - Remote unauthenticated content injection

πŸ“₯ How to Install the Dummy class-wp-rest-posts-controller.php vulnerablity

To demonstrate this behavior, download the Dummy class-wp-rest-posts-controller.php from this repository.

  1. go to /var/www/html/wordpress/wp-includes/rest-api/endpoints (Just paste it in the terminal cd /var/www/html/wordpress/wp-includes/rest-api/endpoints)

  2. Remove the old Version of /var/www/html/wordpress/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php and paste the Version from GitHub.

  1. Refresh your wordpress server by this command:

βœ… The class-wp-rest-posts-controller.php is now active and ready for lab use.

Lab Usage Options

Manual testing via CURL

Open your terminal and send POST request using CURL:

Lets Browse to our site and see the injection!

Last updated