当前位置:网站首页>渗透学习-sql注入过程中遇到的问题-针对sort=left(version(),1)的解释-对order by后接字符串的理解
渗透学习-sql注入过程中遇到的问题-针对sort=left(version(),1)的解释-对order by后接字符串的理解
2022-06-27 19:49:00 【dfzy$_$】
问题场景:
这里主要是针对于在我打靶场过程中遇到的一些问题进行解释,即在sqllibs的Less46关使用sort=left(version(),1)依旧能够正常回显的原因,以及对order by后接上字符串即varchar字符类型也能正常回显的解释。
原因分析:
对left这个函数放在order by后的解释:
首先,这里主要解释一下left(version(),1)这里是指从左边起取version()值的第一位,也就是说version()=5.7.26的话,那么left这里就会等于5。
而这里需要注意的是,这里产生出来的值,当放于order by之后时是一个字符串类型的(即varchar类型),也就是说相当于order by “5” 这样子的形式。因此,无论是mid left 还是right最终取出来的都只是“数字内容的字符串”,对它排序仍然使用字符规则,不会得到我们想要的结果。
对order by后接字符串的理解:
假设说我们以order by "5"来执行的话,那么mysql就会按照字面意思是“按数字5排序”,而不是按照表中的第五列进行排序(order by 5是指按照第五列进行排序)。
如果是按照字符规则进行排序的话,这不会在MySQL(除非某些版本进行了改进)中产生正确的排序,除非是偶然的。如果没有进行多余其他的任何操作(如增删改)的话,这里将会按照磁盘中的排序表进行排序(也就是磁盘里读取数据的先后顺序。这应该是由文件系统或者磁盘默认的读取方式所决定的)。
也就是说不管你字符串输入什么,排序基本都是默认的。
输入"5":
输入"less38"
输入1
输入left(version(),1):
由上面几个看出,不论字符串输入什么,排序都是一样的,因为order by按字符集排序是无效的,mysql此时就会默认按照磁盘顺序表进行排序。
结语
以上就是我的理解,如有错欢迎指出!!!
边栏推荐
- Figure countdownlatch and cyclicbarrier based on AQS queue
- [LeetCode]572. A subtree of another tree
- 【mysql实战】查询语句实战演示
- VMware virtual machine PE startup
- 大厂常用软件测试面试题三(附答案)
- 我想我要开始写我自己的博客了。
- Method of reading file contents by Excel
- Example of using gbase 8A OLAP function group by grouping sets
- GBase 8a的create database 会被查询耗时很长怀疑卡住的现象分析
- Go from introduction to actual combat - task cancellation (note)
猜你喜欢

登录凭证(cookie+session和Token令牌)
![[LeetCode]动态规划解分割数组II[Arctic Fox]](/img/a1/4644206db3e14c81f9f64e4da046bf.png)
[LeetCode]动态规划解分割数组II[Arctic Fox]

Windwos 8.1系统安装vmware tool插件报错的解决方法

Yarn中RMApp、RMAppAttempt、RMContainer和RMNode状态机及其状态转移

PCIe knowledge point -008: structure of PCIe switch

vmware虚拟机PE启动
![[leetcode] dynamic programming solution split integer i[silver fox]](/img/18/8dc8159037ec1262444db8899cde0c.png)
[leetcode] dynamic programming solution split integer i[silver fox]

清华大学教授:软件测试已经走入一个误区——“非代码不可”

【MySQL】数据库函数通关教程下篇(窗口函数专题)

不外泄的测试用例设计秘籍--模块测试
随机推荐
Secret script of test case design without leakage -- module test
Magic POI error in reading excel template file
Educational Codeforces Round 108 (Rated for Div. 2)
∫(0→1) ln(1+x) / (x ² + 1) dx
How many ways does selenium upload files? I don't believe you have me all!
Figure countdownlatch and cyclicbarrier based on AQS queue
Simulink method for exporting FMU model files
6G显卡显存不足出现CUDA Error:out of memory解决办法
单元测试界的高富帅,Pytest框架,手把手教学,以后测试报告就这么做~
Analysis of stone merging
百万年薪独家专访,开发人员不修复bug怎么办?
Simulink导出FMU模型文件方法
Go from introduction to practice -- definition and implementation of behavior (notes)
\W and [a-za-z0-9_], \Are D and [0-9] equivalent?
Codeforces Round #722 (Div. 2)
管理系统-ITclub(上)
Gbase 8A OLAP analysis function cume_ Example of dist
A method of go accessing gbase 8A database
Windwos 8.1系统安装vmware tool插件报错的解决方法
軟件測試自動化測試之——接口測試從入門到精通,每天學習一點點