当前位置:网站首页>渗透学习-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此时就会默认按照磁盘顺序表进行排序。
结语
以上就是我的理解,如有错欢迎指出!!!
边栏推荐
- Software test automation test -- interface test from entry to proficiency, learn a little every day
- 使用Fiddler模拟弱网测试(2G/3G)
- qt 大文件生成md5校验码
- Codeforces Round #719 (Div. 3)
- [sword offer ii] sword finger offer II 029 Sorted circular linked list
- Magic POI error in reading excel template file
- BAT测试专家对web测试和APP测试的总结
- 01 golang environment construction
- [leetcode] dynamic programming solution partition array i[red fox]
- This set of steps for performance testing using JMeter includes two salary increases and one promotion
猜你喜欢

Codeforces Round #716 (Div. 2)

Use Fiddler to simulate weak network test (2g/3g)

管理系統-ITclub(下)

深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图

Professor of Tsinghua University: software testing has gone into a misunderstanding - "code is necessary"

Go from introduction to practice -- definition and implementation of behavior (notes)

读写分离-Mysql的主从复制

STM32CubeIDE1.9.0\STM32CubeMX 6.5 F429IGT6加LAN8720A,配置ETH+LWIP

It smells good. Since I used Charles, Fiddler has been completely uninstalled by me

美团20k软件测试工程师的经验分享
随机推荐
[LeetCode]100. 相同的树
Codeforces Round #723 (Div. 2)
List of language weaknesses --cwe, a website worth learning
[LeetCode]572. 另一棵树的子树
CDH集群之YARN性能调优
Crontab scheduled task common commands
Go from introduction to practice -- shared memory concurrency mechanism (notes)
Quick excel export according to customized excel Title Template
VMware virtual machine PE startup
哈希表-数组之和
Bit. Store: long bear market, stable stacking products may become the main theme
Gbase 8A OLAP analysis function cume_ Example of dist
Luogu p5706 redistributing fertilizer and house water
Windwos 8.1系统安装vmware tool插件报错的解决方法
[LeetCode]508. 出现次数最多的子树元素和
\W and [a-za-z0-9_], \Are D and [0-9] equivalent?
管理系统-ITclub(上)
[LeetCode]513. Find the value in the lower left corner of the tree
Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
畅游动态规划之区间DP