前言
WordPress 是使用 PHP 语言开发的博客平台,用户可以在支持 PHP 和 MySQL 数据库的服务器上架设属于自己的网站,也可以把 WordPress 当作一个内容管理系统( CMS )来使用。
WordPress 经常爆出漏洞基本都是它的插件存在安全问题。
漏洞复现
首先搭建 WordPress ,我的版本是 4.4 。然后进入后台下载插件 Quizlord ,版本是 2.0 。
![下载插件 Quizlord](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-1-920x372.png)
![下载插件 Quizlord](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-2-920x367.png)
下载、安装完成后,需要点击启用插件。
![点击启用插件](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-3-920x366.png)
根据 exploit-db 给出的漏洞详情,找到触发漏洞的位置。
![exploit-db](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-4-920x575.png)
进入后台选择 Quizlord 插件。
![进入后台选择 Quizlord 插件](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-5-920x327.png)
此时浏览器的地址栏正好对应 POC 中的 referer 内容,现在只要使用火狐插件 hackbar 并根据 POC 构造 POST 请求。
![构造 POST 请求](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-6-920x492.png)
点击 execute 即可发送该 POST 请求。
![发送 POST 请求](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-7-920x154.png)
请求成功后,返回是一个空白页。
![请求成功后,返回是一个空白页](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-8-920x518.png)
返回上一页并刷新即可触发该漏洞。
![返回上一页并刷新即可触发该漏洞](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-9-920x314.png)
通过复现这个漏洞,我们可以知道它属于后台存储型 XSS ,且它的危害其实并不是很大。
需要进入后台,因此必须得知道后台用户的账号和密码。
下面我们来简单分析一下漏洞的成因。
漏洞成因分析
WordPress 插件源码位置:
\wp4_4\wp-content\plugins\
进入 Quizlord 插件目录,找到 quizlord.php 文件。
![找到 quizlord.php 文件](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-10-920x743.png)
下图是 quizlord.php 文件的内容。
![quizlord.php 文件的内容](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-11-920x518.png)
根据 POC 快速定位到函数。发现 POST 传入的数据并没有被程序过滤就写入了数据库中。
![根据 POC 快速定位到函数](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-12-920x1036.png)
修复方案
利用 htmlentities() 函数转义 html 实体。
![利用 htmlentities() 函数转义 html 实体](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-13-920x280.png)
再次提交 POC 后,无法触发 XSS 漏洞。
![再次提交 POC 后,无法触发 XSS 漏洞](https://ccie.lol/wp-content/uploads/2018/11/hole-wordpress-plugin-quizlord-2-0-xss-14-920x518.png)
参考自:
- https://www.exploit-db.com/exploits/45307/
转载自:
- https://www.freebuf.com/vuls/189814.html
发表评论?